Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
142 lines (122 loc) · 3.93 KB
/
Copy pathCMakeLists.txt
File metadata and controls
142 lines (122 loc) · 3.93 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
cmake_minimum_required(VERSION 3.30...4.3)
include(infra/cmake/enable-experimental-import-std.cmake)
project(
beman.gates
DESCRIPTION "Asynchronous synchronization primitives"
LANGUAGES CXX
VERSION 0.1.0
)
# [CMAKE.SKIP_TESTS]
option(
BEMAN_GATES_BUILD_TESTS
"Enable building tests and test infrastructure. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)
# [CMAKE.SKIP_EXAMPLES]
option(
BEMAN_GATES_BUILD_EXAMPLES
"Enable building examples. Default: ${PROJECT_IS_TOP_LEVEL}. Values: { ON, OFF }."
${PROJECT_IS_TOP_LEVEL}
)
option(BEMAN_GATES_USE_MODULES "Provide beman.gates as a C++ module" OFF)
option(BEMAN_GATES_ENABLE_TRACY "Enable Tracy profiling support" OFF)
if(BEMAN_GATES_USE_MODULES)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
endif()
include(FetchContent)
FetchContent_Declare(
execution
# SOURCE_DIR ${CMAKE_SOURCE_DIR}/../execution
GIT_REPOSITORY https://github.com/bemanproject/execution
GIT_TAG cd3211e8f2fdeaa4237de3803513438cac20aa2b
FIND_PACKAGE_ARGS
0.3.0
EXACT
NAMES beman.execution
COMPONENTS execution_headers
)
FetchContent_MakeAvailable(execution)
if(BEMAN_GATES_ENABLE_TRACY AND NOT TARGET Tracy::TracyClient)
FetchContent_Declare(
tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG 05cceee0df3b8d7c6fa87e9638af311dbabc63cb # v0.13.1
FIND_PACKAGE_ARGS NAMES Tracy CONFIG
)
FetchContent_MakeAvailable(tracy)
endif()
set(BEMAN_GATES_ENABLE_PROFILING ${BEMAN_GATES_ENABLE_TRACY})
message(
STATUS
"beman.gates profiling: ${BEMAN_GATES_ENABLE_PROFILING} (Tracy: ${BEMAN_GATES_ENABLE_TRACY})"
)
configure_file(
"${PROJECT_SOURCE_DIR}/include/beman/gates/config_generated.hpp.in"
"${PROJECT_BINARY_DIR}/include/beman/gates/config_generated.hpp"
@ONLY
)
# for find of beman_install_library and configure_build_telemetry
include(infra/cmake/beman-install-library.cmake)
include(infra/cmake/BuildTelemetryConfig.cmake)
if(BEMAN_GATES_USE_MODULES)
add_library(beman.gates STATIC)
else()
add_library(beman.gates INTERFACE)
endif()
add_library(beman::gates ALIAS beman.gates)
if(BEMAN_GATES_USE_MODULES)
target_sources(
beman.gates
PUBLIC
FILE_SET CXX_MODULES
FILE_SET HEADERS
BASE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
set_target_properties(beman.gates PROPERTIES CXX_MODULE_STD ON)
target_compile_features(beman.gates PUBLIC cxx_std_23)
else()
target_sources(
beman.gates
PUBLIC
FILE_SET HEADERS
BASE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
set_target_properties(
beman.gates
PROPERTIES VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL}
)
endif()
if(BEMAN_GATES_USE_MODULES)
target_link_libraries(beman.gates PUBLIC beman::execution_headers)
if(BEMAN_GATES_ENABLE_TRACY)
target_link_libraries(beman.gates PUBLIC Tracy::TracyClient)
endif()
else()
target_link_libraries(beman.gates INTERFACE beman::execution_headers)
if(BEMAN_GATES_ENABLE_TRACY)
target_link_libraries(beman.gates INTERFACE Tracy::TracyClient)
endif()
endif()
add_subdirectory(include/beman/gates)
set(beman_gates_dependencies
[===[beman.execution 0.3.0 EXACT COMPONENTS execution_headers]===]
)
if(BEMAN_GATES_ENABLE_TRACY)
list(APPEND beman_gates_dependencies [===[Tracy CONFIG]===])
endif()
beman_install_library(beman.gates TARGETS beman.gates
DEPENDENCIES ${beman_gates_dependencies}
)
configure_build_telemetry()
if(BEMAN_GATES_BUILD_TESTS)
enable_testing()
add_subdirectory(tests/beman/gates)
endif()
if(BEMAN_GATES_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()