2018-05-04 07:28:18 +08:00
|
|
|
set(FDB_C_SRCS
|
|
|
|
fdb_c.cpp
|
|
|
|
foundationdb/fdb_c.h
|
2022-03-16 02:01:05 +08:00
|
|
|
foundationdb/fdb_c_internal.h
|
|
|
|
foundationdb/fdb_c_types.h)
|
2018-05-04 07:28:18 +08:00
|
|
|
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/foundationdb)
|
|
|
|
|
2019-02-06 11:29:01 +08:00
|
|
|
set(asm_file ${CMAKE_CURRENT_BINARY_DIR}/fdb_c.g.S)
|
|
|
|
|
2021-11-11 11:05:38 +08:00
|
|
|
set(os "linux")
|
|
|
|
set(cpu "intel")
|
2018-05-04 07:28:18 +08:00
|
|
|
if(APPLE)
|
2021-11-11 11:05:38 +08:00
|
|
|
set(os "osx")
|
2019-02-06 11:29:01 +08:00
|
|
|
elseif(WIN32)
|
2021-11-11 11:05:38 +08:00
|
|
|
set(os "windows")
|
2019-02-06 11:29:01 +08:00
|
|
|
set(asm_file ${CMAKE_CURRENT_BINARY_DIR}/fdb_c.g.asm)
|
2021-11-11 11:05:38 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
|
|
|
|
set(cpu "aarch64")
|
2022-02-18 20:53:23 +08:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64le|powerpc64le)")
|
2022-02-11 14:17:15 +08:00
|
|
|
set(cpu "ppc64le")
|
2021-11-11 11:05:38 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(IS_ARM_MAC NO)
|
|
|
|
if(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
|
|
|
|
set(IS_ARM_MAC YES)
|
2018-05-04 07:28:18 +08:00
|
|
|
endif()
|
|
|
|
|
2019-02-06 11:29:01 +08:00
|
|
|
add_custom_command(OUTPUT ${asm_file} ${CMAKE_CURRENT_BINARY_DIR}/fdb_c_function_pointers.g.h
|
2021-11-11 11:05:38 +08:00
|
|
|
COMMAND $<TARGET_FILE:Python::Interpreter> ${CMAKE_CURRENT_SOURCE_DIR}/generate_asm.py ${os} ${cpu}
|
2018-05-04 07:28:18 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fdb_c.cpp
|
2019-02-06 11:29:01 +08:00
|
|
|
${asm_file}
|
2018-05-04 07:28:18 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/fdb_c_function_pointers.g.h
|
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate_asm.py ${CMAKE_CURRENT_SOURCE_DIR}/fdb_c.cpp
|
|
|
|
COMMENT "Generate C bindings")
|
2019-02-06 11:29:01 +08:00
|
|
|
add_custom_target(fdb_c_generated DEPENDS ${asm_file}
|
2018-05-04 07:28:18 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/fdb_c_function_pointers.g.h)
|
|
|
|
|
2019-02-05 13:25:10 +08:00
|
|
|
vexillographer_compile(TARGET fdb_c_options LANG c OUT ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_options.g.h
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_options.g.h)
|
2018-05-04 07:28:18 +08:00
|
|
|
|
2018-05-05 06:35:27 +08:00
|
|
|
include(GenerateExportHeader)
|
|
|
|
|
2019-02-18 09:54:54 +08:00
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
add_library(fdb_c OBJECT ${FDB_C_SRCS} ${asm_file})
|
|
|
|
else()
|
|
|
|
add_library(fdb_c SHARED ${FDB_C_SRCS} ${asm_file})
|
2019-03-21 11:27:10 +08:00
|
|
|
strip_debug_symbols(fdb_c)
|
2019-02-18 09:54:54 +08:00
|
|
|
endif()
|
2018-05-04 07:28:18 +08:00
|
|
|
add_dependencies(fdb_c fdb_c_generated fdb_c_options)
|
2021-09-22 02:35:55 +08:00
|
|
|
add_dependencies(fdbclient fdb_c_options)
|
|
|
|
add_dependencies(fdbclient_sampling fdb_c_options)
|
2022-03-02 10:08:50 +08:00
|
|
|
target_link_libraries(fdb_c PRIVATE $<BUILD_INTERFACE:fdbclient>)
|
2022-07-08 01:18:30 +08:00
|
|
|
if(USE_UBSAN)
|
|
|
|
# The intent of this hack is to force c targets that depend on fdb_c to use
|
|
|
|
# c++ as their linker language. Otherwise you see undefined references to c++
|
|
|
|
# specific ubsan symbols.
|
|
|
|
add_library(force_cxx_linker STATIC IMPORTED)
|
|
|
|
set_property(TARGET force_cxx_linker PROPERTY IMPORTED_LOCATION /dev/null)
|
|
|
|
set_target_properties(force_cxx_linker PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES CXX)
|
|
|
|
target_link_libraries(fdb_c PUBLIC $<BUILD_INTERFACE:force_cxx_linker>)
|
|
|
|
endif()
|
2020-02-13 11:35:12 +08:00
|
|
|
if(APPLE)
|
|
|
|
set(symbols ${CMAKE_CURRENT_BINARY_DIR}/fdb_c.symbols)
|
|
|
|
add_custom_command(OUTPUT ${symbols}
|
|
|
|
COMMAND $<TARGET_FILE:Python::Interpreter> ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h
|
2022-06-02 05:04:53 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c_internal.h
|
2020-02-13 11:35:12 +08:00
|
|
|
${symbols}
|
2022-06-02 05:04:53 +08:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/symbolify.py ${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c.h ${CMAKE_CURRENT_SOURCE_DIR}/foundationdb/fdb_c_internal.h
|
2020-02-13 11:35:12 +08:00
|
|
|
COMMENT "Generate exported_symbols_list")
|
|
|
|
add_custom_target(exported_symbols_list DEPENDS ${symbols})
|
|
|
|
add_dependencies(fdb_c exported_symbols_list)
|
2020-02-19 02:49:43 +08:00
|
|
|
target_link_options(fdb_c PRIVATE "LINKER:-no_weak_exports,-exported_symbols_list,${symbols}")
|
2020-02-13 11:35:12 +08:00
|
|
|
elseif(WIN32)
|
|
|
|
else()
|
2022-06-23 23:39:46 +08:00
|
|
|
if (NOT USE_UBSAN)
|
|
|
|
# For ubsan we need to export type information for the vptr check to work.
|
|
|
|
# Otherwise we only want to export fdb symbols in the fdb c api.
|
|
|
|
target_link_options(fdb_c PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/fdb_c.map")
|
|
|
|
endif()
|
|
|
|
target_link_options(fdb_c PRIVATE "LINKER:-z,nodelete,-z,noexecstack")
|
2020-02-13 11:35:12 +08:00
|
|
|
endif()
|
2018-05-05 06:35:27 +08:00
|
|
|
target_include_directories(fdb_c PUBLIC
|
2019-05-24 02:15:39 +08:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/foundationdb>)
|
2019-02-06 11:29:01 +08:00
|
|
|
if(WIN32)
|
|
|
|
enable_language(ASM_MASM)
|
|
|
|
set_property(SOURCE ${asm_file} PROPERTY LANGUAGE ASM_MASM)
|
|
|
|
endif()
|
2019-02-10 07:13:25 +08:00
|
|
|
|
2022-03-05 04:49:40 +08:00
|
|
|
# The tests don't build on windows
|
|
|
|
if(NOT WIN32)
|
2019-06-07 07:58:11 +08:00
|
|
|
set(MAKO_SRCS
|
2022-04-02 00:25:43 +08:00
|
|
|
test/mako/async.hpp
|
|
|
|
test/mako/async.cpp
|
|
|
|
test/mako/blob_granules.hpp
|
|
|
|
test/mako/blob_granules.cpp
|
|
|
|
test/mako/future.hpp
|
2022-04-25 19:53:05 +08:00
|
|
|
test/mako/limit.hpp
|
2022-04-02 00:25:43 +08:00
|
|
|
test/mako/logger.hpp
|
2022-03-02 22:04:30 +08:00
|
|
|
test/mako/mako.cpp
|
|
|
|
test/mako/mako.hpp
|
2022-04-02 00:25:43 +08:00
|
|
|
test/mako/operations.hpp
|
|
|
|
test/mako/operations.cpp
|
|
|
|
test/mako/process.hpp
|
|
|
|
test/mako/shm.hpp
|
|
|
|
test/mako/stats.hpp
|
|
|
|
test/mako/time.hpp
|
2022-03-02 22:04:30 +08:00
|
|
|
test/mako/utils.cpp
|
|
|
|
test/mako/utils.hpp)
|
2020-10-01 08:38:58 +08:00
|
|
|
add_subdirectory(test/unit/third_party)
|
2020-10-03 13:01:57 +08:00
|
|
|
find_package(Threads REQUIRED)
|
2020-10-01 08:38:58 +08:00
|
|
|
set(UNIT_TEST_SRCS
|
|
|
|
test/unit/unit_tests.cpp
|
|
|
|
test/unit/fdb_api.cpp
|
|
|
|
test/unit/fdb_api.hpp)
|
2019-06-07 07:58:11 +08:00
|
|
|
|
2021-06-05 11:19:19 +08:00
|
|
|
set(UNIT_TEST_VERSION_510_SRCS test/unit/unit_tests_version_510.cpp)
|
2021-08-03 10:29:56 +08:00
|
|
|
set(TRACE_PARTIAL_FILE_SUFFIX_TEST_SRCS test/unit/trace_partial_file_suffix_test.cpp)
|
2022-02-18 18:31:16 +08:00
|
|
|
set(DISCONNECTED_TIMEOUT_UNIT_TEST_SRCS
|
2021-09-29 12:59:43 +08:00
|
|
|
test/unit/disconnected_timeout_tests.cpp
|
|
|
|
test/unit/fdb_api.cpp
|
|
|
|
test/unit/fdb_api.hpp)
|
2021-06-05 11:19:19 +08:00
|
|
|
|
2022-07-11 23:57:28 +08:00
|
|
|
add_library(fdb_cpp INTERFACE test/fdb_api.hpp)
|
|
|
|
target_sources(fdb_cpp INTERFACE )
|
2022-03-02 22:12:36 +08:00
|
|
|
target_include_directories(fdb_cpp INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/test)
|
|
|
|
target_link_libraries(fdb_cpp INTERFACE fmt::fmt)
|
2022-04-14 01:53:44 +08:00
|
|
|
|
2022-02-25 18:22:33 +08:00
|
|
|
set(API_TESTER_SRCS
|
|
|
|
test/apitester/fdb_c_api_tester.cpp
|
2022-07-01 00:47:16 +08:00
|
|
|
test/apitester/TesterAtomicOpsCorrectnessWorkload.cpp
|
2022-03-11 02:06:56 +08:00
|
|
|
test/apitester/TesterApiWorkload.cpp
|
|
|
|
test/apitester/TesterApiWorkload.h
|
2022-03-03 05:51:56 +08:00
|
|
|
test/apitester/TesterTestSpec.cpp
|
|
|
|
test/apitester/TesterTestSpec.h
|
2022-04-20 23:03:28 +08:00
|
|
|
test/apitester/TesterBlobGranuleCorrectnessWorkload.cpp
|
2022-03-11 02:06:56 +08:00
|
|
|
test/apitester/TesterCancelTransactionWorkload.cpp
|
2022-02-25 18:22:33 +08:00
|
|
|
test/apitester/TesterCorrectnessWorkload.cpp
|
2022-02-26 07:07:17 +08:00
|
|
|
test/apitester/TesterKeyValueStore.cpp
|
|
|
|
test/apitester/TesterKeyValueStore.h
|
2022-02-25 18:22:33 +08:00
|
|
|
test/apitester/TesterOptions.h
|
|
|
|
test/apitester/TesterScheduler.cpp
|
|
|
|
test/apitester/TesterScheduler.h
|
|
|
|
test/apitester/TesterTransactionExecutor.cpp
|
|
|
|
test/apitester/TesterTransactionExecutor.h
|
2022-02-28 22:53:29 +08:00
|
|
|
test/apitester/TesterUtil.cpp
|
|
|
|
test/apitester/TesterUtil.h
|
2022-07-08 17:57:38 +08:00
|
|
|
test/apitester/TesterWatchAndWaitWorkload.cpp
|
2022-02-25 18:22:33 +08:00
|
|
|
test/apitester/TesterWorkload.cpp
|
|
|
|
test/apitester/TesterWorkload.h
|
2022-02-18 18:31:16 +08:00
|
|
|
)
|
|
|
|
|
2022-07-08 22:28:35 +08:00
|
|
|
add_library(fdb_c_unit_tests_impl OBJECT ${UNIT_TEST_SRCS})
|
|
|
|
add_library(fdb_c_api_tester_impl OBJECT ${API_TESTER_SRCS})
|
|
|
|
|
2019-02-18 11:29:33 +08:00
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
add_library(fdb_c_performance_test OBJECT test/performance_test.c test/test.h)
|
|
|
|
add_library(fdb_c_ryw_benchmark OBJECT test/ryw_benchmark.c test/test.h)
|
2019-06-29 01:15:37 +08:00
|
|
|
add_library(fdb_c_txn_size_test OBJECT test/txn_size_test.c test/test.h)
|
2022-03-30 03:02:56 +08:00
|
|
|
add_library(fdb_c_client_memory_test OBJECT test/client_memory_test.cpp test/unit/fdb_api.cpp test/unit/fdb_api.hpp)
|
2019-06-07 07:58:11 +08:00
|
|
|
add_library(mako OBJECT ${MAKO_SRCS})
|
2020-10-01 08:38:58 +08:00
|
|
|
add_library(fdb_c_setup_tests OBJECT test/unit/setup_tests.cpp)
|
2021-06-05 11:19:19 +08:00
|
|
|
add_library(fdb_c_unit_tests_version_510 OBJECT ${UNIT_TEST_VERSION_510_SRCS})
|
2021-08-03 10:29:56 +08:00
|
|
|
add_library(trace_partial_file_suffix_test OBJECT ${TRACE_PARTIAL_FILE_SUFFIX_TEST_SRCS})
|
2021-09-29 12:59:43 +08:00
|
|
|
add_library(disconnected_timeout_unit_tests OBJECT ${DISCONNECTED_TIMEOUT_UNIT_TEST_SRCS})
|
2019-02-18 11:29:33 +08:00
|
|
|
else()
|
|
|
|
add_executable(fdb_c_performance_test test/performance_test.c test/test.h)
|
|
|
|
add_executable(fdb_c_ryw_benchmark test/ryw_benchmark.c test/test.h)
|
2019-06-29 01:15:37 +08:00
|
|
|
add_executable(fdb_c_txn_size_test test/txn_size_test.c test/test.h)
|
2022-03-23 04:44:59 +08:00
|
|
|
add_executable(fdb_c_client_memory_test test/client_memory_test.cpp test/unit/fdb_api.cpp test/unit/fdb_api.hpp)
|
2019-06-07 07:58:11 +08:00
|
|
|
add_executable(mako ${MAKO_SRCS})
|
2020-10-01 08:38:58 +08:00
|
|
|
add_executable(fdb_c_setup_tests test/unit/setup_tests.cpp)
|
2022-07-08 22:28:35 +08:00
|
|
|
add_executable(fdb_c_unit_tests)
|
|
|
|
target_link_libraries(fdb_c_unit_tests PRIVATE fdb_c fdb_c_unit_tests_impl)
|
2021-06-05 11:19:19 +08:00
|
|
|
add_executable(fdb_c_unit_tests_version_510 ${UNIT_TEST_VERSION_510_SRCS})
|
2021-08-03 10:29:56 +08:00
|
|
|
add_executable(trace_partial_file_suffix_test ${TRACE_PARTIAL_FILE_SUFFIX_TEST_SRCS})
|
2021-09-29 12:59:43 +08:00
|
|
|
add_executable(disconnected_timeout_unit_tests ${DISCONNECTED_TIMEOUT_UNIT_TEST_SRCS})
|
2022-07-08 22:28:35 +08:00
|
|
|
add_executable(fdb_c_api_tester)
|
|
|
|
target_link_libraries(fdb_c_api_tester PRIVATE fdb_c fdb_c_api_tester_impl)
|
2019-03-21 11:27:10 +08:00
|
|
|
strip_debug_symbols(fdb_c_performance_test)
|
|
|
|
strip_debug_symbols(fdb_c_ryw_benchmark)
|
2019-06-29 01:15:37 +08:00
|
|
|
strip_debug_symbols(fdb_c_txn_size_test)
|
2022-03-23 04:44:59 +08:00
|
|
|
strip_debug_symbols(fdb_c_client_memory_test)
|
2019-02-18 11:29:33 +08:00
|
|
|
endif()
|
2022-07-08 22:28:35 +08:00
|
|
|
|
2022-03-02 10:08:50 +08:00
|
|
|
target_link_libraries(fdb_c_performance_test PRIVATE fdb_c Threads::Threads)
|
|
|
|
target_link_libraries(fdb_c_ryw_benchmark PRIVATE fdb_c Threads::Threads)
|
|
|
|
target_link_libraries(fdb_c_txn_size_test PRIVATE fdb_c Threads::Threads)
|
2022-03-23 04:44:59 +08:00
|
|
|
target_link_libraries(fdb_c_client_memory_test PRIVATE fdb_c Threads::Threads)
|
2020-10-01 08:38:58 +08:00
|
|
|
|
2022-07-08 22:28:35 +08:00
|
|
|
target_include_directories(fdb_c_api_tester_impl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/ ${CMAKE_SOURCE_DIR}/flow/include ${CMAKE_BINARY_DIR}/flow/include)
|
|
|
|
if(USE_SANITIZER)
|
|
|
|
target_link_libraries(fdb_c_api_tester_impl PRIVATE fdb_cpp toml11_target Threads::Threads fmt::fmt boost_asan)
|
|
|
|
else()
|
|
|
|
target_link_libraries(fdb_c_api_tester_impl PRIVATE fdb_cpp toml11_target Threads::Threads fmt::fmt boost_target)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(fdb_c_api_tester_impl PRIVATE SimpleOpt)
|
|
|
|
|
2022-07-11 23:57:28 +08:00
|
|
|
target_include_directories(fdb_c_unit_tests_impl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/)
|
|
|
|
target_include_directories(fdb_c_unit_tests_version_510 PUBLIC ${CMAKE_BINARY_DIR}/flow/include)
|
|
|
|
target_link_libraries(fdb_c_setup_tests PRIVATE fdb_c Threads::Threads doctest)
|
|
|
|
target_link_libraries(fdb_c_unit_tests_impl PRIVATE fdb_c Threads::Threads fdbclient rapidjson doctest)
|
|
|
|
target_link_libraries(fdb_c_unit_tests_version_510 PRIVATE fdb_c Threads::Threads doctest)
|
|
|
|
target_link_libraries(trace_partial_file_suffix_test PRIVATE fdb_c Threads::Threads flow doctest)
|
|
|
|
target_link_libraries(disconnected_timeout_unit_tests PRIVATE fdb_c Threads::Threads doctest)
|
2020-10-01 08:38:58 +08:00
|
|
|
|
2019-06-07 05:53:26 +08:00
|
|
|
# do not set RPATH for mako
|
|
|
|
set_property(TARGET mako PROPERTY SKIP_BUILD_RPATH TRUE)
|
2022-03-22 05:34:10 +08:00
|
|
|
if (USE_SANITIZER)
|
2022-06-24 10:52:13 +08:00
|
|
|
target_link_libraries(mako PRIVATE fdb_c fdbclient fmt::fmt Threads::Threads fdb_cpp boost_asan rapidjson)
|
2022-03-22 05:34:10 +08:00
|
|
|
else()
|
2022-06-24 10:52:13 +08:00
|
|
|
target_link_libraries(mako PRIVATE fdb_c fdbclient fmt::fmt Threads::Threads fdb_cpp boost_target rapidjson)
|
2022-03-22 05:34:10 +08:00
|
|
|
endif()
|
2020-10-01 08:38:58 +08:00
|
|
|
|
2021-01-26 08:09:32 +08:00
|
|
|
if(NOT OPEN_FOR_IDE)
|
|
|
|
# Make sure that fdb_c.h is compatible with c90
|
|
|
|
add_executable(fdb_c90_test test/fdb_c90_test.c)
|
|
|
|
set_property(TARGET fdb_c90_test PROPERTY C_STANDARD 90)
|
|
|
|
target_compile_options(fdb_c90_test PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
|
|
target_link_libraries(fdb_c90_test PRIVATE fdb_c)
|
|
|
|
endif()
|
2020-12-23 02:30:07 +08:00
|
|
|
|
2021-08-24 07:25:19 +08:00
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
set(FDB_C_TARGET $<TARGET_OBJECTS:fdb_c>)
|
|
|
|
else()
|
|
|
|
set(FDB_C_TARGET $<TARGET_FILE:fdb_c>)
|
|
|
|
endif()
|
2022-01-08 09:04:16 +08:00
|
|
|
add_custom_command(
|
2022-01-11 07:53:13 +08:00
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${FDB_C_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so
|
2021-02-05 11:37:52 +08:00
|
|
|
DEPENDS fdb_c
|
2021-02-05 09:24:45 +08:00
|
|
|
COMMENT "Copy libfdb_c to use as external client for test")
|
2022-01-11 07:53:13 +08:00
|
|
|
add_custom_target(external_client DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so)
|
2022-07-08 22:28:35 +08:00
|
|
|
add_dependencies(fdb_c_unit_tests_impl external_client)
|
2021-09-30 04:30:48 +08:00
|
|
|
add_dependencies(disconnected_timeout_unit_tests external_client)
|
2022-07-08 22:28:35 +08:00
|
|
|
add_dependencies(fdb_c_api_tester_impl external_client)
|
2021-02-05 09:24:45 +08:00
|
|
|
|
2020-10-01 08:38:58 +08:00
|
|
|
add_fdbclient_test(
|
|
|
|
NAME fdb_c_setup_tests
|
|
|
|
COMMAND $<TARGET_FILE:fdb_c_setup_tests>)
|
|
|
|
add_fdbclient_test(
|
|
|
|
NAME fdb_c_unit_tests
|
|
|
|
COMMAND $<TARGET_FILE:fdb_c_unit_tests>
|
|
|
|
@CLUSTER_FILE@
|
|
|
|
fdb)
|
2021-06-05 11:19:19 +08:00
|
|
|
add_fdbclient_test(
|
|
|
|
NAME fdb_c_unit_tests_version_510
|
|
|
|
COMMAND $<TARGET_FILE:fdb_c_unit_tests_version_510>
|
|
|
|
@CLUSTER_FILE@
|
|
|
|
fdb)
|
2021-08-03 10:29:56 +08:00
|
|
|
add_fdbclient_test(
|
|
|
|
NAME trace_partial_file_suffix_test
|
|
|
|
COMMAND $<TARGET_FILE:trace_partial_file_suffix_test>
|
|
|
|
@CLUSTER_FILE@
|
|
|
|
fdb)
|
2021-02-05 09:24:45 +08:00
|
|
|
add_fdbclient_test(
|
|
|
|
NAME fdb_c_external_client_unit_tests
|
|
|
|
COMMAND $<TARGET_FILE:fdb_c_unit_tests>
|
|
|
|
@CLUSTER_FILE@
|
|
|
|
fdb
|
2022-01-11 07:53:13 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so
|
2021-02-05 09:24:45 +08:00
|
|
|
)
|
2021-09-29 12:59:43 +08:00
|
|
|
add_unavailable_fdbclient_test(
|
|
|
|
NAME disconnected_timeout_unit_tests
|
|
|
|
COMMAND $<TARGET_FILE:disconnected_timeout_unit_tests>
|
|
|
|
@CLUSTER_FILE@
|
2021-09-29 23:13:34 +08:00
|
|
|
)
|
|
|
|
add_unavailable_fdbclient_test(
|
|
|
|
NAME disconnected_timeout_external_client_unit_tests
|
|
|
|
COMMAND $<TARGET_FILE:disconnected_timeout_unit_tests>
|
|
|
|
@CLUSTER_FILE@
|
2022-01-11 07:53:13 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so
|
2021-09-29 12:59:43 +08:00
|
|
|
)
|
2022-03-03 05:51:56 +08:00
|
|
|
add_fdbclient_test(
|
|
|
|
NAME fdb_c_api_tests
|
2022-03-04 23:22:49 +08:00
|
|
|
DISABLE_LOG_DUMP
|
2022-03-03 05:51:56 +08:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/run_c_api_tests.py
|
|
|
|
--cluster-file
|
|
|
|
@CLUSTER_FILE@
|
|
|
|
--tester-binary
|
|
|
|
$<TARGET_FILE:fdb_c_api_tester>
|
|
|
|
--external-client-library
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so
|
|
|
|
--test-dir
|
|
|
|
${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests
|
2022-04-22 17:57:29 +08:00
|
|
|
--tmp-dir
|
|
|
|
@TMP_DIR@
|
2022-04-26 19:54:33 +08:00
|
|
|
--log-dir
|
|
|
|
@LOG_DIR@
|
2022-03-03 05:51:56 +08:00
|
|
|
)
|
2022-03-23 03:30:06 +08:00
|
|
|
|
2022-04-18 23:52:02 +08:00
|
|
|
add_fdbclient_test(
|
2022-04-21 03:34:19 +08:00
|
|
|
NAME fdb_c_api_tests_blob_granule
|
2022-04-18 23:52:02 +08:00
|
|
|
DISABLE_LOG_DUMP
|
2022-04-21 03:34:19 +08:00
|
|
|
API_TEST_BLOB_GRANULES_ENABLED
|
2022-03-03 05:51:56 +08:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/run_c_api_tests.py
|
|
|
|
--cluster-file
|
|
|
|
@CLUSTER_FILE@
|
|
|
|
--tester-binary
|
|
|
|
$<TARGET_FILE:fdb_c_api_tester>
|
|
|
|
--external-client-library
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so
|
|
|
|
--test-dir
|
2022-04-21 03:34:19 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/blobgranuletests
|
|
|
|
--blob-granule-local-file-path
|
2022-04-20 23:03:28 +08:00
|
|
|
@DATA_DIR@/fdbblob/
|
2022-04-26 19:54:33 +08:00
|
|
|
--tmp-dir
|
|
|
|
@TMP_DIR@
|
|
|
|
--log-dir
|
|
|
|
@LOG_DIR@
|
2022-03-03 05:51:56 +08:00
|
|
|
)
|
2022-03-23 03:30:06 +08:00
|
|
|
|
2022-05-23 18:47:51 +08:00
|
|
|
add_fdbclient_test(
|
|
|
|
NAME fdb_c_api_tests_with_tls
|
|
|
|
DISABLE_LOG_DUMP
|
|
|
|
TLS_ENABLED
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/run_c_api_tests.py
|
|
|
|
--cluster-file
|
|
|
|
@CLUSTER_FILE@
|
|
|
|
--tester-binary
|
|
|
|
$<TARGET_FILE:fdb_c_api_tester>
|
|
|
|
--external-client-library
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/libfdb_c_external.so
|
|
|
|
--test-dir
|
|
|
|
${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests
|
|
|
|
--tmp-dir
|
|
|
|
@TMP_DIR@
|
|
|
|
--log-dir
|
|
|
|
@LOG_DIR@
|
|
|
|
--tls-cert-file
|
|
|
|
@CLIENT_CERT_FILE@
|
|
|
|
--tls-key-file
|
|
|
|
@CLIENT_KEY_FILE@
|
|
|
|
--tls-ca-file
|
|
|
|
@SERVER_CA_FILE@
|
|
|
|
)
|
|
|
|
|
2022-04-16 07:09:33 +08:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT USE_SANITIZER)
|
2022-04-19 17:53:33 +08:00
|
|
|
add_test(NAME fdb_c_upgrade_single_threaded_630api
|
2022-03-23 03:30:06 +08:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
2022-03-25 00:23:17 +08:00
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadSingleThr.toml
|
2022-06-23 15:22:09 +08:00
|
|
|
--upgrade-path "6.3.23" "7.0.0" "7.1.9" "7.2.0"
|
2022-03-25 00:23:17 +08:00
|
|
|
--process-number 1
|
2022-04-16 07:09:33 +08:00
|
|
|
)
|
2022-03-25 00:23:17 +08:00
|
|
|
|
2022-04-19 17:53:33 +08:00
|
|
|
add_test(NAME fdb_c_upgrade_single_threaded_700api
|
2022-04-16 07:09:33 +08:00
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
2022-04-19 17:53:33 +08:00
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadSingleThr.toml
|
2022-06-23 15:22:09 +08:00
|
|
|
--upgrade-path "7.0.0" "7.1.9" "7.2.0"
|
2022-04-19 17:53:33 +08:00
|
|
|
--process-number 1
|
|
|
|
)
|
|
|
|
|
|
|
|
add_test(NAME fdb_c_upgrade_multi_threaded_630api
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
2022-04-16 07:09:33 +08:00
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadMultiThr.toml
|
2022-06-23 15:22:09 +08:00
|
|
|
--upgrade-path "6.3.23" "7.0.0" "7.1.9" "7.2.0" "7.1.9"
|
2022-04-16 07:09:33 +08:00
|
|
|
--process-number 3
|
2022-04-19 17:53:33 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_test(NAME fdb_c_upgrade_multi_threaded_700api
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadMultiThr.toml
|
2022-06-23 15:22:09 +08:00
|
|
|
--upgrade-path "7.0.0" "7.1.9" "7.2.0" "7.1.9"
|
2022-04-19 17:53:33 +08:00
|
|
|
--process-number 3
|
|
|
|
)
|
2022-04-29 22:37:59 +08:00
|
|
|
|
2022-05-12 21:34:03 +08:00
|
|
|
add_test(NAME fdb_c_upgrade_multi_threaded_710api
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadMultiThr.toml
|
2022-06-23 15:22:09 +08:00
|
|
|
--upgrade-path "7.1.9" "7.2.0" "7.1.9"
|
2022-05-12 21:34:03 +08:00
|
|
|
--process-number 3
|
|
|
|
)
|
|
|
|
|
2022-04-29 22:37:59 +08:00
|
|
|
add_test(NAME fdb_c_cluster_wiggle
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadMultiThr.toml
|
|
|
|
--upgrade-path "7.2.0" "wiggle"
|
|
|
|
--disable-log-dump
|
|
|
|
--process-number 3
|
|
|
|
--redundancy double
|
|
|
|
)
|
|
|
|
|
2022-06-23 15:22:09 +08:00
|
|
|
add_test(NAME fdb_c_wiggle_and_upgrade_latest
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadMultiThr.toml
|
|
|
|
--upgrade-path "7.1.9" "wiggle" "7.2.0"
|
|
|
|
--disable-log-dump
|
|
|
|
--process-number 3
|
|
|
|
--redundancy double
|
|
|
|
)
|
|
|
|
|
|
|
|
add_test(NAME fdb_c_wiggle_and_upgrade_63
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/tests/TestRunner/upgrade_test.py
|
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
|
|
|
--test-file ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests/upgrade/MixedApiWorkloadMultiThr.toml
|
|
|
|
--upgrade-path "6.3.24" "wiggle" "7.0.0"
|
|
|
|
--disable-log-dump
|
|
|
|
--process-number 3
|
|
|
|
--redundancy double
|
|
|
|
)
|
2022-04-29 22:37:59 +08:00
|
|
|
|
2022-04-16 07:09:33 +08:00
|
|
|
endif()
|
2022-04-08 01:32:57 +08:00
|
|
|
|
2019-02-11 13:29:03 +08:00
|
|
|
endif()
|
2019-02-10 07:13:25 +08:00
|
|
|
|
2019-06-06 04:24:06 +08:00
|
|
|
set(c_workloads_srcs
|
|
|
|
test/workloads/workloads.cpp
|
2019-06-08 05:57:56 +08:00
|
|
|
test/workloads/workloads.h
|
|
|
|
test/workloads/SimpleWorkload.cpp)
|
2019-06-06 04:24:06 +08:00
|
|
|
|
|
|
|
if(OPEN_FOR_IDE)
|
|
|
|
add_library(c_workloads OBJECT ${c_workloads_srcs})
|
|
|
|
else()
|
|
|
|
add_library(c_workloads SHARED ${c_workloads_srcs})
|
|
|
|
endif()
|
|
|
|
set_target_properties(c_workloads PROPERTIES
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/share/foundationdb")
|
2019-06-08 05:57:56 +08:00
|
|
|
target_link_libraries(c_workloads PUBLIC fdb_c)
|
2019-06-06 04:24:06 +08:00
|
|
|
|
2021-06-06 05:05:29 +08:00
|
|
|
if (NOT WIN32 AND NOT APPLE AND NOT OPEN_FOR_IDE)
|
|
|
|
target_link_options(c_workloads PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/external_workload.map,-z,nodelete")
|
|
|
|
endif()
|
|
|
|
|
2022-07-08 22:28:35 +08:00
|
|
|
# Generate shim library in Linux builds
|
2022-07-11 23:57:28 +08:00
|
|
|
if (OPEN_FOR_IDE)
|
|
|
|
|
|
|
|
add_library(fdb_c_shim OBJECT fdb_c_shim.cpp)
|
|
|
|
target_link_libraries(fdb_c_shim PUBLIC dl)
|
|
|
|
|
|
|
|
elseif(NOT WIN32 AND NOT APPLE AND NOT OPEN_FOR_IDE) # Linux Only
|
2022-07-08 22:28:35 +08:00
|
|
|
|
|
|
|
set(SHIM_LIB_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
set(SHIM_LIB_GEN_SRC
|
|
|
|
${SHIM_LIB_OUTPUT_DIR}/libfdb_c.so.init.c
|
|
|
|
${SHIM_LIB_OUTPUT_DIR}/libfdb_c.so.tramp.S)
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${SHIM_LIB_GEN_SRC}
|
|
|
|
COMMAND $<TARGET_FILE:Python::Interpreter> ${CMAKE_SOURCE_DIR}/contrib/Implib.so/implib-gen.py
|
|
|
|
--target ${CMAKE_SYSTEM_PROCESSOR}
|
|
|
|
--outdir ${SHIM_LIB_OUTPUT_DIR}
|
|
|
|
--dlopen-callback=fdb_shim_dlopen_callback
|
|
|
|
$<TARGET_FILE:fdb_c>)
|
|
|
|
|
|
|
|
add_library(fdb_c_shim SHARED ${SHIM_LIB_GEN_SRC} fdb_c_shim.cpp)
|
|
|
|
target_link_options(fdb_c_shim PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/fdb_c.map,-z,nodelete,-z,noexecstack")
|
|
|
|
target_link_libraries(fdb_c_shim PUBLIC dl)
|
|
|
|
|
|
|
|
add_executable(fdb_c_shim_unit_tests)
|
|
|
|
target_link_libraries(fdb_c_shim_unit_tests PRIVATE fdb_c_shim fdb_c_unit_tests_impl)
|
|
|
|
|
|
|
|
add_executable(fdb_c_shim_api_tester)
|
|
|
|
target_link_libraries(fdb_c_shim_api_tester PRIVATE fdb_c_shim fdb_c_api_tester_impl)
|
|
|
|
|
|
|
|
add_test(NAME fdb_c_shim_library_tests
|
|
|
|
COMMAND $<TARGET_FILE:Python::Interpreter> ${CMAKE_CURRENT_SOURCE_DIR}/test/fdb_c_shim_tests.py
|
|
|
|
--build-dir ${CMAKE_BINARY_DIR}
|
2022-07-15 00:34:48 +08:00
|
|
|
--unit-tests-bin $<TARGET_FILE:fdb_c_shim_unit_tests>
|
|
|
|
--api-tester-bin $<TARGET_FILE:fdb_c_shim_api_tester>
|
|
|
|
--api-test-dir ${CMAKE_SOURCE_DIR}/bindings/c/test/apitester/tests
|
2022-07-08 22:28:35 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
endif() # End Linux only
|
|
|
|
|
2019-02-28 12:17:11 +08:00
|
|
|
# TODO: re-enable once the old vcxproj-based build system is removed.
|
|
|
|
#generate_export_header(fdb_c EXPORT_MACRO_NAME "DLLEXPORT"
|
|
|
|
# EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_export.h)
|
2019-05-24 03:39:27 +08:00
|
|
|
|
|
|
|
set(targets_export_name "FoundationDB-Client")
|
|
|
|
set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
|
|
|
set(version_config "${generated_dir}/${targets_export_name}ConfigVersion.cmake")
|
|
|
|
set(project_config "${generated_dir}/${targets_export_name}Config.cmake")
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
"${version_config}" VERSION ${GENERIC_LIB_VERSION} COMPATIBILITY AnyNewerVersion
|
|
|
|
)
|
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in" "${project_config}" @ONLY)
|
|
|
|
|
2019-05-24 02:15:39 +08:00
|
|
|
fdb_install(
|
|
|
|
TARGETS fdb_c
|
2019-05-24 03:39:27 +08:00
|
|
|
EXPORT ${targets_export_name}
|
2019-02-28 12:17:11 +08:00
|
|
|
DESTINATION lib
|
|
|
|
COMPONENT clients)
|
|
|
|
fdb_install(
|
|
|
|
FILES foundationdb/fdb_c.h
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_options.g.h
|
|
|
|
${CMAKE_SOURCE_DIR}/fdbclient/vexillographer/fdb.options
|
2022-04-20 19:06:28 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/bindings/c/foundationdb/fdb_c_types.h
|
2019-05-24 01:43:15 +08:00
|
|
|
DESTINATION include
|
|
|
|
DESTINATION_SUFFIX /foundationdb
|
|
|
|
COMPONENT clients)
|
2019-05-24 02:46:31 +08:00
|
|
|
fdb_install(
|
2019-05-24 03:39:27 +08:00
|
|
|
FILES "${project_config}" "${version_config}"
|
|
|
|
DESTINATION lib
|
|
|
|
DESTINATION_SUFFIX "/cmake/${targets_export_name}"
|
|
|
|
COMPONENT clients)
|
2019-05-24 05:13:07 +08:00
|
|
|
fdb_configure_and_install(
|
|
|
|
FILE "${PROJECT_SOURCE_DIR}/cmake/foundationdb-client.pc.in"
|
|
|
|
DESTINATION lib
|
|
|
|
DESTINATION_SUFFIX "/pkgconfig"
|
|
|
|
COMPONENT clients)
|
2019-05-24 03:39:27 +08:00
|
|
|
fdb_install(
|
|
|
|
EXPORT ${targets_export_name}
|
2019-05-24 02:46:31 +08:00
|
|
|
DESTINATION lib
|
2019-05-24 03:39:27 +08:00
|
|
|
DESTINATION_SUFFIX "/cmake/${targets_export_name}"
|
2019-05-24 02:46:31 +08:00
|
|
|
COMPONENT clients)
|