forked from UNC-Robotics/steerable-needle-planner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (78 loc) · 3.39 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
cmake_minimum_required(VERSION 3.8)
project(steerable-needle-planner)
# Build type
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
# On 32bit architectures, use RelWithDebInfo
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Type of build" FORCE)
endif()
endif()
message(STATUS "Building ${CMAKE_BUILD_TYPE}")
# Use C++ 17 for nign and mpt
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
# OpenMp
OPTION (USE_OpenMP "Use OpenMP to enable <omp.h>" ON)
# Find OpenMP
if(APPLE AND USE_OpenMP)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(OpenMP_C "${CMAKE_C_COMPILER}")
set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES})
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(OpenMP_CXX "${CMAKE_CXX_COMPILER}")
set(OpenMP_CXX_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument")
set(OpenMP_CXX_LIB_NAMES "libomp" "libgomp" "libiomp5")
set(OpenMP_libomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libgomp_LIBRARY ${OpenMP_CXX_LIB_NAMES})
set(OpenMP_libiomp5_LIBRARY ${OpenMP_CXX_LIB_NAMES})
endif()
set(OPENMP_LIBRARIES "/usr/local/opt/llvm/lib")
set(OPENMP_INCLUDES "/usr/local/opt/llvm/include")
include_directories("${OPENMP_INCLUDES}")
link_directories("${OPENMP_LIBRARIES}")
endif()
if(USE_OpenMP)
message("OpenMP is required!")
find_package(OpenMP REQUIRED)
endif(USE_OpenMP)
if (OPENMP_FOUND)
message("OpenMP is found!")
if(NOT APPLE)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif(OPENMP_FOUND)
# Check for eigen3
find_package(Eigen3 REQUIRED)
if(NOT EIGEN3_FOUND)
set(EIGEN3_INCLUDE_DIR "EIGEN3-NOTFOUND" CACHE PATH "Location of EIGEN3 headers")
endif()
if(EIGEN3_INCLUDE_DIR)
include_directories(${EIGEN3_INCLUDE_DIR})
message("Eigen3 include dir: ${EIGEN3_INCLUDE_DIR}")
else(EIGEN3_INCLUDE_DIR)
message("Eigen3 not found! Please set it manually!")
endif()
# Check for Boost
find_package(Boost 1.56.0 COMPONENTS system program_options timer chrono thread serialization date_time filesystem regex)
include_directories(${Boost_INCLUDE_DIRS})
message("Boost headers: ${Boost_INCLUDE_DIRS}")
message("Boost libraries: ${Boost_LIBRARIES}")
include_directories(BEFORE "include")
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/include")
include_directories(BEFORE "external/nigh/src")
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/external/nigh/src")
include_directories(BEFORE "external/mpt/src")
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}/external/mpt/src")
add_subdirectory(app)