-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
77 lines (72 loc) · 3.26 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
cmake_minimum_required(VERSION 3.15)
project(chad_tsdf LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# check if project is top level
set(CHAD_TOP_LEVEL OFF)
if (PROJECT_IS_TOP_LEVEL)
set(CHAD_TOP_LEVEL ON)
include(_global)
endif()
# set build options
option(CHAD_ENABLE_ENTRY "Enables entrypoint in main.cpp" CHAD_TOP_LEVEL)
if (NOT DEFINED CHAD_POPCOUNT_INSTRUCTION)
set(CHAD_POPCOUNT_INSTRUCTION std::popcount<uint8_t>)
endif()
if (NOT DEFINED CHAD_NORM_NEIGH_UPPER)
set(CHAD_NORM_NEIGH_UPPER 20) # kinda irrelevant for the most part
endif()
if (NOT DEFINED CHAD_NORM_NEIGH_LOWER)
set(CHAD_NORM_NEIGH_LOWER 2) # higher quality due to potentially many more normal neighbours
endif()
if (NOT DEFINED CHAD_NORM_MIN_NEIGH)
set(CHAD_NORM_MIN_NEIGH 25) # requires this many neighbours to compute a normal
endif()
if (NOT DEFINED CHAD_NORM_RADIUS_MOD)
set(CHAD_NORM_RADIUS_MOD 1.2) # eh idk about this one (should change to float for max search radius)
endif()
if (NOT DEFINED CHAD_MIN_CANDIDATES)
set(CHAD_MIN_CANDIDATES 3)
endif()
if (NOT DEFINED CHAD_LEAF_RESOLUTION)
set(CHAD_LEAF_RESOLUTION 0.05)
endif()
if (NOT DEFINED CHAD_LEAF_BITS)
set(CHAD_LEAF_BITS 8)
endif()
# create executable/library
# set(CPP_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/chad/chad.cpp")
file(GLOB_RECURSE CPP_SOURCE_FILES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
if (CHAD_TOP_LEVEL)
set(CPP_SOURCE_FILES ${CPP_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
add_executable(${PROJECT_NAME} ${CPP_SOURCE_FILES})
target_compile_definitions(${PROJECT_NAME} PRIVATE CHAD_MAIN)
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/"
CXXFLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
else()
add_library(${PROJECT_NAME} ${CPP_SOURCE_FILES})
add_library(chad::tsdf ALIAS ${PROJECT_NAME})
endif()
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_compile_definitions(${PROJECT_NAME} PUBLIC CHAD_NORM_NEIGH_UPPER=${CHAD_NORM_NEIGH_UPPER})
target_compile_definitions(${PROJECT_NAME} PUBLIC CHAD_NORM_NEIGH_LOWER=${CHAD_NORM_NEIGH_LOWER})
target_compile_definitions(${PROJECT_NAME} PUBLIC CHAD_NORM_MIN_NEIGH=${CHAD_NORM_MIN_NEIGH})
target_compile_definitions(${PROJECT_NAME} PUBLIC CHAD_NORM_MAX_NEIGH=${CHAD_NORM_MAX_NEIGH})
target_compile_definitions(${PROJECT_NAME} PUBLIC CHAD_NORM_RADIUS_MOD=${CHAD_NORM_RADIUS_MOD})
target_compile_definitions(${PROJECT_NAME} PUBLIC CHAD_MIN_CANDIDATES=${CHAD_MIN_CANDIDATES})
target_compile_definitions(${PROJECT_NAME} PUBLIC LEAF_RESOLUTION=${CHAD_LEAF_RESOLUTION})
target_compile_definitions(${PROJECT_NAME} PUBLIC LEAF_BITS=${CHAD_LEAF_BITS})
target_compile_definitions(${PROJECT_NAME} PUBLIC CHAD_POPCOUNT_INSTRUCTION=${CHAD_POPCOUNT_INSTRUCTION})
# fetch project dependencies
include(FetchContent)
set(FETCHCONTENT_QUIET OFF) # enable git output for FetchContent steps
set(FETCHCONTENT_UPDATES_DISCONNECTED ON) # speed up consecutive config runs
include(glm)
include(fmt)
include(phmap)
include(morton)
include(vulkan)
include(vma)
include(shaders)