diff --git a/src/specmicp_common/CMakeLists.txt b/src/specmicp_common/CMakeLists.txt index b62d380..ea88c8f 100644 --- a/src/specmicp_common/CMakeLists.txt +++ b/src/specmicp_common/CMakeLists.txt @@ -1,192 +1,194 @@ # Main # ==== # var to store the files set(specmicp_common_srcs "" CACHE INTERNAL "specmicp_common files" FORCE) set(specmicp_common_headers "" CACHE INTERNAL "specmicp_common headers" FORCE ) # macro to add to vars macro(add_to_main_srcs_list LIST_NAME) set(tmp "") foreach (src ${${LIST_NAME}}) list(APPEND tmp ${CMAKE_CURRENT_SOURCE_DIR}/${src}) endforeach(src) set(specmicp_common_srcs "${specmicp_common_srcs};${tmp}" CACHE INTERNAL "specmicp common files" FORCE) endmacro(add_to_main_srcs_list) macro(add_to_main_headers_list LIST_NAME) set( tmp "") foreach(header ${${LIST_NAME}}) LIST(APPEND tmp ${CMAKE_CURRENT_SOURCE_DIR}/${header}) endforeach(header) set(specmicp_common_headers "${specmicp_common_headers};${tmp}" CACHE INTERNAL "headers for specmicp common" FORCE) endmacro(add_to_main_headers_list) # set( specmicp_common_main_srcs dateandtime.cpp filesystem.cpp log.cpp moving_average.cpp openmp_support.cpp string_algorithms.cpp timer.cpp ) add_to_main_srcs_list( specmicp_common_main_srcs ) set( specmicp_common_main_headers cached_vector.hpp compat.hpp dateandtime.hpp filesystem.hpp log_impl.hpp log.hpp macros.hpp moving_average.hpp openmp_support.hpp options_handler.hpp perfs_handler.hpp pimpl_ptr.hpp range_iterator.hpp range_iterator.inl scope_guard.hpp string_algorithms.hpp timer.hpp types.hpp ) add_to_main_headers_list( specmicp_common_main_headers ) INSTALL(FILES ${specmicp_common_headers} DESTINATION ${INCLUDE_INSTALL_DIR}/specmicp_common ) add_subdirectory(cli) add_subdirectory(eigen) add_subdirectory(io) add_subdirectory(micpsolver) add_subdirectory(odeint) add_subdirectory(physics) add_subdirectory(plugins) add_subdirectory(sparse_solvers) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS config.h.in) add_custom_target(config_h SOURCES config.h.in) configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h ) # build library # ============= set_pgo_flag(${specmicp_common_srcs}) add_library(objspecmicp_common OBJECT ${specmicp_common_srcs} ${specmicp_common_headers} ) set_property(TARGET objspecmicp_common PROPERTY POSITION_INDEPENDENT_CODE 1) target_include_directories(objspecmicp_common PUBLIC ${EIGEN3_INCLUDE_DIR} ${HDF5_INCLUDE_DIRS}) target_include_directories(objspecmicp_common PUBLIC ${YAML_INCLUDE_DIRS}) target_include_directories(objspecmicp_common PUBLIC $) if(EIGEN3_UNSUPPORTED_FOUND) set_property(TARGET objspecmicp_common APPEND PROPERTY COMPILE_DEFINITIONS EIGEN3_UNSUPPORTED_FOUND) target_include_directories(objspecmicp_common PRIVATE ${EIGEN3_UNSUPPORTED_INCLUDE_DIR}) # added after endif(EIGEN3_UNSUPPORTED_FOUND) set_property(TARGET objspecmicp_common PROPERTY CXX_STANDARD ${SPECMICP_CXX_STANDARD}) set_property(TARGET objspecmicp_common PROPERTY CXX_STANDARD_REQUIRED ON) add_library(specmicp_common SHARED $) if (UNIX) LIST(APPEND specmicp_common_link_libraries dl) else() message(FATAL_ERROR "Plugin system only for POSIX at this time !") endif() install(TARGETS specmicp_common EXPORT ${SPECMICP_TARGET} LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR} ) # static libraries # ---------------- if(SPECMICP_BUILD_STATIC) add_library(specmicp_common_static STATIC $ ) install(TARGETS specmicp_common_static EXPORT ${SPECMICP_TARGET} ARCHIVE DESTINATION ${STATIC_LIBRARY_INSTALL_DIR} ) else() add_library(specmicp_common_static EXCLUDE_FROM_ALL STATIC $ ) endif() set_target_properties(specmicp_common_static PROPERTIES OUTPUT_NAME specmicp_common) # link libraries and include directories # --------------------------------------- foreach(libtarget specmicp_common specmicp_common_static) target_link_libraries(${libtarget} PRIVATE ${specmicp_common_link_libraries}) target_link_libraries(${libtarget} PUBLIC PkgConfig::YAML) target_link_libraries(${libtarget} PUBLIC HDF5::hdf5) target_link_libraries(${libtarget} INTERFACE Eigen::eigen) #if(SPECMICP_USE_BLAS) # target_link_libraries(${libtarget} PUBLIC ${EIGEN3_EXTRA_LINKFLAGS}) #endif() get_property(eigen_include_dirs TARGET Eigen::eigen PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(hdf5_include_dirs TARGET HDF5::hdf5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES) get_property(yaml_include_dirs TARGET PkgConfig::YAML PROPERTY INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(${libtarget} PUBLIC $) target_include_directories(${libtarget} PUBLIC $ $ ) target_include_directories(${libtarget} INTERFACE ${eigen_include_dirs} ) target_include_directories(${libtarget} INTERFACE ${hdf5_include_dirs} ) target_include_directories(${libtarget} INTERFACE ${yaml_include_dirs} ) # if(EIGEN3_UNSUPPORTED_FOUND) set_property(TARGET ${libtarget} APPEND PROPERTY COMPILE_DEFINITIONS EIGEN3_UNSUPPORTED_FOUND) + set_property(TARGET ${libtarget} APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS EIGEN3_UNSUPPORTED_FOUND) target_include_directories(${libtarget} INTERFACE ${EIGEN3_UNSUPPORTED_INCLUDE_DIR}) # added after endif(EIGEN3_UNSUPPORTED_FOUND) spc_set_cxx_version_interface(${libtarget}) endforeach(libtarget)