-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
54 lines (46 loc) · 1.9 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
cmake_minimum_required(VERSION 3.8)
project(pointcloud_raster VERSION 1.1.0)
# Options
option(POINTCLOUD_RASTER_BUILD_APP "Build sample app to get images from a pointcloud" ON)
option(POINTCLOUD_RASTER_BUILD_TESTS "Build tests (requires GoogleTest)" ON)
option(POINTCLOUD_RASTER_LAS_SUPPORT "Enable build with LibLAS for LAS/LAZ files" OFF)
option(POINTCLOUD_RASTER_PLY_SUPPORT "Enable build with internal PLY reader (only XYZRGB pointclouds)" ON)
option(POINTCLOUD_RASTER_PNG_SUPPORT "Enable build with libPNG (otherwise, memory only interface will be available)" ON)
option(POINTCLOUD_RASTER_PYTHON_SUPPORT "Enable python bindings" OFF)
set(POINTCLOUD_RASTER_TEST_OUTPUT "." CACHE STRING "Folder to put test generated files")
# Default build to Release
set(default_build_type "Release")
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build to default type '${default_build_type}'.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build.")
endif ()
if (POINTCLOUD_RASTER_PNG_SUPPORT)
find_package(PNG REQUIRED)
endif()
# Needed for pybind compilation
if (POINTCLOUD_RASTER_PYTHON_SUPPORT)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
add_subdirectory(lib)
if (POINTCLOUD_RASTER_BUILD_APP AND POINTCLOUD_RASTER_PNG_SUPPORT)
add_subdirectory(app)
endif ()
# Python
if (POINTCLOUD_RASTER_PYTHON_SUPPORT)
find_package(Python COMPONENTS Interpreter Development REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
pybind11_add_module(py_pointcloud_raster
${CMAKE_CURRENT_SOURCE_DIR}/python/bindings.cpp
)
target_link_libraries(py_pointcloud_raster
PRIVATE
PointcloudRaster::PointcloudRaster
)
target_compile_features(py_pointcloud_raster PRIVATE cxx_std_17)
endif()
# Testing
if (POINTCLOUD_RASTER_BUILD_TESTS)
enable_testing()
find_package(GTest REQUIRED)
add_subdirectory(tests)
endif ()