From d35445a868f089484a7109678ed953d98836c551 Mon Sep 17 00:00:00 2001 From: Markus Pilman <markus.pilman@snowflake.com> Date: Thu, 23 Jun 2022 14:37:35 -0600 Subject: [PATCH] enforce include modularization in cmake --- CMakeLists.txt | 7 +- bindings/flow/fdb_flow.actor.cpp | 2 +- cmake/ConfigureCompiler.cmake | 3 - cmake/FlowCommands.cmake | 104 +++++++++++++++--- cmake/utils.cmake | 31 ++++++ documentation/tutorial/tutorial.actor.cpp | 2 +- fdbbackup/backup.actor.cpp | 2 +- fdbcli/AdvanceVersionCommand.actor.cpp | 2 +- fdbcli/ChangeFeedCommand.actor.cpp | 2 +- fdbcli/MaintenanceCommand.actor.cpp | 2 +- fdbcli/SetClassCommand.actor.cpp | 2 +- fdbcli/fdbcli.actor.cpp | 2 +- fdbclient/BackupContainer.actor.cpp | 2 +- fdbclient/BackupContainerFileSystem.h | 2 +- fdbclient/BlobGranuleFiles.cpp | 2 +- fdbclient/BlobGranuleReader.actor.cpp | 2 +- fdbclient/CMakeLists.txt | 4 + fdbclient/FileBackupAgent.actor.cpp | 2 +- fdbclient/ManagementAPI.actor.cpp | 2 +- fdbclient/NativeAPI.actor.cpp | 2 +- fdbclient/TagThrottle.actor.h | 2 +- fdbmonitor/CMakeLists.txt | 1 + fdbrpc/CMakeLists.txt | 3 + fdbrpc/sim2.actor.cpp | 2 +- fdbserver/BlobGranuleServerCommon.actor.cpp | 2 +- fdbserver/BlobManager.actor.cpp | 2 +- fdbserver/BlobWorker.actor.cpp | 2 +- fdbserver/KeyValueStoreSQLite.actor.cpp | 2 +- fdbserver/SimKmsConnector.actor.cpp | 2 +- fdbserver/Status.actor.cpp | 2 +- fdbserver/VersionedBTree.actor.cpp | 2 +- fdbserver/networktest.actor.cpp | 2 +- fdbserver/storageserver.actor.cpp | 2 +- fdbserver/workloads/ApiWorkload.actor.cpp | 2 +- .../workloads/AsyncFileCorrectness.actor.cpp | 2 +- .../BlobGranuleCorrectnessWorkload.actor.cpp | 2 +- .../workloads/BlobGranuleVerifier.actor.cpp | 2 +- .../workloads/DiskDurabilityTest.actor.cpp | 2 +- fdbserver/workloads/KVStoreTest.actor.cpp | 2 +- .../MutationLogReaderCorrectness.actor.cpp | 2 +- .../workloads/SlowTaskWorkload.actor.cpp | 2 +- flow/CMakeLists.txt | 15 ++- flow/DeterministicRandom.cpp | 2 +- flow/IndexedSet.cpp | 2 +- flow/Platform.actor.cpp | 2 +- flow/Platform.h | 2 +- 46 files changed, 179 insertions(+), 65 deletions(-) create mode 100644 cmake/utils.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 39cee60b9c..0d246adfa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,15 +105,12 @@ set(FDB_PACKAGE_NAME "${FDB_MAJOR}.${FDB_MINOR}") configure_file(${CMAKE_SOURCE_DIR}/versions.target.cmake ${CMAKE_CURRENT_BINARY_DIR}/versions.target) file(WRITE ${CMAKE_BINARY_DIR}/version.txt ${FDB_VERSION}) -message(STATUS "FDB version is ${FDB_VERSION}") -message(STATUS "FDB package name is ${FDB_PACKAGE_NAME}") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fdbclient/versions.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/fdbclient/versions.h) - - ################################################################################ # Flow ################################################################################ +include(utils) + # Flow and other tools are written in C# - so we need that dependency include(EnableCsharp) diff --git a/bindings/flow/fdb_flow.actor.cpp b/bindings/flow/fdb_flow.actor.cpp index fb92a629d4..72ee49dcf4 100644 --- a/bindings/flow/fdb_flow.actor.cpp +++ b/bindings/flow/fdb_flow.actor.cpp @@ -24,7 +24,7 @@ #include <stdio.h> #include <cinttypes> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/DeterministicRandom.h" #include "flow/SystemMonitor.h" #include "flow/TLSConfig.actor.h" diff --git a/cmake/ConfigureCompiler.cmake b/cmake/ConfigureCompiler.cmake index ab214a7f51..f0fc57ff89 100644 --- a/cmake/ConfigureCompiler.cmake +++ b/cmake/ConfigureCompiler.cmake @@ -64,9 +64,6 @@ add_compile_definitions(BOOST_ERROR_CODE_HEADER_ONLY BOOST_SYSTEM_NO_DEPRECATED) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -include_directories(${CMAKE_SOURCE_DIR}) -include_directories(${CMAKE_BINARY_DIR}) - if(WIN32) add_definitions(-DBOOST_USE_WINDOWS_H) add_definitions(-DWIN32_LEAN_AND_MEAN) diff --git a/cmake/FlowCommands.cmake b/cmake/FlowCommands.cmake index 01616cd183..4c6becd4dd 100644 --- a/cmake/FlowCommands.cmake +++ b/cmake/FlowCommands.cmake @@ -147,6 +147,42 @@ function(strip_debug_symbols target) add_dependencies(strip_targets strip_${target}) endfunction() +function(copy_headers) + set(options) + set(oneValueArgs NAME OUT_DIR INC_DIR) + set(multiValueArgs SRCS) + cmake_parse_arguments(CP "${options}" "${oneValueArgs}" "${multiValueArgs}" "${ARGN}") + get_filename_component(dir_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) + set(include_dir "${CMAKE_CURRENT_BINARY_DIR}/include") + set(incl_dir "${include_dir}/${dir_name}") + make_directory("${incl_dir}") + foreach(f IN LISTS CP_SRCS) + is_prefix(bd "${CMAKE_CURRENT_BINARY_DIR}" "${f}") + is_prefix(sd "${CMAKE_CURRENT_SOURCE_DIR}" "${f}") + if (bd OR sd) + continue() + endif() + is_header(hdr "${f}") + if(NOT hdr) + continue() + endif() + get_filename_component(fname ${f} NAME) + get_filename_component(dname ${f} DIRECTORY) + if (dname) + make_directory(${incl_dir}/${dname}) + endif() + set(fpath "${incl_dir}/${dname}/${fname}") + add_custom_command(OUTPUT "${fpath}" + DEPENDS "${f}" + COMMAND "${CMAKE_COMMAND}" -E copy "${f}" "${fpath}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + list(APPEND out_files "${fpath}") + endforeach() + add_custom_target("${CP_NAME}_incl" DEPENDS ${out_files}) + set("${CP_OUT_DIR}" "${incl_dir}" PARENT_SCOPE) + set("${CP_INC_DIR}" ${include_dir} PARENT_SCOPE) +endfunction() + function(add_flow_target) set(options EXECUTABLE STATIC_LIBRARY DYNAMIC_LIBRARY) @@ -159,42 +195,77 @@ function(add_flow_target) if(NOT AFT_SRCS) message(FATAL_ERROR "No sources provided") endif() + copy_headers(NAME ${AFT_NAME} SRCS "${AFT_SRCS};${AFT_DISABLE_ACTOR_DIAGNOSTICS}" OUT_DIR incl_dir INC_DIR include_dir) + #foreach(src IN LISTS AFT_SRCS) + # is_header(h "${src}") + # if(NOT h) + # list(SRCS "${CMAKE_CURRENT_SOURCE_DIR}/${src}") + # endif() + #endforeach() if(OPEN_FOR_IDE) # Intentionally omit ${AFT_DISABLE_ACTOR_DIAGNOSTICS} since we don't want diagnostics set(sources ${AFT_SRCS} ${AFT_ADDL_SRCS}) add_library(${AFT_NAME} OBJECT ${sources}) else() foreach(src IN LISTS AFT_SRCS AFT_DISABLE_ACTOR_DIAGNOSTICS) - set(actor_compiler_flags "") + is_header(hdr ${src}) + set(in_filename "${src}") if(${src} MATCHES ".*\\.actor\\.(h|cpp)") - list(APPEND actors ${src}) - list(APPEND actor_compiler_flags "--generate-probes") + set(is_actor_file YES) if(${src} MATCHES ".*\\.h") - string(REPLACE ".actor.h" ".actor.g.h" generated ${src}) + string(REPLACE ".actor.h" ".actor.g.h" out_filename ${in_filename}) else() - string(REPLACE ".actor.cpp" ".actor.g.cpp" generated ${src}) + string(REPLACE ".actor.cpp" ".actor.g.cpp" out_filename ${in_filename}) endif() + else() + set(is_actor_file NO) + set(out_filename "${src}") + endif() + + if(hdr) + set(in_file "${incl_dir}/${in_filename}") + set(out_file "${incl_dir}/${out_filename}") + else() + set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${in_filename}") + if(is_actor_file) + set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${out_filename}") + else() + set(out_file "${in_file}") + endif() + endif() + + is_prefix(in_src_dir "${CMAKE_CURRENT_SOURCE_DIR}" ${src}) + is_prefix(in_bin_dir "${CMAKE_CURRENT_BINARY_DIR}" ${src}) + is_prefix(in_incl_dir "${incl_dir}" ${src}) + if(in_src_dir OR in_bin_dir) + set(in_file "${src}") + set(out_file "${src}") + endif() + + list(APPEND sources ${out_file}) + set(actor_compiler_flags "") + if(is_actor_file) + list(APPEND actors ${in_file}) + list(APPEND actor_compiler_flags "--generate-probes") foreach(s IN LISTS AFT_DISABLE_ACTOR_DIAGNOSTICS) if("${s}" STREQUAL "${src}") list(APPEND actor_compiler_flags "--disable-diagnostics") break() endif() endforeach() - list(APPEND sources ${generated}) - list(APPEND generated_files ${CMAKE_CURRENT_BINARY_DIR}/${generated}) + + list(APPEND generated_files ${out_file}) if(WIN32) - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${generated}" - COMMAND $<TARGET_FILE:actorcompiler> "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags} - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${src}" ${actor_exe} + add_custom_command(OUTPUT "${out_file}" + COMMAND $<TARGET_FILE:actorcompiler> "${in_file}" "${out_file}" ${actor_compiler_flags} + DEPENDS "${in_file}" ${actor_exe} COMMENT "Compile actor: ${src}") else() - add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${generated}" - COMMAND ${MONO_EXECUTABLE} ${actor_exe} "${CMAKE_CURRENT_SOURCE_DIR}/${src}" "${CMAKE_CURRENT_BINARY_DIR}/${generated}" ${actor_compiler_flags} > /dev/null - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${src}" ${actor_exe} + add_custom_command(OUTPUT "${out_file}" + COMMAND ${MONO_EXECUTABLE} ${actor_exe} "${in_file}" "${out_file}" ${actor_compiler_flags} > /dev/null + DEPENDS "${in_file}" ${actor_exe} COMMENT "Compile actor: ${src}") endif() - else() - list(APPEND sources ${src}) endif() endforeach() if(AFT_EXECUTABLE) @@ -226,8 +297,9 @@ function(add_flow_target) set_property(TARGET ${AFT_NAME} PROPERTY SOURCE_FILES ${AFT_SRCS}) set_property(TARGET ${AFT_NAME} PROPERTY COVERAGE_FILTERS ${AFT_SRCS}) + target_include_directories("${AFT_NAME}" PUBLIC "${include_dir}") add_custom_target(${AFT_NAME}_actors DEPENDS ${generated_files}) - add_dependencies(${AFT_NAME}_actors actorcompiler) + add_dependencies(${AFT_NAME}_actors actorcompiler "${AFT_NAME}_incl") add_dependencies(${AFT_NAME} ${AFT_NAME}_actors) if(NOT WIN32) assert_no_version_h(${AFT_NAME}_actors) diff --git a/cmake/utils.cmake b/cmake/utils.cmake new file mode 100644 index 0000000000..cd45d2ea6c --- /dev/null +++ b/cmake/utils.cmake @@ -0,0 +1,31 @@ +# sets out_var to YES if filename has extension .h or .hpp, NO otherwise +function(is_header out_var filename) + set(res "NO") + get_filename_component(ext "${filename}" LAST_EXT) + if((ext STREQUAL ".h") OR (ext STREQUAL ".hpp")) + set(res "YES") + endif() + set("${out_var}" "${res}" PARENT_SCOPE) +endfunction() + +function(remove_prefix out prefix str) + string(LENGTH "${prefix}" len) + string(SUBSTRING "${str}" ${len} -1 res) + set("${out}" "${res}" PARENT_SCOPE) +endfunction() + +function(is_prefix out prefix str) + string(LENGTH "${prefix}" plen) + string(LENGTH "${str}" slen) + if(plen GREATER slen) + set(res NO) + else() + string(SUBSTRING "${str}" 0 ${plen} pstr) + if(pstr STREQUAL prefix) + set(res YES) + else() + set(res NO) + endif() + endif() + set(${out} ${res} PARENT_SCOPE) +endfunction() diff --git a/documentation/tutorial/tutorial.actor.cpp b/documentation/tutorial/tutorial.actor.cpp index 67c542b632..9d980ff3d6 100644 --- a/documentation/tutorial/tutorial.actor.cpp +++ b/documentation/tutorial/tutorial.actor.cpp @@ -19,7 +19,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/flow.h" #include "flow/Platform.h" #include "flow/DeterministicRandom.h" diff --git a/fdbbackup/backup.actor.cpp b/fdbbackup/backup.actor.cpp index fee0595496..96b6aded34 100644 --- a/fdbbackup/backup.actor.cpp +++ b/fdbbackup/backup.actor.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbbackup/BackupTLSConfig.h" #include "fdbclient/JsonBuilder.h" #include "flow/Arena.h" diff --git a/fdbcli/AdvanceVersionCommand.actor.cpp b/fdbcli/AdvanceVersionCommand.actor.cpp index d76402b88b..223af2d8e5 100644 --- a/fdbcli/AdvanceVersionCommand.actor.cpp +++ b/fdbcli/AdvanceVersionCommand.actor.cpp @@ -19,7 +19,7 @@ */ #include "boost/lexical_cast.hpp" -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbcli/fdbcli.actor.h" #include "fdbclient/IClientApi.h" diff --git a/fdbcli/ChangeFeedCommand.actor.cpp b/fdbcli/ChangeFeedCommand.actor.cpp index 88114d323b..9cee2f590e 100644 --- a/fdbcli/ChangeFeedCommand.actor.cpp +++ b/fdbcli/ChangeFeedCommand.actor.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbcli/fdbcli.actor.h" diff --git a/fdbcli/MaintenanceCommand.actor.cpp b/fdbcli/MaintenanceCommand.actor.cpp index cf466b2c95..487490e09f 100644 --- a/fdbcli/MaintenanceCommand.actor.cpp +++ b/fdbcli/MaintenanceCommand.actor.cpp @@ -21,7 +21,7 @@ #include <cinttypes> #include "boost/lexical_cast.hpp" -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbcli/fdbcli.actor.h" diff --git a/fdbcli/SetClassCommand.actor.cpp b/fdbcli/SetClassCommand.actor.cpp index 27ad221383..cd47e22f86 100644 --- a/fdbcli/SetClassCommand.actor.cpp +++ b/fdbcli/SetClassCommand.actor.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbcli/fdbcli.actor.h" diff --git a/fdbcli/fdbcli.actor.cpp b/fdbcli/fdbcli.actor.cpp index 7360d53c71..c147449463 100644 --- a/fdbcli/fdbcli.actor.cpp +++ b/fdbcli/fdbcli.actor.cpp @@ -19,7 +19,7 @@ */ #include "boost/lexical_cast.hpp" -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/ClusterConnectionFile.h" #include "fdbclient/NativeAPI.actor.h" #include "fdbclient/FDBTypes.h" diff --git a/fdbclient/BackupContainer.actor.cpp b/fdbclient/BackupContainer.actor.cpp index 416d15c548..ebd1ea4a5e 100644 --- a/fdbclient/BackupContainer.actor.cpp +++ b/fdbclient/BackupContainer.actor.cpp @@ -22,7 +22,7 @@ #include <ostream> // FIXME: Trim this down -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/Platform.actor.h" #include "fdbclient/AsyncTaskThread.h" #include "fdbclient/BackupContainer.h" diff --git a/fdbclient/BackupContainerFileSystem.h b/fdbclient/BackupContainerFileSystem.h index 784b113395..17245c9c39 100644 --- a/fdbclient/BackupContainerFileSystem.h +++ b/fdbclient/BackupContainerFileSystem.h @@ -22,7 +22,7 @@ #define FDBCLIENT_BACKUP_CONTAINER_FILESYSTEM_H #pragma once -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/BackupContainer.h" #include "fdbclient/FDBTypes.h" #include "flow/Trace.h" diff --git a/fdbclient/BlobGranuleFiles.cpp b/fdbclient/BlobGranuleFiles.cpp index a2384124b3..d741cc25a7 100644 --- a/fdbclient/BlobGranuleFiles.cpp +++ b/fdbclient/BlobGranuleFiles.cpp @@ -20,7 +20,7 @@ #include <vector> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/serialize.h" #include "fdbclient/BlobGranuleFiles.h" #include "fdbclient/Knobs.h" diff --git a/fdbclient/BlobGranuleReader.actor.cpp b/fdbclient/BlobGranuleReader.actor.cpp index fb86f7983f..e0f627a9da 100644 --- a/fdbclient/BlobGranuleReader.actor.cpp +++ b/fdbclient/BlobGranuleReader.actor.cpp @@ -21,7 +21,7 @@ #include <map> #include <vector> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/AsyncFileS3BlobStore.actor.h" #include "fdbclient/BlobGranuleCommon.h" #include "fdbclient/BlobGranuleFiles.h" diff --git a/fdbclient/CMakeLists.txt b/fdbclient/CMakeLists.txt index ac60f7b4db..e5e0366686 100644 --- a/fdbclient/CMakeLists.txt +++ b/fdbclient/CMakeLists.txt @@ -171,6 +171,9 @@ set(FDBCLIENT_SRCS zipf.c zipf.h) +message(STATUS "FDB version is ${FDB_VERSION}") +message(STATUS "FDB package name is ${FDB_PACKAGE_NAME}") + set(options_srcs ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g.cpp) vexillographer_compile(TARGET fdboptions LANG cpp OUT ${CMAKE_CURRENT_BINARY_DIR}/FDBOptions.g @@ -224,6 +227,7 @@ if(WITH_AWS_BACKUP) endif() add_flow_target(STATIC_LIBRARY NAME fdbclient SRCS ${FDBCLIENT_SRCS} ADDL_SRCS ${options_srcs}) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/versions.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/fdbclient/versions.h) add_dependencies(fdbclient fdboptions) target_link_libraries(fdbclient PUBLIC fdbrpc msgpack) diff --git a/fdbclient/FileBackupAgent.actor.cpp b/fdbclient/FileBackupAgent.actor.cpp index b451747f08..e549a3ee9e 100644 --- a/fdbclient/FileBackupAgent.actor.cpp +++ b/fdbclient/FileBackupAgent.actor.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/BackupAgent.actor.h" #include "fdbclient/BackupContainer.h" #include "fdbclient/DatabaseContext.h" diff --git a/fdbclient/ManagementAPI.actor.cpp b/fdbclient/ManagementAPI.actor.cpp index ec6ca711cb..b5cd8bd4e4 100644 --- a/fdbclient/ManagementAPI.actor.cpp +++ b/fdbclient/ManagementAPI.actor.cpp @@ -22,7 +22,7 @@ #include <string> #include <vector> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/Knobs.h" #include "flow/Arena.h" #include "fdbclient/ClusterConnectionMemoryRecord.h" diff --git a/fdbclient/NativeAPI.actor.cpp b/fdbclient/NativeAPI.actor.cpp index addca09671..1c57c5e41a 100644 --- a/fdbclient/NativeAPI.actor.cpp +++ b/fdbclient/NativeAPI.actor.cpp @@ -31,7 +31,7 @@ #include <vector> #include "boost/algorithm/string.hpp" -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/FDBOptions.g.h" #include "fdbclient/FDBTypes.h" diff --git a/fdbclient/TagThrottle.actor.h b/fdbclient/TagThrottle.actor.h index 127dac79fd..3330abb4d9 100644 --- a/fdbclient/TagThrottle.actor.h +++ b/fdbclient/TagThrottle.actor.h @@ -27,7 +27,7 @@ #pragma once -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/Error.h" #include "flow/flow.h" #include "flow/network.h" diff --git a/fdbmonitor/CMakeLists.txt b/fdbmonitor/CMakeLists.txt index 3787fb22f8..b669d46846 100644 --- a/fdbmonitor/CMakeLists.txt +++ b/fdbmonitor/CMakeLists.txt @@ -1,6 +1,7 @@ set(FDBMONITOR_SRCS fdbmonitor.cpp) add_executable(fdbmonitor ${FDBMONITOR_SRCS}) +target_include_directories(fdbmonitor PUBLIC "${CMAKE_BINARY_DIR}/flow/include" "${CMAKE_BINARY_DIR}/fdbclient/include") strip_debug_symbols(fdbmonitor) assert_no_version_h(fdbmonitor) if(UNIX AND NOT APPLE) diff --git a/fdbrpc/CMakeLists.txt b/fdbrpc/CMakeLists.txt index 0db16bff4e..17f5a15cce 100644 --- a/fdbrpc/CMakeLists.txt +++ b/fdbrpc/CMakeLists.txt @@ -10,6 +10,7 @@ set(FDBRPC_SRCS AsyncFileCached.actor.cpp AsyncFileEncrypted.actor.cpp AsyncFileNonDurable.actor.cpp + AsyncFileWriteChecker.h AsyncFileWriteChecker.cpp Base64UrlDecode.h Base64UrlDecode.cpp @@ -22,6 +23,7 @@ set(FDBRPC_SRCS genericactors.actor.cpp HealthMonitor.actor.cpp HTTP.actor.cpp + IAsyncFile.h IAsyncFile.actor.cpp IPAllowList.cpp LoadBalance.actor.cpp @@ -43,6 +45,7 @@ set(FDBRPC_SRCS SimExternalConnection.h Stats.actor.cpp Stats.h + simulator.h sim2.actor.cpp sim_validation.cpp TimedRequest.h diff --git a/fdbrpc/sim2.actor.cpp b/fdbrpc/sim2.actor.cpp index 699fdc87ff..c2bdee1806 100644 --- a/fdbrpc/sim2.actor.cpp +++ b/fdbrpc/sim2.actor.cpp @@ -22,7 +22,7 @@ #include <memory> #include <string> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbrpc/simulator.h" #include "flow/Arena.h" #define BOOST_SYSTEM_NO_LIB diff --git a/fdbserver/BlobGranuleServerCommon.actor.cpp b/fdbserver/BlobGranuleServerCommon.actor.cpp index 1408c51f11..093e73f46b 100644 --- a/fdbserver/BlobGranuleServerCommon.actor.cpp +++ b/fdbserver/BlobGranuleServerCommon.actor.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/BlobGranuleCommon.h" #include "fdbclient/CommitTransaction.h" #include "fdbclient/FDBTypes.h" diff --git a/fdbserver/BlobManager.actor.cpp b/fdbserver/BlobManager.actor.cpp index bec6ef2e89..65517e3877 100644 --- a/fdbserver/BlobManager.actor.cpp +++ b/fdbserver/BlobManager.actor.cpp @@ -25,7 +25,7 @@ #include <vector> #include <unordered_map> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/BackupContainerFileSystem.h" #include "fdbclient/BlobGranuleCommon.h" #include "fdbclient/BlobWorkerInterface.h" diff --git a/fdbserver/BlobWorker.actor.cpp b/fdbserver/BlobWorker.actor.cpp index 527768b32f..fac4a5a2a7 100644 --- a/fdbserver/BlobWorker.actor.cpp +++ b/fdbserver/BlobWorker.actor.cpp @@ -23,7 +23,7 @@ #include <utility> #include <vector> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/FDBTypes.h" #include "fdbclient/SystemData.h" #include "fdbclient/BackupContainerFileSystem.h" diff --git a/fdbserver/KeyValueStoreSQLite.actor.cpp b/fdbserver/KeyValueStoreSQLite.actor.cpp index 47c69e9764..a7ea880af5 100644 --- a/fdbserver/KeyValueStoreSQLite.actor.cpp +++ b/fdbserver/KeyValueStoreSQLite.actor.cpp @@ -19,7 +19,7 @@ */ #define SQLITE_THREADSAFE 0 // also in sqlite3.amalgamation.c! -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/crc32c.h" #include "fdbserver/IKeyValueStore.h" #include "fdbserver/CoroFlow.h" diff --git a/fdbserver/SimKmsConnector.actor.cpp b/fdbserver/SimKmsConnector.actor.cpp index 0d44ac1fdb..0b6c37fb7f 100644 --- a/fdbserver/SimKmsConnector.actor.cpp +++ b/fdbserver/SimKmsConnector.actor.cpp @@ -20,7 +20,7 @@ #include "fdbserver/SimKmsConnector.h" -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbrpc/sim_validation.h" #include "fdbserver/KmsConnectorInterface.h" #include "fdbserver/Knobs.h" diff --git a/fdbserver/Status.actor.cpp b/fdbserver/Status.actor.cpp index 935654cec3..e1461b0ed7 100644 --- a/fdbserver/Status.actor.cpp +++ b/fdbserver/Status.actor.cpp @@ -19,7 +19,7 @@ */ #include <cinttypes> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/BlobWorkerInterface.h" #include "fdbclient/KeyBackedTypes.h" #include "fdbserver/Status.h" diff --git a/fdbserver/VersionedBTree.actor.cpp b/fdbserver/VersionedBTree.actor.cpp index 6eb2ac0972..2420f966f7 100644 --- a/fdbserver/VersionedBTree.actor.cpp +++ b/fdbserver/VersionedBTree.actor.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/FDBTypes.h" #include "fdbserver/Knobs.h" #include "flow/Error.h" diff --git a/fdbserver/networktest.actor.cpp b/fdbserver/networktest.actor.cpp index a768051f56..270329b5c6 100644 --- a/fdbserver/networktest.actor.cpp +++ b/fdbserver/networktest.actor.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbserver/NetworkTest.h" #include "flow/Knobs.h" #include "flow/ActorCollection.h" diff --git a/fdbserver/storageserver.actor.cpp b/fdbserver/storageserver.actor.cpp index f44a2d6655..ceea0cb4b2 100644 --- a/fdbserver/storageserver.actor.cpp +++ b/fdbserver/storageserver.actor.cpp @@ -23,7 +23,7 @@ #include <type_traits> #include <unordered_map> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/FDBTypes.h" #include "fdbrpc/fdbrpc.h" #include "fdbrpc/LoadBalance.h" diff --git a/fdbserver/workloads/ApiWorkload.actor.cpp b/fdbserver/workloads/ApiWorkload.actor.cpp index e326029b46..e19b3d05dc 100644 --- a/fdbserver/workloads/ApiWorkload.actor.cpp +++ b/fdbserver/workloads/ApiWorkload.actor.cpp @@ -19,7 +19,7 @@ */ #include <cinttypes> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbserver/workloads/ApiWorkload.h" #include "fdbclient/MultiVersionTransaction.h" #include "flow/actorcompiler.h" // This must be the last #include. diff --git a/fdbserver/workloads/AsyncFileCorrectness.actor.cpp b/fdbserver/workloads/AsyncFileCorrectness.actor.cpp index 70215ad961..3eff9d3a05 100644 --- a/fdbserver/workloads/AsyncFileCorrectness.actor.cpp +++ b/fdbserver/workloads/AsyncFileCorrectness.actor.cpp @@ -20,7 +20,7 @@ #include <cinttypes> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbserver/workloads/workloads.actor.h" #include "flow/ActorCollection.h" #include "flow/IRandom.h" diff --git a/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp b/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp index e0bb85a53f..9dad5c15d7 100644 --- a/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp +++ b/fdbserver/workloads/BlobGranuleCorrectnessWorkload.actor.cpp @@ -24,7 +24,7 @@ #include <utility> #include <vector> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/BlobGranuleReader.actor.h" #include "fdbclient/ManagementAPI.actor.h" #include "fdbclient/NativeAPI.actor.h" diff --git a/fdbserver/workloads/BlobGranuleVerifier.actor.cpp b/fdbserver/workloads/BlobGranuleVerifier.actor.cpp index 8451709cc5..58c5880f2e 100644 --- a/fdbserver/workloads/BlobGranuleVerifier.actor.cpp +++ b/fdbserver/workloads/BlobGranuleVerifier.actor.cpp @@ -22,7 +22,7 @@ #include <utility> #include <vector> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbclient/BlobGranuleReader.actor.h" #include "fdbclient/ManagementAPI.actor.h" #include "fdbclient/NativeAPI.actor.h" diff --git a/fdbserver/workloads/DiskDurabilityTest.actor.cpp b/fdbserver/workloads/DiskDurabilityTest.actor.cpp index e7cbc6ce58..9f8522308b 100644 --- a/fdbserver/workloads/DiskDurabilityTest.actor.cpp +++ b/fdbserver/workloads/DiskDurabilityTest.actor.cpp @@ -19,7 +19,7 @@ */ #include <cinttypes> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbserver/workloads/workloads.actor.h" #include "fdbrpc/IAsyncFile.h" #include "fdbclient/FDBTypes.h" diff --git a/fdbserver/workloads/KVStoreTest.actor.cpp b/fdbserver/workloads/KVStoreTest.actor.cpp index d1513696f4..afa9c3dbd6 100644 --- a/fdbserver/workloads/KVStoreTest.actor.cpp +++ b/fdbserver/workloads/KVStoreTest.actor.cpp @@ -20,7 +20,7 @@ #include <ctime> #include <cinttypes> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbserver/workloads/workloads.actor.h" #include "fdbserver/IKeyValueStore.h" #include "flow/ActorCollection.h" diff --git a/fdbserver/workloads/MutationLogReaderCorrectness.actor.cpp b/fdbserver/workloads/MutationLogReaderCorrectness.actor.cpp index fc6db8ae22..11fd72bed1 100644 --- a/fdbserver/workloads/MutationLogReaderCorrectness.actor.cpp +++ b/fdbserver/workloads/MutationLogReaderCorrectness.actor.cpp @@ -20,7 +20,7 @@ #include <cstdint> #include <limits> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbrpc/simulator.h" #include "fdbclient/BackupAgent.actor.h" #include "fdbclient/BackupContainer.h" diff --git a/fdbserver/workloads/SlowTaskWorkload.actor.cpp b/fdbserver/workloads/SlowTaskWorkload.actor.cpp index 0fa5f5614c..a1e33251ae 100644 --- a/fdbserver/workloads/SlowTaskWorkload.actor.cpp +++ b/fdbserver/workloads/SlowTaskWorkload.actor.cpp @@ -20,7 +20,7 @@ #include <cinttypes> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "fdbserver/workloads/workloads.actor.h" #include "flow/actorcompiler.h" // This must be the last #include. diff --git a/flow/CMakeLists.txt b/flow/CMakeLists.txt index 84166b3d8a..4b73b6eea8 100644 --- a/flow/CMakeLists.txt +++ b/flow/CMakeLists.txt @@ -26,6 +26,7 @@ set(FLOW_SRCS FastRef.h FaultInjection.cpp FaultInjection.h + FileIdentifier.h FileTraceLogWriter.cpp FileTraceLogWriter.h Hash3.c @@ -53,6 +54,8 @@ set(FLOW_SRCS Net2.actor.cpp Net2Packet.cpp Net2Packet.h + ObjectSerializer.h + ObjectSerializerTraits.h PKey.h PKey.cpp Platform.actor.cpp @@ -60,6 +63,7 @@ set(FLOW_SRCS Platform.h Profiler.actor.cpp Profiler.h + ProtocolVersion.h ScopeExit.h SendBufferIterator.h SimpleOpt.h @@ -84,6 +88,8 @@ set(FLOW_SRCS TypeTraits.h UnitTest.cpp UnitTest.h + Util.h + WriteOnlySet.h WriteOnlySet.actor.cpp XmlTraceLogFormatter.cpp XmlTraceLogFormatter.h @@ -95,7 +101,7 @@ set(FLOW_SRCS crc32_wrapper.h crc32_wrapper.c error_definitions.h - ${CMAKE_CURRENT_BINARY_DIR}/SourceVersion.h + ${CMAKE_CURRENT_BINARY_DIR}/include/flow/SourceVersion.h flat_buffers.cpp flat_buffers.h flow.cpp @@ -107,9 +113,11 @@ set(FLOW_SRCS rte_memcpy.h serialize.cpp serialize.h + sse2neon.h stacktrace.h test_memcpy.cpp test_memcpy_perf.cpp + unactorcompiler.h version.cpp xxhash.c xxhash.h) @@ -133,8 +141,9 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") list(APPEND FLOW_SRCS aarch64/memcmp.S aarch64/memcpy.S) endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SourceVersion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/SourceVersion.h) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +make_directory(${CMAKE_CURRENT_BINARY_DIR}/include/flow) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SourceVersion.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/flow/SourceVersion.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/flow/config.h) add_flow_target(STATIC_LIBRARY NAME flow SRCS ${FLOW_SRCS}) target_link_libraries(flow PRIVATE stacktrace) diff --git a/flow/DeterministicRandom.cpp b/flow/DeterministicRandom.cpp index 648ec10642..5fff2e0cb5 100644 --- a/flow/DeterministicRandom.cpp +++ b/flow/DeterministicRandom.cpp @@ -18,7 +18,7 @@ * limitations under the License. */ -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/DeterministicRandom.h" #include <cstring> diff --git a/flow/IndexedSet.cpp b/flow/IndexedSet.cpp index 7f1337279c..995682ae56 100644 --- a/flow/IndexedSet.cpp +++ b/flow/IndexedSet.cpp @@ -21,7 +21,7 @@ // At the moment, this file just contains tests. IndexedSet<> is a template // and so all the important implementation is in the header file -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/IndexedSet.h" #include "flow/IRandom.h" #include "flow/ThreadPrimitives.h" diff --git a/flow/Platform.actor.cpp b/flow/Platform.actor.cpp index c916c30571..00de8f8d06 100644 --- a/flow/Platform.actor.cpp +++ b/flow/Platform.actor.cpp @@ -26,7 +26,7 @@ #endif #include <errno.h> -#include "contrib/fmt-8.1.1/include/fmt/format.h" +#include "fmt/format.h" #include "flow/Platform.h" #include "flow/Platform.actor.h" #include "flow/Arena.h" diff --git a/flow/Platform.h b/flow/Platform.h index 51ed8c2704..a5cc2e172c 100644 --- a/flow/Platform.h +++ b/flow/Platform.h @@ -456,7 +456,7 @@ dev_t getDeviceId(std::string path); #endif #if defined(__aarch64__) -#include "sse2neon.h" +#include "flow/sse2neon.h" // aarch64 does not have rdtsc counter // Use cntvct_el0 virtual counter instead inline static uint64_t timestampCounter() {