summaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
blob: d77a039a1ee305930db3bfba56433d603a16d60d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cmake_minimum_required(VERSION 3.5)
project(OnlineDetectorSimulator)

#define some speciel output paths for libraries and executables
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

#use c++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(Boost_USE_MULTITHREADED ON)
SET(BOOST_MIN_VERSION "1.58.0")
add_definitions(-DBOOST_LOG_DYN_LINK=1)

#find required packages
find_package(LibConfig REQUIRED)
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS log filesystem)
find_package(OpenMP)

#add openmp
if(OPENMP_FOUND)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()

include_directories(
   ${LIBCONFIGPP_INCLUDE_DIR} 
   ${BOOST_INCLUDE_DIRS}
)

set(LINK_LIBRARIES ${LINK_LIBRARIES}
   ${LIBCONFIGPP_LIBRARY}
   ${Boost_LIBRARIES} 
)

set(SOURCES_CLIENT
   "${CMAKE_SOURCE_DIR}/ConfigReader/ConfigReader.cpp"
   "${CMAKE_SOURCE_DIR}/UDPClient/UDPClient.cpp"
   "${CMAKE_SOURCE_DIR}/DetectorModule/DetectorModule.cpp"
   "${CMAKE_SOURCE_DIR}/Detector/Detector.cpp"
   "${CMAKE_SOURCE_DIR}/main_client.cpp"	         
)

set(SOURCES_SERVER
   "${CMAKE_SOURCE_DIR}/UDPServer/UDPServer.cpp"
   "${CMAKE_SOURCE_DIR}/main_server.cpp"
)

add_executable(onlineDetectorSimulatorServer ${SOURCES_SERVER})
add_executable(onlineDetectorSimulatorClient ${SOURCES_CLIENT})
target_link_libraries(onlineDetectorSimulatorClient ${LINK_LIBRARIES})
target_link_libraries(onlineDetectorSimulatorServer ${LINK_LIBRARIES})