-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
73 lines (59 loc) · 2.44 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
########################################################
# PotreeConverterGPU #
# Converts a point cloud to a Potree compatible format #
########################################################
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(PotreeConverterGPU LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
######################
# WARNINGS INTERFACE #
######################
add_library(project_warnings INTERFACE)
if (MSVC)
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
target_compile_options(project_warnings INTERFACE $<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/W4 /WX>)
target_compile_options(project_warnings INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler> -WX)
else ()
target_compile_options(project_warnings INTERFACE $<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wall -Wextra -Werror>)
target_compile_options(project_warnings INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler -Werror>)
endif ()
# Specify the PotreeConverterGPU executable
set(SOURCES
src/main.cpp
src/boundingbox.h
src/argparser.h)
add_executable(${PROJECT_NAME} ${SOURCES})
set_property(TARGET ${PROJECT_NAME} PROPERTY CUDA_ARCHITECTURES OFF)
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/External ${PROJECT_SOURCE_DIR}/src)
###########
# OPTIONS #
###########
OPTION(ENABLE_KERNEL_TIMINGS "Turn Cuda kernel timings on or off" OFF) # Disable by default
OPTION(ENABLE_KERNEL_ERROR_CHK "Turn Cuda kernel error checks on or off" OFF) # Disable by default
######################
# ADD SPDLOG LIBRARY #
######################
add_subdirectory(External/spdlog)
if(NOT TARGET spdlog)
find_package(spdlog REQUIRED)
endif()
######################
# ADD OCTREE LIBRARY #
######################
add_subdirectory(OctreeApi)
######################
# LINK TO LIBRARIES #
######################
target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog_header_only)
target_link_libraries(${PROJECT_NAME} PRIVATE OctreeApi)
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings)
#########################################
# COPY OCTREE LIBRARY DLL TO BINARY DIR #
#########################################
if(WIN32)
add_custom_command(TARGET PotreeConverterGPU
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:OctreeApi> $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMENT "Copy dll file to output directory" VERBATIM
)
endif()