-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
112 lines (97 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
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
106
107
108
109
110
111
112
# ##############################################################################
# CMakeLists.txt
#
# Copyright (C) 2021-2024 Florian Kurpicz <[email protected]>
#
# pasta::bit_vector is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# pasta::bit_vector is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# pasta::bit_vector. If not, see <http://www.gnu.org/licenses/>.
#
# ##############################################################################
cmake_minimum_required(VERSION 3.25)
project(
pasta_bit_vector
DESCRIPTION "Bit Vector with Compact and Fast Rank and Select Support"
LANGUAGES CXX
VERSION 1.0.1
)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
if (PROJECT_IS_TOP_LEVEL)
# Enable easy formatting
FetchContent_Declare(
Format.cmake
GIT_REPOSITORY https://github.com/TheLartians/Format.cmake
GIT_TAG v1.8.1
)
FetchContent_MakeAvailable(Format.cmake)
add_subdirectory(docs)
endif ()
# Options when compiling pasta::bit_vector Build tests
option(PASTA_BIT_VECTOR_BUILD_TESTS "Build pasta::bit_vector's tests." OFF)
# Build benchmark tools
option(PASTA_BIT_VECTOR_BUILD_BENCHMARKS
"Build pasta::bit_vector's benchmarks." OFF
)
# Build pasta::bit_vector with code coverage options
option(PASTA_BIT_VECTOR_COVERAGE_REPORTING
"Enable coverage reporting for pasta::bit_vector" OFF
)
# Optional code coverage (library compile options are only set if coverage
# reporting is enabled
add_library(pasta_bit_vector_coverage_config INTERFACE)
if (PASTA_BIT_VECTOR_COVERAGE_REPORTING)
target_compile_options(
pasta_bit_vector_coverage_config INTERFACE -fprofile-arcs -ftest-coverage
)
target_link_libraries(pasta_bit_vector_coverage_config INTERFACE gcov)
endif ()
# pasta::bit_vector interface definitions
add_library(pasta_bit_vector INTERFACE)
target_include_directories(
pasta_bit_vector INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(
pasta_bit_vector INTERFACE pasta_utils pasta_bit_vector_coverage_config tlx
)
# Use FetchContent to load dependencies
FetchContent_Declare(
pasta_utils
GIT_REPOSITORY https://github.com/pasta-toolbox/utils.git
GIT_TAG origin/main
)
FetchContent_MakeAvailable(pasta_utils)
FetchContent_Declare(
tlx
GIT_REPOSITORY https://github.com/tlx/tlx.git
GIT_TAG origin/main
)
FetchContent_MakeAvailable(tlx)
# Optional test
if (PASTA_BIT_VECTOR_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif ()
# Optional benchmarks
if (PASTA_BIT_VECTOR_BUILD_BENCHMARKS)
add_executable(bit_vector_benchmark benchmarks/bit_vector_benchmark.cpp)
target_link_libraries(
bit_vector_benchmark
PUBLIC pasta_bit_vector
tlx
pasta_utils
optimized
pasta_memory_monitor
)
endif ()
# ##############################################################################