-
Notifications
You must be signed in to change notification settings - Fork 406
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
105 lines (87 loc) · 3.33 KB
/
CMakeLists.txt
File metadata and controls
105 lines (87 loc) · 3.33 KB
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
cmake_minimum_required(VERSION 3.16)
project(teaserpp VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/" ${CMAKE_MODULE_PATH})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# 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 ()
if (DEFINED SKBUILD)
message(STATUS "Building with Scikit-Build")
endif ()
# Options
option(BUILD_SHARED_LIBS "Build shared libraries" 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" OFF)
option(BUILD_DOC "Build documentation" ON)
option(BUILD_WITH_MARCH_NATIVE "Build with flag march=native" OFF)
option(ENABLE_MKL "Try to use Eigen with MKL" OFF)
option(ENABLE_DIAGNOSTIC_PRINT "Enable printing of diagnostic messages" ON)
if (ENABLE_DIAGNOSTIC_PRINT)
message(STATUS "Enable printing of diagnostic messages.")
add_definitions(-DTEASER_DIAG_PRINT)
endif ()
# Find dependencies
# Eigen3
find_package(Eigen3 3.2 QUIET REQUIRED NO_MODULE)
if (ENABLE_MKL)
find_package(MKL)
if (MKL_FOUND)
message(STATUS "MKL found at: ${MKL_LIBRARIES}")
include_directories(${MKL_INCLUDE_DIR})
add_definitions(-DEIGEN_USE_MKL_ALL)
list(APPEND TEASERPP_BLAS_LAPACK_LIBS ${MKL_LIBRARIES})
else ()
message(STATUS "MKL not found.")
endif ()
endif ()
if (BUILD_TEASER_FPFH)
# Boost
find_package(Boost 1.58 QUIET REQUIRED)
# Suppress CMake warnings
# see here: https://github.com/PointCloudLibrary/pcl/issues/3680
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()
find_package(PCL 1.8 QUIET REQUIRED COMPONENTS common io features kdtree)
# check for -march=native in PCL compile definitions
get_target_property(PCL_COMPILE_OPTIONS pcl_common INTERFACE_COMPILE_OPTIONS)
string(FIND "${PCL_COMPILE_OPTIONS}" "-march=native" PCL_IS_NATIVE)
if (NOT PCL_IS_NATIVE EQUAL -1)
# Fix Eigen alignment conflicting with pcl issue
# See: http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html
add_definitions(-DEIGEN_MAX_STATIC_ALIGN_BYTES=0)
if (NOT BUILD_WITH_MARCH_NATIVE)
message (STATUS "PCL built with -march=native. Enable -march=native for TEASER++ as well")
set(BUILD_WITH_MARCH_NATIVE ON)
endif()
endif()
endif ()
# Building Targets
set(TEASERPP_ROOT ${CMAKE_CURRENT_LIST_DIR})
add_subdirectory(teaser)
include(CTest)
if (BUILD_TESTING)
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)
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
)