-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
104 lines (91 loc) · 3.7 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
94
95
96
97
98
99
100
101
102
103
104
set(MIN_CMAKE_VERSION 2.8.11)
cmake_minimum_required(VERSION ${MIN_CMAKE_VERSION})
project(rcl)
# The version number
set(RCL_MAJOR_VERSION 1)
set(RCL_MINOR_VERSION 1)
set(RCL_PATCH_VERSION 1)
set(RCL_VERSION
${RCL_MAJOR_VERSION}.${RCL_MINOR_VERSION}.${RCL_PATCH_VERSION})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# TO debug some optimized code
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O0 -march=native ")
# Option for build configuration
option (BUILD_APP "Builds the application" ON)
option (BUILD_TESTS "Builds all gtests" ON)
# Plugin in download script to add externerl project
include(${CMAKE_SOURCE_DIR}/cmake/DownloadProject.cmake)
# Download google glog 0.4.0
download_project(PROJ glog
GIT_REPOSITORY https://github.com/google/glog.git
GIT_TAG v0.4.0
PREFIX ${CMAKE_BINARY_DIR}/third_party/glog
UPDATE_DISCONNECTED 1
)
# Build glog directly from the download subdirectory
add_subdirectory(${glog_SOURCE_DIR})
# Download Eigen 3.3.6
download_project(PROJ eigen3
HG_REPOSITORY https://bitbucket.org/eigen/eigen/
HG_TAG 3.3.6
PREFIX ${CMAKE_BINARY_DIR}/third_party/eigen3
UPDATE_DISCONNECTED 1
)
# Build local dependencies
add_subdirectory(sensor_fusion)
add_dependencies(sensor_fusion glog)
add_subdirectory(io)
add_dependencies(io sensor_fusion)
# Build the app
if (BUILD_APP)
# build the post process application
download_project( PROJ matplot
GIT_REPOSITORY https://github.com/lava/matplotlib-cpp.git
GIT_TAG master
PREFIX ${CMAKE_BINARY_DIR}/third_party/matplot
UPDATE_DISCONNECTED 1
)
find_package(PythonLibs 2.7 REQUIRED)
set(POST_APP_NAME ${PROJECT_NAME}_post_process_app)
add_executable(${POST_APP_NAME} apps/src/post_process_app_main)
target_include_directories(${POST_APP_NAME} PRIVATE
io/include
sensor_fusion/include
apps/include
${matplot_SOURCE_DIR}
${PYTHON_INCLUDE_DIRS})
# Link libraties
target_link_libraries(${POST_APP_NAME}
io
sensor_fusion
${PYTHON_LIBRARIES})
# build the real-time process application
set(REALTIME_APP_NAME ${PROJECT_NAME}_realtime_process_app)
add_executable(${REALTIME_APP_NAME} apps/src/realtime_app_main)
target_include_directories(${REALTIME_APP_NAME} PRIVATE
io/include
sensor_fusion/include
apps/include
${matplot_SOURCE_DIR}
${PYTHON_INCLUDE_DIRS})
# Link libraties
target_link_libraries(${REALTIME_APP_NAME}
io
sensor_fusion
${PYTHON_LIBRARIES})
endif()
if (BUILD_TESTS)
download_project(PROJ googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
PREFIX ${CMAKE_BINARY_DIR}/third_party/gtest
UPDATE_DISCONNECTED 1
)
# Prevent GoogleTest from overriding our compiler/linker options
# when building with Visual Studio
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
endif()