-
Notifications
You must be signed in to change notification settings - Fork 26
/
CMakeLists.txt
105 lines (86 loc) · 2.5 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
cmake_minimum_required(VERSION 3.12)
#Requires cmake 3.12 for first class cuda support with visual studio
project(cuNSearch LANGUAGES CXX CUDA)
# Visual studio solution directories.
set_property(GLOBAL PROPERTY USE_FOLDERS on)
option(CUNSEARCH_USE_DOUBLE_PRECISION "Use double precision." ON)
if(CUNSEARCH_USE_DOUBLE_PRECISION)
message(STATUS "cuNSearch::Real = double")
else()
message(STATUS "cuNSearch::Real = float")
endif(CUNSEARCH_USE_DOUBLE_PRECISION)
if(CUNSEARCH_USE_DOUBLE_PRECISION)
add_compile_options(-DCUNSEARCH_USE_DOUBLE_PRECISION)
endif(CUNSEARCH_USE_DOUBLE_PRECISION)
OPTION(BUILD_AS_SHARED_LIBS "Build all the libraries as shared" OFF)
if (BUILD_AS_SHARED_LIBS)
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON CACHE BOOL "Export all symbols")
endif(WIN32)
endif (BUILD_AS_SHARED_LIBS)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_DEBUG_POSTFIX "_d")
set (INCLUDE_HEADERS
include/PointSet.h
include/ActivationTable.h
include/Common.h
include/cuNSearch.h
)
set (HEADER_FILES
src/Types.h
src/cuNSearchDeviceData.h
src/GridInfo.h
src/NotImplementedException.h
src/PointSetImplementation.h
src/cuNSearchKernels.cuh
src/helper_linearIndex.h
src/helper_mortonCode.h
Utils/cuda_helper.h
Utils/Timing.h
Utils/IDFactory.h
)
set (SOURCE_FILES
src/PointSet.cu
src/PointSetImplementation.cu
src/cuNSearch.cu
src/cuNSearchDeviceData.cu
src/cuNSearchKernels.cu
Utils/cuda_helper.cu
Utils/Timing.cpp
Utils/IDFactory.cpp
)
if(BUILD_AS_SHARED_LIBS)
add_library(cuNSearch SHARED ${INCLUDE_HEADERS} ${HEADER_FILES} ${SOURCE_FILES})
else()
add_library(cuNSearch STATIC ${INCLUDE_HEADERS} ${HEADER_FILES} ${SOURCE_FILES})
endif()
include(GenerateExportHeader)
generate_export_header(cuNSearch
BASE_NAME cuNSearch
EXPORT_MACRO_NAME cuNSearch_EXPORT
EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/cuNSearch/cuNSearch_export.h
)
target_include_directories(cuNSearch PUBLIC
"include"
"Utils"
${CUDA_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/cuNSearch
)
target_link_libraries(cuNSearch PUBLIC ${CUDA_LIBRARIES})
target_compile_definitions(cuNSearch PUBLIC $<$<CONFIG:DEBUG>:DEBUG>)
list(APPEND INCLUDE_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/cuNSearch/cuNSearch_export.h)
install(FILES ${INCLUDE_HEADERS}
DESTINATION include/)
install(TARGETS cuNSearch
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
option(BUILD_DEMO "Build example of how to use this library."
ON)
if(BUILD_DEMO)
add_subdirectory(demo)
endif(BUILD_DEMO)
unset(USE_DOUBLE_PRECISION CACHE)