2022-06-28 08:31:05 +08:00
|
|
|
fdb_find_sources(FDBCLIENT_SRCS)
|
2022-07-26 08:08:32 +08:00
|
|
|
list(APPEND FDBCLIENT_SRCS sha1/SHA1.cpp)
|
2018-05-04 06:48:10 +08:00
|
|
|
|
2022-06-24 04:37:35 +08:00
|
|
|
message(STATUS "FDB version is ${FDB_VERSION}")
|
|
|
|
message(STATUS "FDB package name is ${FDB_PACKAGE_NAME}")
|
|
|
|
|
2019-04-18 03:10:51 +08:00
|
|
|
set(options_srcs ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g.cpp)
|
2018-05-04 06:48:10 +08:00
|
|
|
|
2022-06-24 08:05:36 +08:00
|
|
|
make_directory(${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/)
|
|
|
|
vexillographer_compile(TARGET fdboptions_vex LANG cpp OUT ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g
|
2019-02-05 13:25:10 +08:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g.h ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g.cpp)
|
2018-05-04 06:48:10 +08:00
|
|
|
|
2022-06-24 08:05:36 +08:00
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/FDBOptions.g.h
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g.h
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g.h ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/FDBOptions.g.h)
|
|
|
|
|
|
|
|
vexillographer_compile(TARGET fdboptions_c LANG c OUT ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/fdb_c_options.g.h
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/fdb_c_options.g.h)
|
|
|
|
|
|
|
|
add_custom_target(fdboptions DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/FDBOptions.g.h)
|
|
|
|
add_dependencies(fdboptions fdboptions_c)
|
|
|
|
|
2022-06-24 08:45:26 +08:00
|
|
|
################################################################################
|
|
|
|
# Build information
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/BuildFlags.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/BuildFlags.h)
|
|
|
|
|
|
|
|
|
2020-10-23 00:40:27 +08:00
|
|
|
set(BUILD_AZURE_BACKUP OFF CACHE BOOL "Build Azure backup client")
|
|
|
|
if(BUILD_AZURE_BACKUP)
|
|
|
|
add_compile_definitions(BUILD_AZURE_BACKUP)
|
|
|
|
set(FDBCLIENT_SRCS
|
|
|
|
${FDBCLIENT_SRCS}
|
2022-06-28 08:31:05 +08:00
|
|
|
azure_backup/BackupContainerAzureBlobStore.actor.cpp)
|
2020-10-11 11:10:12 +08:00
|
|
|
|
2020-10-23 00:40:27 +08:00
|
|
|
configure_file(azurestorage.cmake azurestorage-download/CMakeLists.txt)
|
2020-10-11 11:10:12 +08:00
|
|
|
|
2020-10-23 00:40:27 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
|
|
|
RESULT_VARIABLE results
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/azurestorage-download
|
|
|
|
)
|
2020-10-11 11:10:12 +08:00
|
|
|
|
2020-10-23 00:40:27 +08:00
|
|
|
if(results)
|
|
|
|
message(FATAL_ERROR "Configuration step for AzureStorage has Failed. ${results}")
|
|
|
|
endif()
|
2020-10-11 11:10:12 +08:00
|
|
|
|
2020-10-23 00:40:27 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} --build . --config Release
|
|
|
|
RESULT_VARIABLE results
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/azurestorage-download
|
|
|
|
)
|
2020-10-11 11:10:12 +08:00
|
|
|
|
2020-10-23 00:40:27 +08:00
|
|
|
if(results)
|
|
|
|
message(FATAL_ERROR "Build step for AzureStorage has Failed. ${results}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_subdirectory(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/azurestorage-src
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/azurestorage-build
|
|
|
|
)
|
|
|
|
endif()
|
2020-10-11 11:10:12 +08:00
|
|
|
|
2022-03-02 07:11:12 +08:00
|
|
|
|
|
|
|
if(WITH_AWS_BACKUP)
|
|
|
|
add_compile_definitions(BUILD_AWS_BACKUP)
|
|
|
|
include(awssdk)
|
|
|
|
endif()
|
|
|
|
|
2019-04-18 03:10:51 +08:00
|
|
|
add_flow_target(STATIC_LIBRARY NAME fdbclient SRCS ${FDBCLIENT_SRCS} ADDL_SRCS ${options_srcs})
|
2022-06-28 08:31:05 +08:00
|
|
|
target_include_directories(fdbclient PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include")
|
2022-06-24 04:37:35 +08:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/versions.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/versions.h)
|
2021-09-22 02:35:55 +08:00
|
|
|
add_dependencies(fdbclient fdboptions)
|
2022-06-30 06:10:14 +08:00
|
|
|
target_link_libraries(fdbclient PUBLIC fdbrpc msgpack PRIVATE rapidxml)
|
2021-07-24 08:18:13 +08:00
|
|
|
|
|
|
|
# Create a separate fdbclient library with sampling enabled. This lets
|
|
|
|
# fdbserver retain sampling functionality in client code while disabling
|
|
|
|
# sampling for pure clients.
|
|
|
|
add_flow_target(STATIC_LIBRARY NAME fdbclient_sampling SRCS ${FDBCLIENT_SRCS} ADDL_SRCS ${options_srcs})
|
2022-06-28 09:11:24 +08:00
|
|
|
target_include_directories(fdbclient_sampling PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include")
|
2021-09-22 02:35:55 +08:00
|
|
|
add_dependencies(fdbclient_sampling fdboptions)
|
2022-06-30 06:10:14 +08:00
|
|
|
target_link_libraries(fdbclient_sampling PUBLIC fdbrpc_sampling msgpack PRIVATE rapidxml)
|
2021-07-24 08:18:13 +08:00
|
|
|
target_compile_definitions(fdbclient_sampling PRIVATE -DENABLE_SAMPLING)
|
2021-08-21 00:32:56 +08:00
|
|
|
if(WIN32)
|
|
|
|
add_dependencies(fdbclient_sampling_actors fdbclient_actors)
|
|
|
|
endif()
|
2021-07-24 08:18:13 +08:00
|
|
|
|
2022-07-18 23:59:03 +08:00
|
|
|
add_flow_target(LINK_TEST NAME fdbclientlinktest SRCS LinkTest.cpp)
|
Add test executables to catch missing symbols
Currently, we have code in different folders like `flow/` and `fdbrpc/`
that should remain isolated. For example, `flow/` files should not
include functionality from any other modules. `fdbrpc/` files should
only be able to include functionality from itself and from `flow/`.
However, when creating a shared library, the linker doesn't complain
about undefined symbols -- this only happens when creating an
executable. Thus, for example, it is possible to forward declare an
`fdbclient` function in an `fdbrpc` file and then use it, and nothing
will break (when it should, because this is illegal).
This change adds dummy executables for a few modules (`flow`, `fdbrpc`,
`fdbclient`) that will cause a linker error if there are included
symbols which the linker can't resolve.
2022-06-25 08:08:58 +08:00
|
|
|
target_link_libraries(fdbclientlinktest PRIVATE fdbclient rapidxml) # re-link rapidxml due to private link interface
|
|
|
|
|
2020-10-23 00:40:27 +08:00
|
|
|
if(BUILD_AZURE_BACKUP)
|
2022-08-09 16:37:24 +08:00
|
|
|
target_link_libraries(fdbclient PRIVATE curl azure-storage-lite)
|
|
|
|
target_link_libraries(fdbclient_sampling PRIVATE curl azure-storage-lite)
|
2020-10-23 00:40:27 +08:00
|
|
|
endif()
|
2022-03-02 07:11:12 +08:00
|
|
|
|
|
|
|
if(BUILD_AWS_BACKUP)
|
|
|
|
target_link_libraries(fdbclient PUBLIC awssdk_target)
|
|
|
|
target_link_libraries(fdbclient_sampling PUBLIC awssdk_target)
|
|
|
|
endif()
|
2022-07-14 04:53:20 +08:00
|
|
|
|