project (spps VERSION 2.2.1) # Change scope of theses variables in order to be used by I-SIMPA gui project set(spps_VERSION_MAJOR ${spps_VERSION_MAJOR} PARENT_SCOPE) set(spps_VERSION_MINOR ${spps_VERSION_MINOR} PARENT_SCOPE) set(spps_VERSION_PATCH ${spps_VERSION_PATCH} PARENT_SCOPE) include_directories (./ "${CMAKE_SOURCE_DIR}/src/lib_interface" "${CMAKE_CURRENT_BINARY_DIR}/generated/") #--------------# # SOURCES #--------------# # Sources files set(DATA_MANAGER_SOURCES data_manager/core_configuration.h data_manager/core_configuration.cpp) set(IO_SOURCES input_output/reportmanager.h input_output/reportmanager.cpp) set(TOOLS_SOURCES tools/dotreflection.h tools/dotdistribution.h tools/dotdistribution.cpp) set(SPPS_SOURCES CalculationCore.h CalculationCore.cpp sppsInitialisation.h sppsInitialisation.cpp sppsTypes.h sppsTypes.cpp ${CMAKE_CURRENT_BINARY_DIR}/generated/sppsVersion.h) set(SPPS_MAIN_SOURCES sppsNantes.cpp) # Sources groups (folders) source_group("data_manager" FILES ${DATA_MANAGER_SOURCES}) source_group("input_output" FILES ${IO_SOURCES}) source_group("tools" FILES ${TOOLS_SOURCES}) source_group("" FILES ${SPPS_SOURCES} $(SPPS_MAIN_SOURCES)) #---------------------------------------# # DEPENDENCY & EXECUTABLE (OR LIB) #---------------------------------------# # Check for clock_gettime function if (CMAKE_SYSTEM_NAME EQUAL "LINUX") include(CheckLibraryExists) check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME ) if(NOT HAVE_CLOCK_GETTIME) include(CheckFunctionExists) set(CMAKE_EXTRA_INCLUDE_FILES time.h) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) SET(CMAKE_EXTRA_INCLUDE_FILES) endif(NOT HAVE_CLOCK_GETTIME) endif() configure_file(sppsVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/generated/sppsVersion.h ) # Set Properties->General->Configuration Type to Application # Creates spps with the listed sources # Adds sources to the Solution Explorer add_executable(spps ${DATA_MANAGER_SOURCES} ${IO_SOURCES} ${TOOLS_SOURCES} ${SPPS_SOURCES} ${SPPS_MAIN_SOURCES}) # Creates a folder "executables" and adds target project (spps.vcproj) under it set_property(TARGET spps PROPERTY FOLDER "executables") SetupBoost() target_link_libraries (spps lib_interface Boost::random Boost::thread) if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-D_DEBUG) message(STATUS " SPPS debug build disable multi threading") else() message(STATUS " SPPS release build enable multi threading") target_link_libraries (spps ${CMAKE_THREAD_LIBS_INIT}) if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") target_link_libraries (spps) elseif(CMAKE_SYSTEM_NAME EQUAL "LINUX") target_link_libraries (spps rt) endif() endif() #------------# # TEST #------------# # Data files set(TEST_DATA_DIR "${PROJECT_BINARY_DIR}/Testing") set(SPPS_TEST_DIR "${TEST_DATA_DIR}/") configure_file(tests/config.xml ${SPPS_TEST_DIR}/config.xml) file(COPY tests/speaker-test3.txt DESTINATION ${TEST_DATA_DIR}) # Test executable and folder set(SPPS_TESTS tests/spps_core_test.cpp) add_executable(TEST_spps ${SPPS_TESTS} ${DATA_MANAGER_SOURCES} ${IO_SOURCES} ${TOOLS_SOURCES} ${SPPS_SOURCES}) target_link_libraries (TEST_spps lib_interface Boost::unit_test_framework Boost::random) set_property(TARGET TEST_spps PROPERTY FOLDER "tests") # Add to test suite enable_testing() add_test( NAME spps_core_test WORKING_DIRECTORY ${TEST_DATA_DIR} COMMAND TEST_spps )