
set(HEADERS 
    Archives.h 
    Array.h 
    Collection.h 
    DataAllocator.h 
    Debug.h 
    Export.h 
    Function.h 
    Macros.h 
    Mpl.h 
    Object.h 
    ObjectFactory.h
    ObjectsContext.h
    Options.h 
    Serializable.h 
    Signal.h 
    Singleton.h 
    SmartPointer.h 
    StaticInterface.h 
    StringReader.h 
    Threads.h
    Monitor.h
    Property.h
    Types.h 
    Uuid.h 
    Vector.h
)

set(SOURCES 
    Archives.cpp 
    Debug.cpp 
    Object.cpp 
    ObjectFactory.cpp
    ObjectsContext.cpp
    Options.cpp 
    Serializable.cpp 
    Signal.cpp 
    Uuid.cpp
    Threads.cpp
)

set(LIBRARIES 
    Boost::program_options 
    Boost::serialization
    OpenMP::OpenMP_CXX
)

set(libname ${PACKAGE_LIBPREFIX}Core)
set(ULIB_SHARED_LIBRARIES ${ULIB_SHARED_LIBRARIES} ${libname} PARENT_SCOPE)
set(ULIB_SELECTED_MODULES ${ULIB_SELECTED_MODULES} Core PARENT_SCOPE)

add_library(${libname} SHARED ${SOURCES})
set_target_properties(${libname} PROPERTIES
                      VERSION ${PROJECT_VERSION}
                      SOVERSION ${PROJECT_SOVERSION})
if(USE_CUDA)
  set(LIBRARIES ${LIBRARIES} CUDA::cudart)
endif()

target_link_libraries(${libname} ${LIBRARIES})
target_compile_definitions(${libname} PUBLIC ULIB_SERIALIZATION_VERSION="${PROJECT_VERSION}")

install(TARGETS ${libname}
        EXPORT "uLibTargets"
        RUNTIME DESTINATION ${INSTALL_BIN_DIR} COMPONENT bin
        LIBRARY DESTINATION ${INSTALL_LIB_DIR} COMPONENT lib)

install(FILES ${HEADERS} DESTINATION ${INSTALL_INC_DIR}/Core)

if(BUILD_TESTING)
  include(uLibTargetMacros)
  add_subdirectory(testing)
endif()
