-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
69 lines (56 loc) · 1.81 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
# For BK tree build
cmake_minimum_required(VERSION 3.16..3.23)
project(bk-tree
VERSION 0.1.4
LANGUAGES CXX
DESCRIPTION "Header-only Burkhard-Keller tree library"
HOMEPAGE_URL "https://github.com/poyea/bk-tree")
if(MSVC)
add_compile_options(/O2 /permissive- /W4)
else()
add_compile_options(-O3 -Wall -Wextra -Wpedantic -fsanitize=address)
add_link_options(-fsanitize=address)
endif()
set(CMAKE_CXX_STANDARD 20)
include_directories(
${PROJECT_SOURCE_DIR}/bktree
)
file(GLOB EXAMPLE_SRC_FILES ${PROJECT_SOURCE_DIR}/examples/*.cpp)
foreach(file ${EXAMPLE_SRC_FILES})
file(GLOB FILE_SRC
"${PROJECT_SOURCE_DIR}/bktree/*.hpp"
${file}
)
get_filename_component(FILE_NAME ${file} NAME_WLE)
add_executable(${FILE_NAME} ${FILE_SRC})
endforeach()
# For BK tree test build
if(TESTS)
enable_testing()
message("-- Building Tests")
add_subdirectory(tests)
endif()
# For BK tree benchmark build
if(BENCHMARKS)
message("-- Building Benchmarks")
add_subdirectory(benchmarks)
endif()
option(DOCS "Create and install API documentation with Doxygen" ${DOXYGEN_FOUND})
if(DOCS)
# For BK tree documentation build
find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen is needed to build the documentation")
endif()
set(DOXYGEN_EXCLUDE_SYMBOLS "BKTreeNode")
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${PROJECT_SOURCE_DIR}/docs/README.md")
set(DOXYGEN_USE_MATHJAX YES)
set(DOXYGEN_WARN_IF_UNDOCUMENTED NO)
doxygen_add_docs(Documentation
${PROJECT_SOURCE_DIR}/bktree
${PROJECT_SOURCE_DIR}/docs
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/bktree
COMMENT "Generating API documentation with Doxygen"
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION documentation)
endif()