forked from MIT-SPARK/TEASER-plusplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
121 lines (99 loc) · 4.19 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
cmake_minimum_required(VERSION 3.10)
project(teaserpp VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/" ${CMAKE_MODULE_PATH})
# Check build types
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE "Release" CACHE
STRING "Choose the type of build." FORCE)
endif()
# Options
option(BUILD_TESTS "Build tests" ON)
option(BUILD_TEASER_FPFH "Build TEASER++ wrappers for PCL FPFH estimation." OFF)
option(BUILD_MATLAB_BINDINGS "Build MATLAB bindings" OFF)
option(BUILD_PYTHON_BINDINGS "Build Python bindings" ON)
option(BUILD_DOC "Build documentation" ON)
option(BUILD_WITH_MKL "Build Eigen with MKL." OFF)
option(BUILD_WITH_MARCH_NATIVE "Build with flag march=native" OFF)
option(ENABLE_DIAGNOSTIC_PRINT "Enable printing of diagnostic messages" OFF)
if (ENABLE_DIAGNOSTIC_PRINT)
message(STATUS "Enable printing of diagnostic messages.")
add_definitions(-DTEASER_DIAG_PRINT)
endif ()
# Cache Variables
if (NOT TEASERPP_PYTHON_VERSION)
set(TEASERPP_PYTHON_VERSION "" CACHE STRING "Python version to use for TEASER++ bindings.")
endif ()
# Find dependencies
# Eigen3
find_package(Eigen3 3.3 QUIET REQUIRED NO_MODULE)
# MKL
if (BUILD_WITH_MKL)
add_definitions(-DEIGEN_USE_MKL_ALL)
endif ()
if (BUILD_TEASER_FPFH)
# Boost
find_package(Boost 1.58 QUIET REQUIRED)
# PCL
find_package(PCL 1.8 QUIET REQUIRED COMPONENTS common io features kdtree)
endif ()
# googletest
configure_file(cmake/GoogleTest.CMakeLists.txt.in googletest-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory("${CMAKE_BINARY_DIR}/googletest-src"
"${CMAKE_BINARY_DIR}/googletest-build")
# pmc (Parallel Maximum Clique)
configure_file(cmake/pmc.CMakeLists.txt.in pmc-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pmc-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pmc-download")
add_subdirectory("${CMAKE_BINARY_DIR}/pmc-src"
"${CMAKE_BINARY_DIR}/pmc-build")
# tinyply
configure_file(cmake/tinyply.CMakeLists.txt.in tinyply-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/tinyply-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/tinyply-download")
add_subdirectory("${CMAKE_BINARY_DIR}/tinyply-src"
"${CMAKE_BINARY_DIR}/tinyply-build")
target_include_directories(tinyply PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/tinyply-src/source>)
# Building Targets
set(TEASERPP_ROOT ${CMAKE_CURRENT_LIST_DIR})
add_subdirectory(teaser)
if (BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif ()
if (BUILD_DOC)
add_subdirectory(doc EXCLUDE_FROM_ALL)
endif ()
if (BUILD_MATLAB_BINDINGS)
message(STATUS "Will build MATLAB bindings.")
add_subdirectory(matlab)
endif ()
if (BUILD_PYTHON_BINDINGS)
set(PYBIND11_PYTHON_VERSION ${TEASERPP_PYTHON_VERSION})
# download the pybind11 repo
configure_file(cmake/pybind11.CMakeLists.txt.in pybind11-download/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pybind11-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/pybind11-download")
add_subdirectory("${CMAKE_BINARY_DIR}/pybind11-src"
"${CMAKE_BINARY_DIR}/pybind11-build")
message(STATUS "TEASER++ Python binding will be built.")
add_subdirectory(python)
endif ()
# export targets
export(TARGETS ${TEASERPP_EXPORTED_TARGETS} FILE teaserpp-exports.cmake)
install(FILES cmake/teaserppConfig.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/teaserpp
)