-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
94 lines (71 loc) · 2.63 KB
/
CMakeLists.txt
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# usage:
#
# mkdir build; cd build; cmake ..
# or (on edison)
# mkdir build; cd build; cmake -DFULL_BUILD=OFF ..
#
cmake_minimum_required(VERSION 3.13)
project(anemomind)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include("cmake/FindCXXFeatures.cmake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
include("cmake/GTest.cmake")
set(FULL_BUILD ON CACHE BOOL "enables full build or restrict to minimum")
set(WITH_SAILROOT ON CACHE BOOL "Build the sailroot shared object to load in ROOT")
if (WITH_SAILROOT)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif(WITH_SAILROOT)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
if (${FULL_BUILD})
include("cmake/ADOLC.cmake")
include("cmake/POCO.cmake")
include("cmake/ceres-solver.cmake")
include("cmake/FindMongoDB.cmake")
include("cmake/FindF2C.cmake")
find_package(Cairo )
if (CAIRO_INCLUDE_DIRS)
include_directories(${CAIRO_INCLUDE_DIRS})
endif()
find_package(Eigen3 REQUIRED)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
find_package(LAPACK REQUIRED)
find_package(BLAS REQUIRED)
find_package(Armadillo REQUIRED)
add_definitions(-DENABLE_HACKS)
add_definitions(-DARMA_DONT_USE_WRAPPER)
add_definitions(-DARMA_USE_LAPACK)
function(target_depends_on_armadillo target)
target_link_libraries(${target} ${ARMADILLO_LIBRARY} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
endfunction()
function(target_depends_on_f2c target)
target_link_libraries(${target} ${F2C_LIBRARY})
endfunction()
find_library(M_LIB m)
function(target_depends_on_m target)
target_link_libraries(${target} ${M_LIB})
endfunction()
# this include dir should be set per-target.
# However, cmake does not propagate this property to dependents. As a hack,
# the armadillo include dir will be accessible to all files.
# In the future, a variation of the following line might be useful:
# set_property(TARGET ${target} APPEND PROPERTY INCLUDE_DIRECTORIES ${ARMADILLO_INCLUDE_DIR})
include_directories(${ARMADILLO_INCLUDE_DIR})
include_directories(${F2C_INCLUDE_DIR})
include_directories(${LibM_INCLUDES})
endif ()
find_package(Protobuf REQUIRED)
find_package(Boost REQUIRED COMPONENTS system iostreams filesystem)
if (APPLE)
set(WHOLE_ARCHIVE "-Wl,-force_load")
set(NOWHOLE_ARCHIVE "")
else ()
set(WHOLE_ARCHIVE "-Wl,--whole-archive")
set(NOWHOLE_ARCHIVE "-Wl,--no-whole-archive")
endif ()
include_directories(${CMAKE_SOURCE_DIR}/src)
# For protocol-buffer generated .h files, we need to have build dir as include
# path, too.
include_directories(${CMAKE_BINARY_DIR}/src)
add_definitions("-DON_SERVER")
add_subdirectory(src)