-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
88 lines (69 loc) · 2.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
cmake_minimum_required(VERSION 3.15)
project(vinspect)
set(CMAKE_CXX_STANDARD 20)
set(PYBIND11_FINDPYTHON ON)
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(Open3D REQUIRED)
find_package(Python REQUIRED COMPONENTS Interpreter Development)
find_package(PythonLibs 3 REQUIRED)
find_package(pybind11 REQUIRED)
find_package(TBB REQUIRED)
list(APPEND CMAKE_MODULE_PATH "/usr/include/tbb/")
find_package(OpenMP)
if(OPENMP_FOUND)
if(NOT TARGET OpenMP::OpenMP_CXX)
find_package(Threads REQUIRED)
add_library(OpenMP::OpenMP_CXX IMPORTED INTERFACE)
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS} Threads::Threads)
endif()
endif()
add_compile_options(-Wall -Wextra -Wpedantic)
include_directories(include)
set(SOURCES src/inspection.cpp src/utils.cpp src/sparse_mesh.cpp)
add_library(${PROJECT_NAME} SHARED ${SOURCES})
target_link_libraries(${PROJECT_NAME} TBB::tbb OpenMP::OpenMP_CXX)
ament_target_dependencies(${PROJECT_NAME}
ament_cmake
Open3D
)
pybind11_add_module(vinspect_py src/python_bindings.cpp)
ament_target_dependencies(vinspect_py PUBLIC
pybind11
Python3
Open3D
)
target_link_libraries(vinspect_py PUBLIC vinspect)
set_target_properties(vinspect_py PROPERTIES LINKER_LANGUAGE CXX)
if(BUILD_TESTING)
file(GLOB_RECURSE AMENT_LINT_AUTO_FILE_EXCLUDE
include/Octree/*
)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
# Add a hook for colcon to add the Python library directory to the PYTHONPATH environment variable
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/share/vinspect/hook/python_path.dsv
"prepend-non-duplicate;PYTHONPATH;lib/python3/dist-packages")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/share/vinspect/hook/python_path.dsv
DESTINATION share/vinspect/hook)
install(
DIRECTORY include/
DESTINATION include
)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION lib
INCLUDES DESTINATION include)
install(
TARGETS vinspect_py
DESTINATION lib/python3/dist-packages/${PROJECT_NAME}
)
ament_export_dependencies(pybind11)
ament_export_dependencies(Python3)
ament_export_dependencies(TBB)
ament_export_dependencies(Open3D)
ament_export_libraries(${PROJECT_NAME})
ament_export_include_directories(include)
ament_package()