# Copyright 2006-2008 The FLWOR Foundation.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


#
# Source Files
#
SET(SIMPLE_STORE_SRCS
    simple_store.cpp
    basic_item_factory.cpp
    simple_iterator_factory.cpp
    simple_collection.cpp
    simple_temp_seq.cpp
    simple_pul.cpp
    simple_loader.cpp
    fast_loader.cpp
    atomic_items.cpp
    item.cpp
    node_items.cpp
    node_vector.cpp
    node_updates.cpp
    node_iterators.cpp
    qname_pool.cpp
    ordpath.cpp
    nsbindings.cpp
    item_iterator.cpp
    query_context.cpp
    string_pool.cpp
    properties.cpp
    inmemorystore.cpp
    inmemorystorec.cpp
)

#
# Internal common libraries
#
SET(requiredlibs-simplestore ${requiredlibs-simplestore} zorbautils)
SET(requiredlibs-simplestore ${requiredlibs-simplestore} zorbatypes)
SET(requiredlibs-simplestore ${requiredlibs-simplestore} zorbaerrors)


SET(SIMPLESTORE_INSTALL_LIST)

IF (ZORBA_BUILD_STATIC_LIBRARY)

  ADD_LIBRARY(simplestore_static ${SIMPLE_STORE_SRCS})
  TARGET_LINK_LIBRARIES(simplestore_static ${requiredlibs-simplestore})

  SET_TARGET_PROPERTIES(simplestore_static PROPERTIES OUTPUT_NAME "simplestore")  
  SET_TARGET_PROPERTIES(simplestore_static PROPERTIES VERSION ${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER})  
  SET_TARGET_PROPERTIES(simplestore_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)

  SET(SIMPLESTORE_INSTALL_LIST ${SIMPLESTORE_INSTALL_LIST} simplestore_static)

ENDIF (ZORBA_BUILD_STATIC_LIBRARY)


IF (MSVC)
  ADD_LIBRARY(simplestore ${SIMPLE_STORE_SRCS})
ELSE (MSVC)
  ADD_LIBRARY(simplestore SHARED ${SIMPLE_STORE_SRCS})
ENDIF (MSVC)

TARGET_LINK_LIBRARIES(simplestore ${requiredlibs-simplestore})

SET_TARGET_PROPERTIES(simplestore PROPERTIES VERSION ${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER})

SET_TARGET_PROPERTIES(simplestore PROPERTIES CLEAN_DIRECT_OUTPUT 1)

SET(SIMPLESTORE_INSTALL_LIST ${SIMPLESTORE_INSTALL_LIST} simplestore)

INSTALL(TARGETS ${SIMPLESTORE_INSTALL_LIST}
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
)
