-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
324 lines (303 loc) · 9.44 KB
/
Copy pathCMakeLists.txt
File metadata and controls
324 lines (303 loc) · 9.44 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
cmake_minimum_required(VERSION 3.25)
project(
aws_durable_execution
VERSION 0.1.0
DESCRIPTION "High-performance C++ SDK for AWS Lambda durable executions"
LANGUAGES CXX
)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
option(DURABLE_EXECUTION_BUILD_TESTS "Build unit tests" ${PROJECT_IS_TOP_LEVEL})
option(DURABLE_EXECUTION_BUILD_EXAMPLES "Build examples" ${PROJECT_IS_TOP_LEVEL})
option(DURABLE_EXECUTION_BUILD_BENCHMARKS "Build microbenchmarks" OFF)
option(DURABLE_EXECUTION_ENABLE_SANITIZERS "Enable AddressSanitizer and UndefinedBehaviorSanitizer" OFF)
option(DURABLE_EXECUTION_BUILD_AWS_SDK_ADAPTER "Build the AWS SDK for C++ Lambda service adapter" OFF)
option(DURABLE_EXECUTION_BUILD_LAMBDA_RUNTIME_ADAPTER "Export the AWS Lambda C++ runtime adapter target" OFF)
option(DURABLE_EXECUTION_BUILD_CONFORMANCE "Build deployable AWS conformance handlers" OFF)
add_library(aws_durable_execution
src/context.cpp
src/execution_state.cpp
src/local_runner.cpp
src/model.cpp
src/plugin.cpp
src/wire.cpp
src/detail/blake2b.cpp
)
add_library(aws::durable_execution ALIAS aws_durable_execution)
set_target_properties(
aws_durable_execution
PROPERTIES
EXPORT_NAME durable_execution
VERSION "${PROJECT_VERSION}"
SOVERSION 1
)
target_compile_features(aws_durable_execution PUBLIC cxx_std_23)
target_include_directories(
aws_durable_execution
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
if(MSVC)
target_compile_options(aws_durable_execution PRIVATE /W4 /permissive-)
else()
target_compile_options(
aws_durable_execution
PRIVATE
-Wall
-Wextra
-Wpedantic
-Wconversion
-Wshadow
)
endif()
if(DURABLE_EXECUTION_ENABLE_SANITIZERS AND NOT MSVC)
target_compile_options(aws_durable_execution PUBLIC -fsanitize=address,undefined -fno-omit-frame-pointer)
target_link_options(aws_durable_execution PUBLIC -fsanitize=address,undefined)
endif()
set(DURABLE_EXECUTION_PACKAGE_HAS_AWS_SDK OFF)
if(DURABLE_EXECUTION_BUILD_AWS_SDK_ADAPTER)
# The installed AWS SDK Core target exposes ZLIB::ZLIB in its public link
# interface but some SDK releases do not materialize that imported target
# from AWSSDKConfig.cmake. Resolve it first so downstream/static builds work
# consistently, including Amazon Linux Lambda packaging builds.
find_package(ZLIB REQUIRED)
find_package(AWSSDK REQUIRED COMPONENTS lambda)
add_library(
aws_durable_execution_aws_sdk
src/aws_sdk/service_client.cpp
)
add_library(
aws::durable_execution_aws_sdk
ALIAS aws_durable_execution_aws_sdk
)
set_target_properties(
aws_durable_execution_aws_sdk
PROPERTIES
EXPORT_NAME durable_execution_aws_sdk
VERSION "${PROJECT_VERSION}"
SOVERSION 1
)
target_compile_features(aws_durable_execution_aws_sdk PUBLIC cxx_std_23)
target_include_directories(
aws_durable_execution_aws_sdk
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(
aws_durable_execution_aws_sdk
PUBLIC
aws::durable_execution
)
if(TARGET AWS::aws-cpp-sdk-lambda)
target_link_libraries(
aws_durable_execution_aws_sdk
PUBLIC AWS::aws-cpp-sdk-lambda
)
elseif(TARGET aws-cpp-sdk-lambda)
target_link_libraries(
aws_durable_execution_aws_sdk
PUBLIC aws-cpp-sdk-lambda
)
elseif(AWSSDK_LINK_LIBRARIES)
target_link_libraries(
aws_durable_execution_aws_sdk
PUBLIC ${AWSSDK_LINK_LIBRARIES}
)
else()
message(FATAL_ERROR "AWSSDK was found but no Lambda link target was exposed")
endif()
if(MSVC)
target_compile_options(
aws_durable_execution_aws_sdk
PRIVATE /W4 /permissive-
)
else()
target_compile_options(
aws_durable_execution_aws_sdk
PRIVATE
-Wall
-Wextra
-Wpedantic
-Wconversion
-Wshadow
)
endif()
if(DURABLE_EXECUTION_ENABLE_SANITIZERS AND NOT MSVC)
target_compile_options(
aws_durable_execution_aws_sdk
PUBLIC -fsanitize=address,undefined -fno-omit-frame-pointer
)
target_link_options(
aws_durable_execution_aws_sdk
PUBLIC -fsanitize=address,undefined
)
endif()
install(
TARGETS aws_durable_execution_aws_sdk
EXPORT aws_durable_execution_targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
set(DURABLE_EXECUTION_PACKAGE_HAS_AWS_SDK ON)
endif()
set(DURABLE_EXECUTION_PACKAGE_HAS_LAMBDA_RUNTIME OFF)
if(DURABLE_EXECUTION_BUILD_LAMBDA_RUNTIME_ADAPTER)
find_package(aws-lambda-runtime REQUIRED)
add_library(aws_durable_execution_lambda_runtime INTERFACE)
add_library(
aws::durable_execution_lambda_runtime
ALIAS aws_durable_execution_lambda_runtime
)
set_target_properties(
aws_durable_execution_lambda_runtime
PROPERTIES EXPORT_NAME durable_execution_lambda_runtime
)
target_compile_features(
aws_durable_execution_lambda_runtime
INTERFACE cxx_std_23
)
target_include_directories(
aws_durable_execution_lambda_runtime
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(
aws_durable_execution_lambda_runtime
INTERFACE
aws::durable_execution
AWS::aws-lambda-runtime
)
install(
TARGETS aws_durable_execution_lambda_runtime
EXPORT aws_durable_execution_targets
)
set(DURABLE_EXECUTION_PACKAGE_HAS_LAMBDA_RUNTIME ON)
endif()
if(DURABLE_EXECUTION_BUILD_TESTS)
enable_testing()
add_executable(durable_execution_tests tests/test_main.cpp)
target_link_libraries(durable_execution_tests PRIVATE aws::durable_execution)
add_test(NAME durable_execution_tests COMMAND durable_execution_tests)
set_tests_properties(
durable_execution_tests
PROPERTIES WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_executable(
durable_execution_conformance_local_tests
conformance/local_tests.cpp
)
target_link_libraries(
durable_execution_conformance_local_tests
PRIVATE aws::durable_execution
)
target_include_directories(
durable_execution_conformance_local_tests
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_test(
NAME durable_execution_conformance_local_tests
COMMAND durable_execution_conformance_local_tests
)
find_package(Python3 COMPONENTS Interpreter QUIET)
if(Python3_Interpreter_FOUND)
add_test(
NAME durable_execution_conformance_assets
COMMAND
"${Python3_EXECUTABLE}"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/validate_conformance_assets.py"
)
endif()
endif()
if(DURABLE_EXECUTION_BUILD_EXAMPLES)
add_executable(order_workflow examples/order_workflow.cpp)
target_link_libraries(order_workflow PRIVATE aws::durable_execution)
if(
DURABLE_EXECUTION_BUILD_AWS_SDK_ADAPTER
AND DURABLE_EXECUTION_BUILD_LAMBDA_RUNTIME_ADAPTER
)
add_executable(order_lambda examples/lambda_main.cpp)
target_link_libraries(
order_lambda
PRIVATE
aws::durable_execution_aws_sdk
aws::durable_execution_lambda_runtime
)
if(COMMAND aws_lambda_package_target)
aws_lambda_package_target(order_lambda)
endif()
endif()
endif()
if(DURABLE_EXECUTION_BUILD_CONFORMANCE)
if(
NOT DURABLE_EXECUTION_BUILD_AWS_SDK_ADAPTER
OR NOT DURABLE_EXECUTION_BUILD_LAMBDA_RUNTIME_ADAPTER
)
message(
FATAL_ERROR
"Conformance handlers require both AWS SDK and Lambda runtime adapters"
)
endif()
add_executable(
durable_execution_conformance
conformance/main.cpp
)
target_include_directories(
durable_execution_conformance
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}"
)
target_link_libraries(
durable_execution_conformance
PRIVATE
aws::durable_execution_aws_sdk
aws::durable_execution_lambda_runtime
)
if(COMMAND aws_lambda_package_target)
aws_lambda_package_target(durable_execution_conformance)
endif()
endif()
if(DURABLE_EXECUTION_BUILD_BENCHMARKS)
add_executable(durable_execution_microbench benchmarks/microbench.cpp)
target_link_libraries(durable_execution_microbench PRIVATE aws::durable_execution)
endif()
install(
TARGETS aws_durable_execution
EXPORT aws_durable_execution_targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(
FILES README.md LICENSE NOTICE
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
install(
DIRECTORY docs/
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
install(
EXPORT aws_durable_execution_targets
FILE aws_durable_execution_targets.cmake
NAMESPACE aws::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/aws_durable_execution"
)
configure_package_config_file(
cmake/aws_durable_executionConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/aws_durable_executionConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/aws_durable_execution"
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/aws_durable_executionConfigVersion.cmake"
VERSION "${PROJECT_VERSION}"
COMPATIBILITY SameMajorVersion
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/aws_durable_executionConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/aws_durable_executionConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/aws_durable_execution"
)