foundationdb/CMakeLists.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

259 lines
9.7 KiB
CMake
Raw Normal View History

2018-05-03 00:55:29 +08:00
#
# CMakeLists.txt
2018-05-03 00:55:29 +08:00
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2024 Apple Inc. and the FoundationDB project authors
2018-05-03 00:55:29 +08:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2023-02-20 02:28:07 +08:00
cmake_minimum_required(VERSION 3.24.2)
# silence deprecation warnings in newer versions of cmake
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
project(foundationdb
VERSION 7.4.0
DESCRIPTION "FoundationDB is a scalable, fault-tolerant, ordered key-value store with full ACID transactions."
HOMEPAGE_URL "http://www.foundationdb.org/"
2024-07-11 07:04:28 +08:00
LANGUAGES C CXX ASM Swift)
2018-05-03 00:55:29 +08:00
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
2018-05-03 00:55:29 +08:00
message (STATUS "${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}")
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are forbidden")
2018-05-03 00:55:29 +08:00
endif()
set(OPEN_FOR_IDE OFF CACHE BOOL "Open this in an IDE (won't compile/link)")
set(AUTO_DISCOVER_UNIT_TESTS OFF CACHE BOOL "Automatically discover unit-tests")
2018-05-03 00:55:29 +08:00
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if (OPEN_FOR_IDE)
message(STATUS "Defaulting build type to 'Debug' for OPEN_FOR_IDE")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE)
else()
message(STATUS "Setting build type to 'Release' as none was specified")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
2018-05-03 00:55:29 +08:00
endif()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
2018-05-03 00:55:29 +08:00
option(WITH_ACAC "Enable actor stack recording" OFF)
if (WITH_ACAC)
message(STATUS "Build FoundationDB with AcAC support")
2024-03-07 07:06:42 +08:00
if (FDB_RELEASE OR FDB_RELEASE_CANDIDATE)
message(FATAL_ERROR "ACAC will cause severe slowdown of the system and SHOULD not be enabled in Release.")
endif()
add_compile_definitions(WITH_ACAC)
endif()
2018-05-03 00:55:29 +08:00
################################################################################
# Packages used for bindings
################################################################################
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
2018-05-03 00:55:29 +08:00
2019-02-06 14:20:44 +08:00
################################################################################
2019-02-08 14:18:31 +08:00
# Compiler configuration
2019-02-06 14:20:44 +08:00
################################################################################
2019-02-08 14:18:31 +08:00
include(ConfigureCompiler)
2019-02-06 14:20:44 +08:00
2019-02-07 10:16:54 +08:00
################################################################################
# Components configuration
2019-02-07 10:16:54 +08:00
################################################################################
2019-02-08 14:18:31 +08:00
include(FDBComponents)
2019-02-07 10:16:54 +08:00
2018-05-03 00:55:29 +08:00
################################################################################
# Get repository information
################################################################################
add_custom_target(branch_file ALL DEPENDS ${CURR_BRANCH_FILE})
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE CURRENT_GIT_VERSION_WNL
OUTPUT_STRIP_TRAILING_WHITESPACE)
2018-05-03 00:55:29 +08:00
string(STRIP "${CURRENT_GIT_VERSION_WNL}" CURRENT_GIT_VERSION)
message(STATUS "Current git version ${CURRENT_GIT_VERSION}")
2018-05-04 06:48:10 +08:00
################################################################################
# Version information
################################################################################
if (FDB_RELEASE_CANDIDATE)
set(FDB_RELEASE_CANDIDATE_VERSION 1 CACHE STRING "release candidate version")
set(FDB_VERSION ${PROJECT_VERSION}-rc${FDB_RELEASE_CANDIDATE_VERSION})
else()
set(FDB_VERSION ${PROJECT_VERSION})
endif()
if (NOT FDB_RELEASE)
string(TIMESTAMP FDB_BUILD_TIMESTMAP %Y%m%d%H%M%S)
# Adding support to pass custom fdb_build timestamp,
# required to achieve uniform naming across different builds
set(FDB_BUILDTIME "${FDB_BUILD_TIMESTMAP}" CACHE STRING "A timestamp for packages")
set(FDB_BUILDTIME_STRING ".${FDB_BUILDTIME}")
set(PRERELEASE_TAG "prerelease")
endif()
2020-04-08 02:09:11 +08:00
set(FDB_VERSION_PLAIN ${FDB_VERSION})
string(REPLACE "." ";" FDB_VERSION_LIST ${FDB_VERSION_PLAIN})
list(GET FDB_VERSION_LIST 0 FDB_MAJOR)
list(GET FDB_VERSION_LIST 1 FDB_MINOR)
list(GET FDB_VERSION_LIST 2 FDB_PATCH)
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})
set(FDB_CURRENT_VERSION ${PROJECT_VERSION})
set(FDB_FUTURE_VERSION "7.5.0")
set(FDB_PREV_RELEASE_VERSION "7.3.41")
set(FDB_PREV2_RELEASE_VERSION "7.1.33")
set(FDB_PREV3_RELEASE_VERSION "7.0.0")
2018-05-03 00:55:29 +08:00
################################################################################
# Flow
2018-05-03 00:55:29 +08:00
################################################################################
include(utils)
# Flow and other tools are written in C# - so we need that dependency
2019-02-11 04:48:15 +08:00
include(EnableCsharp)
# First thing we need is the actor compiler - and to compile and run the
# actor compiler, we need mono
include(CompileActorCompiler)
2018-05-03 00:55:29 +08:00
include(CompileCoverageTool)
# with the actor compiler, we can now make the flow commands available
include(FlowCommands)
2018-05-03 00:55:29 +08:00
################################################################################
# Vexilographer
################################################################################
include(CompileVexillographer)
2018-05-03 00:55:29 +08:00
################################################################################
# Generate config file
################################################################################
string(RANDOM LENGTH 8 description1)
string(RANDOM LENGTH 8 description2)
set(CLUSTER_DESCRIPTION1 ${description1} CACHE STRING "Cluster description")
set(CLUSTER_DESCRIPTION2 ${description2} CACHE STRING "Cluster description")
configure_file(fdb.cluster.cmake ${CMAKE_CURRENT_BINARY_DIR}/fdb.cluster)
################################################################################
# testing
################################################################################
include(CTest)
2018-05-03 00:55:29 +08:00
enable_testing()
################################################################################
# Directory structure
################################################################################
include(cmake/InstallLayout.cmake)
2018-08-29 02:38:52 +08:00
################################################################################
# Random seed
################################################################################
string(RANDOM LENGTH 8 ALPHABET "0123456789abcdef" SEED_)
set(SEED "0x${SEED_}" CACHE STRING "Random seed for testing")
2018-05-03 00:55:29 +08:00
################################################################################
# components
################################################################################
2020-04-08 03:28:18 +08:00
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
include_directories(/usr/local/include)
endif()
2018-05-03 00:55:29 +08:00
include(CompileBoost)
include(GetMsgpack)
2022-02-18 23:48:44 +08:00
add_subdirectory(contrib)
2018-05-03 00:55:29 +08:00
add_subdirectory(flow)
2018-05-03 02:25:38 +08:00
add_subdirectory(fdbrpc)
2018-05-04 06:48:10 +08:00
add_subdirectory(fdbclient)
add_subdirectory(fdbserver)
add_subdirectory(fdbcli)
2019-02-07 11:27:38 +08:00
if(NOT WIN32)
2024-07-11 07:04:28 +08:00
if (NOT FOUNDATIONDB_CROSS_COMPILING) # FIXME(swift): make this work when x-compiling.
Introduce initial Swift support in fdbserver (#10156) * [fdbserver] workaround the FRT type layout issue to get Swfit getVersion working * MasterData.actor.h: fix comment typo * masterserver.swift: some tweaks * masterserver.swift: remove getVersion function, use the method * masterserver.swift: print replied version to output for tracing * [swift] add radar links for C++ interop issues found in getVersion bringup * Update fdbserver.actor.cpp * Migrate MasterData closer to full reference type This removes the workaround for the FRT type layout issue, and gets us closer to making MasterData a full reference type * [interop] require a new toolchain (>= Oct 19th) to build * [Swift] fix computation of toAdd for getVersion Swift implementation * add Swift to FDBClient and add async `atLeast` to NotifiedVersion * fix * use new atLeast API in master server * =build fixup link dependencies in swift fdbclient * clocks * +clock implement Clock using Flow's notion of time * [interop] workaround the immortal retain/release issue * [swift] add script to get latest centos toolchain * always install swift hooks; not only in "test" mode * simulator - first thing running WIP * cleanups * more cleanup * working snapshot * remove sim debug printlns * added convenience for whenAtLeast * try Alex's workaround * annotate nonnull * cleanup clock a little bit * fix missing impls after rebase * Undo the swift_lookup_Map_UID_CommitProxyVersionReplies workaround No longer needed - the issue was retain/release * [flow][swift] add Swift version of BUGGIFY * [swiftication] add CounterValue type to provide value semantics for Counter types on the Swift side * remove extraneous requestingProxyUID local * masterserver: initial Swift state prototype * [interop] make the Swiftied getVersion work * masterserver - remove the C++ implementation (it can't be supported as state is now missing) * Remove unnecessary SWIFT_CXX_REF_IMMORTAL annotations from Flow types * Remove C++ implementation of CommitProxyVersionReplies - it's in Swift now * [swift interop] remove more SWIFT_CXX_REF_IMMORTAL * [swift interop] add SWIFT_CXX_IMMORTAL_SINGLETON_TYPE annotation for semanticly meaningful immortal uses * rename SWIFT_CXX_REF_IMMORTAL -> UNSAFE_SWIFT_CXX_IMMORTAL_REF * Move master server waitForPrev to swift * =build fix linking swift in all modules * =build single link option * =cmake avoid manual math, just get "last" element from list * implement Streams support (#18) * [interop] update to new toolchain #6 * [interop] remove C++ vtable linking workarounds * [interop] make MasterData proper reference counted SWIFT_CXX_REF_MASTERDATA * [interop] use Swift array to pass UIDs to registerLastCommitProxyVersionReplies * [interop] expose MasterServer actor to C++ without wrapper struct * [interop] we no longer need expose on methods 🥳 * [interop] initial prototype of storing CheckedContinuation on the C++ side * Example of invoking a synchronous swift function from a C++ unit test. (#21) * move all "tests" we have in Swift, and priority support into real modules (#24) * Make set continuation functions inline * Split flow_swift into flow_swift and flow_swift_future to break circular dependency * rename SwiftContinuationCallbackStruct to FlowCallbackForSwiftContinuation * Future interop: use a method in a class template for continuation set call * Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30) * Basic Swift Guide (#29) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Revert "Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30)" This reverts commit c025fe6258c4c4904d5e70cd549d408bb61f2802. * Restore the C++ continuation, but it seems waitValue is broken for CInt somehow now * disable broken tests - waitValue not accessible * Streams can be async iterated over (#27) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * remove work in progress things (#35) * remove some not used (yet) code * remove expose func for CInt, it's a primitive so we always have witness info (#37) * +masterdata implement provideVersions in Swift (#36) * serveLiveCommittedVersion in Swift (#38) * Port updateLiveCommittedVersion to swift (#33) Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com> * Implement updateRecoveryData in Swift (#39) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Simplify flow_swift to avoid multiple targets and generate separate CheckedContinuation header * Uncomment test which was blocked on extensions not being picked up (#31) * [interop] Use a separate target for Swift-to-C++ header generation * reduce boilerplate in future and stream support (#41) * [interop] require interop v8 - that will fix linker issue (https://github.com/apple/swift/issues/62448) * [interop] fix swift_stream_support.h Swift include * [interop] bump up requirement to version 9 * [interop] Generalize the Flow.Optional -> Swift.Optional conversion using generics * [WIP] masterServer func in Swift (#45) * [interop] Try conforms_to with a SWIFT_CONFORMS_TO macro for Optional conformance (#49) * [interop] include FlowOptionalProtocol source file when generating Flow_CheckedContinuation.h This header generation step depends on the import of the C++ Flow module, which requires the presence of FlowOptionalProtocol * conform Future to FlowFutureOps * some notes * move to value() so we can use discardable result for Flow.Void * make calling into Swift async funcs nicer by returning Flow Futures * [interop] hide initial use of FlowCheckedContinuation in flow.h to break dependency cycle * [fdbserver] fix an EncryptionOpsUtils.h modularization issue (showed up with modularized libc++) * Pass GCC toolchain using CMAKE_Swift_COMPILE_EXTERNAL_TOOLCHAIN to Swift's clang importer * [interop] drop the no longer needed libstdc++ include directories * [cmake] add a configuration check to ensure Swift can import C++ standard library * [swift] include msgpack from msgpack_DIR * [interop] make sure the FDB module maps have 'export' directive * add import 'flow_swift' to swift_fdbserver_cxx_swift_value_conformance.swift This is needed for CONFORMS_TO to work in imported modules * make sure the Swift -> C++ manually bridged function signature matches generated signature * [interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed * [interop] make getResolutionBalancer return a pointer to allow Swift to use it We should revert back to a reference once compiler allows references again * [interop] add a workaround for 'pop' being marked as unsafe in Swift * masterserver.swift: MasterData returns the Swift actor pointer in an unsafe manner * Add a 'getCopy' method to AsyncVar to make it more Swift friendly * [interop] bump up the toolchain requirement * Revert "[interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed" This reverts commit b01b271a76d1677bbb7c5c9c64cdad4b8b2b9612. * [interop] add FIXME comments highlighting new issue workarounds * [interop] adopt the new C++ interoperability compiler flag * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * flow actorcompiler.h: add a SWIFT_ACTOR empty macro definition This is needed to make the actor files parsable by clangd * [cmake] add missing dependencies * experimental cross compile * [cmake] fix triple in cross-compiled cmake flags * [interop] update to interop toolchain version 16 * [x-compile] add flags for cross-compiling boost * cleanup x-compile cmake changes * [cmake] fix typo in CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN config variable * [interop] pass MasterDataActor from Swift to C++ and back to Swift * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * Update swift_get_latest_toolchain.sh to fetch 5.9 toochains * set HAVE_FLAG_SEARCH_PATHS_FIRST for cross compilation * Resolve conflicts in net2/sim2/actors, can't build yet * undo SWIFT_ACTOR changes, not necessary for merge * guard c++ compiler flags with is_cxx_compile * Update flow/actorcompiler/ActorParser.cs Co-authored-by: Evan Wilde <etceterawilde@gmail.com> * update the boost dependency * Include boost directory from the container for Swift * conform flow's Optional to FlowOptionalProtocol again * Guard entire RocksDBLogForwarder.h with SSD_ROCKSDB_EXPERIMENTAL to avoid failing on missing rocksdb APIs * remove extraneous merge marker * [swift] update swift_test_streams.swifto to use vars in more places * Add header guard to flow/include/flow/ThreadSafeQueue.h to fix moduralization issue * Update net and sim impls * [cmake] use prebuilt libc++ boost only when we're actually using libc++ * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * fixups after merge * remove CustomStringConvertible conformance that would not be used * remove self-caused deprecation warnings in future_support * handle newly added task priority * reformatting * future: make value() not mutating * remove FIXME, not needed anymore * future: clarify why as functions * Support TraceEvent in Swift * Enable TraceEvent using a class wrapper in Swift * prearing WITH_SWIFT flag * wip disabled failing Go stuff * cleanup WITH_SWIFT_FLAG and reenable Go * wip disabled failing Go stuff * move setting flag before printing it * Add SWIFT_IDE_SETUP and cleanup guides and build a bit * Revert "Wipe packet buffers that held serialized WipedString (#10018)" This reverts commit e2df6e33029897360f8e11b3aea8fef97393a98c. * [Swift] Compile workaround in KeyBackedRangeMap; default init is incorrect * [interop] do not add FlowFutureOps conformance when building flow clang module for Flow checked continuation header pre-generation * make sure to show -DUSE_LIBCXX=OFF in readme * readme updates * do not print to stderr * Update Swift and C++ code to build with latest Swift 5.9 toolchain now that we no longer support universal references and bridge the methods that take in a constant reference template parameter correctly * Fix SERVER_KNOBS and enable use them for masterserver * Bump to C++20, Swift is now able to handle it as well * Put waitForPrev behind FLOW_WITH_SWIFT knob * Forward declare updateLiveCommittedVersion * Remove unused code * fix wrong condition set for updateLiveCommittedVersion * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * Enable go-bindings in cmake * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * USE_SWIFT flag so we "build without swift" until ready to by default * uncomment a few tests which were disabled during USE_SWIFT enablement * the option is WITH_SWIFT, not USE * formatting * Fix masterserver compile error * Fix some build errors. How did it not merge cleanly? :/ * remove initializer list from constructor * Expect Swift toolchain only if WITH_SWIFT is enabled * Don't require Flow_CheckedContinuation when Swift is disabled * Don't compile FlowCheckedContinuation when WITH_SWIFT=OFF * No-op Swift macros * More compile guards * fix typo * Run clang-format * Guard swift/bridging include in fdbrpc * Remove printf to pass the test * Remove some more printf to avoid potential issues TODO: Need to be TraceEvents instead * Remove __has_feature(nullability) as its only used in Swift * Don't use __FILENAME__ * Don't call generate_module_map outside WITH_SWIFT * Add some more cmake stuff under WITH_SWIFT guard * Some more guards * Bring back TLSTest.cpp * clang-format * fix comment formatting * Remove unused command line arg * fix cmake formatting in some files * Address some review comments * fix clang-format error --------- Co-authored-by: Alex Lorenz <arphaman@gmail.com> Co-authored-by: Russell Sears <russell_sears@apple.com> Co-authored-by: Evan Wilde <etceterawilde@gmail.com> Co-authored-by: Alex Lorenz <aleksei_lorenz@apple.com> Co-authored-by: Vishesh Yadav <vishesh_yadav@apple.com> Co-authored-by: Vishesh Yadav <vishesh3y@gmail.com>
2023-06-03 05:09:28 +08:00
add_subdirectory(fdbmonitor)
endif()
2019-02-07 11:27:38 +08:00
else()
add_subdirectory(fdbservice)
endif()
add_subdirectory(fdbbackup)
add_subdirectory(metacluster)
add_subdirectory(tests)
2024-07-11 07:04:28 +08:00
if (NOT FOUNDATIONDB_CROSS_COMPILING) # FIXME(swift): make this work when x-compiling.
Introduce initial Swift support in fdbserver (#10156) * [fdbserver] workaround the FRT type layout issue to get Swfit getVersion working * MasterData.actor.h: fix comment typo * masterserver.swift: some tweaks * masterserver.swift: remove getVersion function, use the method * masterserver.swift: print replied version to output for tracing * [swift] add radar links for C++ interop issues found in getVersion bringup * Update fdbserver.actor.cpp * Migrate MasterData closer to full reference type This removes the workaround for the FRT type layout issue, and gets us closer to making MasterData a full reference type * [interop] require a new toolchain (>= Oct 19th) to build * [Swift] fix computation of toAdd for getVersion Swift implementation * add Swift to FDBClient and add async `atLeast` to NotifiedVersion * fix * use new atLeast API in master server * =build fixup link dependencies in swift fdbclient * clocks * +clock implement Clock using Flow's notion of time * [interop] workaround the immortal retain/release issue * [swift] add script to get latest centos toolchain * always install swift hooks; not only in "test" mode * simulator - first thing running WIP * cleanups * more cleanup * working snapshot * remove sim debug printlns * added convenience for whenAtLeast * try Alex's workaround * annotate nonnull * cleanup clock a little bit * fix missing impls after rebase * Undo the swift_lookup_Map_UID_CommitProxyVersionReplies workaround No longer needed - the issue was retain/release * [flow][swift] add Swift version of BUGGIFY * [swiftication] add CounterValue type to provide value semantics for Counter types on the Swift side * remove extraneous requestingProxyUID local * masterserver: initial Swift state prototype * [interop] make the Swiftied getVersion work * masterserver - remove the C++ implementation (it can't be supported as state is now missing) * Remove unnecessary SWIFT_CXX_REF_IMMORTAL annotations from Flow types * Remove C++ implementation of CommitProxyVersionReplies - it's in Swift now * [swift interop] remove more SWIFT_CXX_REF_IMMORTAL * [swift interop] add SWIFT_CXX_IMMORTAL_SINGLETON_TYPE annotation for semanticly meaningful immortal uses * rename SWIFT_CXX_REF_IMMORTAL -> UNSAFE_SWIFT_CXX_IMMORTAL_REF * Move master server waitForPrev to swift * =build fix linking swift in all modules * =build single link option * =cmake avoid manual math, just get "last" element from list * implement Streams support (#18) * [interop] update to new toolchain #6 * [interop] remove C++ vtable linking workarounds * [interop] make MasterData proper reference counted SWIFT_CXX_REF_MASTERDATA * [interop] use Swift array to pass UIDs to registerLastCommitProxyVersionReplies * [interop] expose MasterServer actor to C++ without wrapper struct * [interop] we no longer need expose on methods 🥳 * [interop] initial prototype of storing CheckedContinuation on the C++ side * Example of invoking a synchronous swift function from a C++ unit test. (#21) * move all "tests" we have in Swift, and priority support into real modules (#24) * Make set continuation functions inline * Split flow_swift into flow_swift and flow_swift_future to break circular dependency * rename SwiftContinuationCallbackStruct to FlowCallbackForSwiftContinuation * Future interop: use a method in a class template for continuation set call * Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30) * Basic Swift Guide (#29) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Revert "Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30)" This reverts commit c025fe6258c4c4904d5e70cd549d408bb61f2802. * Restore the C++ continuation, but it seems waitValue is broken for CInt somehow now * disable broken tests - waitValue not accessible * Streams can be async iterated over (#27) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * remove work in progress things (#35) * remove some not used (yet) code * remove expose func for CInt, it's a primitive so we always have witness info (#37) * +masterdata implement provideVersions in Swift (#36) * serveLiveCommittedVersion in Swift (#38) * Port updateLiveCommittedVersion to swift (#33) Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com> * Implement updateRecoveryData in Swift (#39) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Simplify flow_swift to avoid multiple targets and generate separate CheckedContinuation header * Uncomment test which was blocked on extensions not being picked up (#31) * [interop] Use a separate target for Swift-to-C++ header generation * reduce boilerplate in future and stream support (#41) * [interop] require interop v8 - that will fix linker issue (https://github.com/apple/swift/issues/62448) * [interop] fix swift_stream_support.h Swift include * [interop] bump up requirement to version 9 * [interop] Generalize the Flow.Optional -> Swift.Optional conversion using generics * [WIP] masterServer func in Swift (#45) * [interop] Try conforms_to with a SWIFT_CONFORMS_TO macro for Optional conformance (#49) * [interop] include FlowOptionalProtocol source file when generating Flow_CheckedContinuation.h This header generation step depends on the import of the C++ Flow module, which requires the presence of FlowOptionalProtocol * conform Future to FlowFutureOps * some notes * move to value() so we can use discardable result for Flow.Void * make calling into Swift async funcs nicer by returning Flow Futures * [interop] hide initial use of FlowCheckedContinuation in flow.h to break dependency cycle * [fdbserver] fix an EncryptionOpsUtils.h modularization issue (showed up with modularized libc++) * Pass GCC toolchain using CMAKE_Swift_COMPILE_EXTERNAL_TOOLCHAIN to Swift's clang importer * [interop] drop the no longer needed libstdc++ include directories * [cmake] add a configuration check to ensure Swift can import C++ standard library * [swift] include msgpack from msgpack_DIR * [interop] make sure the FDB module maps have 'export' directive * add import 'flow_swift' to swift_fdbserver_cxx_swift_value_conformance.swift This is needed for CONFORMS_TO to work in imported modules * make sure the Swift -> C++ manually bridged function signature matches generated signature * [interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed * [interop] make getResolutionBalancer return a pointer to allow Swift to use it We should revert back to a reference once compiler allows references again * [interop] add a workaround for 'pop' being marked as unsafe in Swift * masterserver.swift: MasterData returns the Swift actor pointer in an unsafe manner * Add a 'getCopy' method to AsyncVar to make it more Swift friendly * [interop] bump up the toolchain requirement * Revert "[interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed" This reverts commit b01b271a76d1677bbb7c5c9c64cdad4b8b2b9612. * [interop] add FIXME comments highlighting new issue workarounds * [interop] adopt the new C++ interoperability compiler flag * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * flow actorcompiler.h: add a SWIFT_ACTOR empty macro definition This is needed to make the actor files parsable by clangd * [cmake] add missing dependencies * experimental cross compile * [cmake] fix triple in cross-compiled cmake flags * [interop] update to interop toolchain version 16 * [x-compile] add flags for cross-compiling boost * cleanup x-compile cmake changes * [cmake] fix typo in CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN config variable * [interop] pass MasterDataActor from Swift to C++ and back to Swift * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * Update swift_get_latest_toolchain.sh to fetch 5.9 toochains * set HAVE_FLAG_SEARCH_PATHS_FIRST for cross compilation * Resolve conflicts in net2/sim2/actors, can't build yet * undo SWIFT_ACTOR changes, not necessary for merge * guard c++ compiler flags with is_cxx_compile * Update flow/actorcompiler/ActorParser.cs Co-authored-by: Evan Wilde <etceterawilde@gmail.com> * update the boost dependency * Include boost directory from the container for Swift * conform flow's Optional to FlowOptionalProtocol again * Guard entire RocksDBLogForwarder.h with SSD_ROCKSDB_EXPERIMENTAL to avoid failing on missing rocksdb APIs * remove extraneous merge marker * [swift] update swift_test_streams.swifto to use vars in more places * Add header guard to flow/include/flow/ThreadSafeQueue.h to fix moduralization issue * Update net and sim impls * [cmake] use prebuilt libc++ boost only when we're actually using libc++ * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * fixups after merge * remove CustomStringConvertible conformance that would not be used * remove self-caused deprecation warnings in future_support * handle newly added task priority * reformatting * future: make value() not mutating * remove FIXME, not needed anymore * future: clarify why as functions * Support TraceEvent in Swift * Enable TraceEvent using a class wrapper in Swift * prearing WITH_SWIFT flag * wip disabled failing Go stuff * cleanup WITH_SWIFT_FLAG and reenable Go * wip disabled failing Go stuff * move setting flag before printing it * Add SWIFT_IDE_SETUP and cleanup guides and build a bit * Revert "Wipe packet buffers that held serialized WipedString (#10018)" This reverts commit e2df6e33029897360f8e11b3aea8fef97393a98c. * [Swift] Compile workaround in KeyBackedRangeMap; default init is incorrect * [interop] do not add FlowFutureOps conformance when building flow clang module for Flow checked continuation header pre-generation * make sure to show -DUSE_LIBCXX=OFF in readme * readme updates * do not print to stderr * Update Swift and C++ code to build with latest Swift 5.9 toolchain now that we no longer support universal references and bridge the methods that take in a constant reference template parameter correctly * Fix SERVER_KNOBS and enable use them for masterserver * Bump to C++20, Swift is now able to handle it as well * Put waitForPrev behind FLOW_WITH_SWIFT knob * Forward declare updateLiveCommittedVersion * Remove unused code * fix wrong condition set for updateLiveCommittedVersion * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * Enable go-bindings in cmake * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * USE_SWIFT flag so we "build without swift" until ready to by default * uncomment a few tests which were disabled during USE_SWIFT enablement * the option is WITH_SWIFT, not USE * formatting * Fix masterserver compile error * Fix some build errors. How did it not merge cleanly? :/ * remove initializer list from constructor * Expect Swift toolchain only if WITH_SWIFT is enabled * Don't require Flow_CheckedContinuation when Swift is disabled * Don't compile FlowCheckedContinuation when WITH_SWIFT=OFF * No-op Swift macros * More compile guards * fix typo * Run clang-format * Guard swift/bridging include in fdbrpc * Remove printf to pass the test * Remove some more printf to avoid potential issues TODO: Need to be TraceEvents instead * Remove __has_feature(nullability) as its only used in Swift * Don't use __FILENAME__ * Don't call generate_module_map outside WITH_SWIFT * Add some more cmake stuff under WITH_SWIFT guard * Some more guards * Bring back TLSTest.cpp * clang-format * fix comment formatting * Remove unused command line arg * fix cmake formatting in some files * Address some review comments * fix clang-format error --------- Co-authored-by: Alex Lorenz <arphaman@gmail.com> Co-authored-by: Russell Sears <russell_sears@apple.com> Co-authored-by: Evan Wilde <etceterawilde@gmail.com> Co-authored-by: Alex Lorenz <aleksei_lorenz@apple.com> Co-authored-by: Vishesh Yadav <vishesh_yadav@apple.com> Co-authored-by: Vishesh Yadav <vishesh3y@gmail.com>
2023-06-03 05:09:28 +08:00
add_subdirectory(flowbench EXCLUDE_FROM_ALL)
endif()
2021-08-05 21:31:15 +08:00
if(WITH_PYTHON AND WITH_C_BINDING)
2024-07-11 07:04:28 +08:00
if (NOT FOUNDATIONDB_CROSS_COMPILING) # FIXME(swift): make this work when x-compiling.
Introduce initial Swift support in fdbserver (#10156) * [fdbserver] workaround the FRT type layout issue to get Swfit getVersion working * MasterData.actor.h: fix comment typo * masterserver.swift: some tweaks * masterserver.swift: remove getVersion function, use the method * masterserver.swift: print replied version to output for tracing * [swift] add radar links for C++ interop issues found in getVersion bringup * Update fdbserver.actor.cpp * Migrate MasterData closer to full reference type This removes the workaround for the FRT type layout issue, and gets us closer to making MasterData a full reference type * [interop] require a new toolchain (>= Oct 19th) to build * [Swift] fix computation of toAdd for getVersion Swift implementation * add Swift to FDBClient and add async `atLeast` to NotifiedVersion * fix * use new atLeast API in master server * =build fixup link dependencies in swift fdbclient * clocks * +clock implement Clock using Flow's notion of time * [interop] workaround the immortal retain/release issue * [swift] add script to get latest centos toolchain * always install swift hooks; not only in "test" mode * simulator - first thing running WIP * cleanups * more cleanup * working snapshot * remove sim debug printlns * added convenience for whenAtLeast * try Alex's workaround * annotate nonnull * cleanup clock a little bit * fix missing impls after rebase * Undo the swift_lookup_Map_UID_CommitProxyVersionReplies workaround No longer needed - the issue was retain/release * [flow][swift] add Swift version of BUGGIFY * [swiftication] add CounterValue type to provide value semantics for Counter types on the Swift side * remove extraneous requestingProxyUID local * masterserver: initial Swift state prototype * [interop] make the Swiftied getVersion work * masterserver - remove the C++ implementation (it can't be supported as state is now missing) * Remove unnecessary SWIFT_CXX_REF_IMMORTAL annotations from Flow types * Remove C++ implementation of CommitProxyVersionReplies - it's in Swift now * [swift interop] remove more SWIFT_CXX_REF_IMMORTAL * [swift interop] add SWIFT_CXX_IMMORTAL_SINGLETON_TYPE annotation for semanticly meaningful immortal uses * rename SWIFT_CXX_REF_IMMORTAL -> UNSAFE_SWIFT_CXX_IMMORTAL_REF * Move master server waitForPrev to swift * =build fix linking swift in all modules * =build single link option * =cmake avoid manual math, just get "last" element from list * implement Streams support (#18) * [interop] update to new toolchain #6 * [interop] remove C++ vtable linking workarounds * [interop] make MasterData proper reference counted SWIFT_CXX_REF_MASTERDATA * [interop] use Swift array to pass UIDs to registerLastCommitProxyVersionReplies * [interop] expose MasterServer actor to C++ without wrapper struct * [interop] we no longer need expose on methods 🥳 * [interop] initial prototype of storing CheckedContinuation on the C++ side * Example of invoking a synchronous swift function from a C++ unit test. (#21) * move all "tests" we have in Swift, and priority support into real modules (#24) * Make set continuation functions inline * Split flow_swift into flow_swift and flow_swift_future to break circular dependency * rename SwiftContinuationCallbackStruct to FlowCallbackForSwiftContinuation * Future interop: use a method in a class template for continuation set call * Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30) * Basic Swift Guide (#29) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Revert "Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30)" This reverts commit c025fe6258c4c4904d5e70cd549d408bb61f2802. * Restore the C++ continuation, but it seems waitValue is broken for CInt somehow now * disable broken tests - waitValue not accessible * Streams can be async iterated over (#27) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * remove work in progress things (#35) * remove some not used (yet) code * remove expose func for CInt, it's a primitive so we always have witness info (#37) * +masterdata implement provideVersions in Swift (#36) * serveLiveCommittedVersion in Swift (#38) * Port updateLiveCommittedVersion to swift (#33) Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com> * Implement updateRecoveryData in Swift (#39) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Simplify flow_swift to avoid multiple targets and generate separate CheckedContinuation header * Uncomment test which was blocked on extensions not being picked up (#31) * [interop] Use a separate target for Swift-to-C++ header generation * reduce boilerplate in future and stream support (#41) * [interop] require interop v8 - that will fix linker issue (https://github.com/apple/swift/issues/62448) * [interop] fix swift_stream_support.h Swift include * [interop] bump up requirement to version 9 * [interop] Generalize the Flow.Optional -> Swift.Optional conversion using generics * [WIP] masterServer func in Swift (#45) * [interop] Try conforms_to with a SWIFT_CONFORMS_TO macro for Optional conformance (#49) * [interop] include FlowOptionalProtocol source file when generating Flow_CheckedContinuation.h This header generation step depends on the import of the C++ Flow module, which requires the presence of FlowOptionalProtocol * conform Future to FlowFutureOps * some notes * move to value() so we can use discardable result for Flow.Void * make calling into Swift async funcs nicer by returning Flow Futures * [interop] hide initial use of FlowCheckedContinuation in flow.h to break dependency cycle * [fdbserver] fix an EncryptionOpsUtils.h modularization issue (showed up with modularized libc++) * Pass GCC toolchain using CMAKE_Swift_COMPILE_EXTERNAL_TOOLCHAIN to Swift's clang importer * [interop] drop the no longer needed libstdc++ include directories * [cmake] add a configuration check to ensure Swift can import C++ standard library * [swift] include msgpack from msgpack_DIR * [interop] make sure the FDB module maps have 'export' directive * add import 'flow_swift' to swift_fdbserver_cxx_swift_value_conformance.swift This is needed for CONFORMS_TO to work in imported modules * make sure the Swift -> C++ manually bridged function signature matches generated signature * [interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed * [interop] make getResolutionBalancer return a pointer to allow Swift to use it We should revert back to a reference once compiler allows references again * [interop] add a workaround for 'pop' being marked as unsafe in Swift * masterserver.swift: MasterData returns the Swift actor pointer in an unsafe manner * Add a 'getCopy' method to AsyncVar to make it more Swift friendly * [interop] bump up the toolchain requirement * Revert "[interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed" This reverts commit b01b271a76d1677bbb7c5c9c64cdad4b8b2b9612. * [interop] add FIXME comments highlighting new issue workarounds * [interop] adopt the new C++ interoperability compiler flag * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * flow actorcompiler.h: add a SWIFT_ACTOR empty macro definition This is needed to make the actor files parsable by clangd * [cmake] add missing dependencies * experimental cross compile * [cmake] fix triple in cross-compiled cmake flags * [interop] update to interop toolchain version 16 * [x-compile] add flags for cross-compiling boost * cleanup x-compile cmake changes * [cmake] fix typo in CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN config variable * [interop] pass MasterDataActor from Swift to C++ and back to Swift * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * Update swift_get_latest_toolchain.sh to fetch 5.9 toochains * set HAVE_FLAG_SEARCH_PATHS_FIRST for cross compilation * Resolve conflicts in net2/sim2/actors, can't build yet * undo SWIFT_ACTOR changes, not necessary for merge * guard c++ compiler flags with is_cxx_compile * Update flow/actorcompiler/ActorParser.cs Co-authored-by: Evan Wilde <etceterawilde@gmail.com> * update the boost dependency * Include boost directory from the container for Swift * conform flow's Optional to FlowOptionalProtocol again * Guard entire RocksDBLogForwarder.h with SSD_ROCKSDB_EXPERIMENTAL to avoid failing on missing rocksdb APIs * remove extraneous merge marker * [swift] update swift_test_streams.swifto to use vars in more places * Add header guard to flow/include/flow/ThreadSafeQueue.h to fix moduralization issue * Update net and sim impls * [cmake] use prebuilt libc++ boost only when we're actually using libc++ * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * fixups after merge * remove CustomStringConvertible conformance that would not be used * remove self-caused deprecation warnings in future_support * handle newly added task priority * reformatting * future: make value() not mutating * remove FIXME, not needed anymore * future: clarify why as functions * Support TraceEvent in Swift * Enable TraceEvent using a class wrapper in Swift * prearing WITH_SWIFT flag * wip disabled failing Go stuff * cleanup WITH_SWIFT_FLAG and reenable Go * wip disabled failing Go stuff * move setting flag before printing it * Add SWIFT_IDE_SETUP and cleanup guides and build a bit * Revert "Wipe packet buffers that held serialized WipedString (#10018)" This reverts commit e2df6e33029897360f8e11b3aea8fef97393a98c. * [Swift] Compile workaround in KeyBackedRangeMap; default init is incorrect * [interop] do not add FlowFutureOps conformance when building flow clang module for Flow checked continuation header pre-generation * make sure to show -DUSE_LIBCXX=OFF in readme * readme updates * do not print to stderr * Update Swift and C++ code to build with latest Swift 5.9 toolchain now that we no longer support universal references and bridge the methods that take in a constant reference template parameter correctly * Fix SERVER_KNOBS and enable use them for masterserver * Bump to C++20, Swift is now able to handle it as well * Put waitForPrev behind FLOW_WITH_SWIFT knob * Forward declare updateLiveCommittedVersion * Remove unused code * fix wrong condition set for updateLiveCommittedVersion * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * Enable go-bindings in cmake * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * USE_SWIFT flag so we "build without swift" until ready to by default * uncomment a few tests which were disabled during USE_SWIFT enablement * the option is WITH_SWIFT, not USE * formatting * Fix masterserver compile error * Fix some build errors. How did it not merge cleanly? :/ * remove initializer list from constructor * Expect Swift toolchain only if WITH_SWIFT is enabled * Don't require Flow_CheckedContinuation when Swift is disabled * Don't compile FlowCheckedContinuation when WITH_SWIFT=OFF * No-op Swift macros * More compile guards * fix typo * Run clang-format * Guard swift/bridging include in fdbrpc * Remove printf to pass the test * Remove some more printf to avoid potential issues TODO: Need to be TraceEvents instead * Remove __has_feature(nullability) as its only used in Swift * Don't use __FILENAME__ * Don't call generate_module_map outside WITH_SWIFT * Add some more cmake stuff under WITH_SWIFT guard * Some more guards * Bring back TLSTest.cpp * clang-format * fix comment formatting * Remove unused command line arg * fix cmake formatting in some files * Address some review comments * fix clang-format error --------- Co-authored-by: Alex Lorenz <arphaman@gmail.com> Co-authored-by: Russell Sears <russell_sears@apple.com> Co-authored-by: Evan Wilde <etceterawilde@gmail.com> Co-authored-by: Alex Lorenz <aleksei_lorenz@apple.com> Co-authored-by: Vishesh Yadav <vishesh_yadav@apple.com> Co-authored-by: Vishesh Yadav <vishesh3y@gmail.com>
2023-06-03 05:09:28 +08:00
add_subdirectory(bindings)
endif()
2020-03-27 07:01:58 +08:00
endif()
2019-02-15 08:37:48 +08:00
if(WITH_DOCUMENTATION)
2019-02-09 05:46:50 +08:00
add_subdirectory(documentation)
2024-02-18 07:38:40 +08:00
add_dependencies(html CopyJavadoc)
2019-02-09 05:46:50 +08:00
endif()
2018-05-03 00:55:29 +08:00
2019-02-08 06:19:36 +08:00
if(WIN32)
add_subdirectory(packaging/msi)
else()
include(CPack)
endif()
2020-02-02 01:55:31 +08:00
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
add_link_options(-lexecinfo)
endif()
2018-05-03 00:55:29 +08:00
################################################################################
2018-05-04 06:48:10 +08:00
# process compile commands for IDE
2018-05-03 00:55:29 +08:00
################################################################################
if (CMAKE_EXPORT_COMPILE_COMMANDS AND WITH_PYTHON)
2018-05-03 00:55:29 +08:00
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json
2022-07-30 02:04:10 +08:00
COMMAND $<TARGET_FILE:Python3::Interpreter> ${CMAKE_CURRENT_SOURCE_DIR}/contrib/gen_compile_db.py
Introduce initial Swift support in fdbserver (#10156) * [fdbserver] workaround the FRT type layout issue to get Swfit getVersion working * MasterData.actor.h: fix comment typo * masterserver.swift: some tweaks * masterserver.swift: remove getVersion function, use the method * masterserver.swift: print replied version to output for tracing * [swift] add radar links for C++ interop issues found in getVersion bringup * Update fdbserver.actor.cpp * Migrate MasterData closer to full reference type This removes the workaround for the FRT type layout issue, and gets us closer to making MasterData a full reference type * [interop] require a new toolchain (>= Oct 19th) to build * [Swift] fix computation of toAdd for getVersion Swift implementation * add Swift to FDBClient and add async `atLeast` to NotifiedVersion * fix * use new atLeast API in master server * =build fixup link dependencies in swift fdbclient * clocks * +clock implement Clock using Flow's notion of time * [interop] workaround the immortal retain/release issue * [swift] add script to get latest centos toolchain * always install swift hooks; not only in "test" mode * simulator - first thing running WIP * cleanups * more cleanup * working snapshot * remove sim debug printlns * added convenience for whenAtLeast * try Alex's workaround * annotate nonnull * cleanup clock a little bit * fix missing impls after rebase * Undo the swift_lookup_Map_UID_CommitProxyVersionReplies workaround No longer needed - the issue was retain/release * [flow][swift] add Swift version of BUGGIFY * [swiftication] add CounterValue type to provide value semantics for Counter types on the Swift side * remove extraneous requestingProxyUID local * masterserver: initial Swift state prototype * [interop] make the Swiftied getVersion work * masterserver - remove the C++ implementation (it can't be supported as state is now missing) * Remove unnecessary SWIFT_CXX_REF_IMMORTAL annotations from Flow types * Remove C++ implementation of CommitProxyVersionReplies - it's in Swift now * [swift interop] remove more SWIFT_CXX_REF_IMMORTAL * [swift interop] add SWIFT_CXX_IMMORTAL_SINGLETON_TYPE annotation for semanticly meaningful immortal uses * rename SWIFT_CXX_REF_IMMORTAL -> UNSAFE_SWIFT_CXX_IMMORTAL_REF * Move master server waitForPrev to swift * =build fix linking swift in all modules * =build single link option * =cmake avoid manual math, just get "last" element from list * implement Streams support (#18) * [interop] update to new toolchain #6 * [interop] remove C++ vtable linking workarounds * [interop] make MasterData proper reference counted SWIFT_CXX_REF_MASTERDATA * [interop] use Swift array to pass UIDs to registerLastCommitProxyVersionReplies * [interop] expose MasterServer actor to C++ without wrapper struct * [interop] we no longer need expose on methods 🥳 * [interop] initial prototype of storing CheckedContinuation on the C++ side * Example of invoking a synchronous swift function from a C++ unit test. (#21) * move all "tests" we have in Swift, and priority support into real modules (#24) * Make set continuation functions inline * Split flow_swift into flow_swift and flow_swift_future to break circular dependency * rename SwiftContinuationCallbackStruct to FlowCallbackForSwiftContinuation * Future interop: use a method in a class template for continuation set call * Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30) * Basic Swift Guide (#29) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Revert "Revert "Merge pull request #22 from FoundationDB/cpp-continuation" (#30)" This reverts commit c025fe6258c4c4904d5e70cd549d408bb61f2802. * Restore the C++ continuation, but it seems waitValue is broken for CInt somehow now * disable broken tests - waitValue not accessible * Streams can be async iterated over (#27) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * remove work in progress things (#35) * remove some not used (yet) code * remove expose func for CInt, it's a primitive so we always have witness info (#37) * +masterdata implement provideVersions in Swift (#36) * serveLiveCommittedVersion in Swift (#38) * Port updateLiveCommittedVersion to swift (#33) Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com> * Implement updateRecoveryData in Swift (#39) Co-authored-by: Alex Lorenz <arphaman@gmail.com> * Simplify flow_swift to avoid multiple targets and generate separate CheckedContinuation header * Uncomment test which was blocked on extensions not being picked up (#31) * [interop] Use a separate target for Swift-to-C++ header generation * reduce boilerplate in future and stream support (#41) * [interop] require interop v8 - that will fix linker issue (https://github.com/apple/swift/issues/62448) * [interop] fix swift_stream_support.h Swift include * [interop] bump up requirement to version 9 * [interop] Generalize the Flow.Optional -> Swift.Optional conversion using generics * [WIP] masterServer func in Swift (#45) * [interop] Try conforms_to with a SWIFT_CONFORMS_TO macro for Optional conformance (#49) * [interop] include FlowOptionalProtocol source file when generating Flow_CheckedContinuation.h This header generation step depends on the import of the C++ Flow module, which requires the presence of FlowOptionalProtocol * conform Future to FlowFutureOps * some notes * move to value() so we can use discardable result for Flow.Void * make calling into Swift async funcs nicer by returning Flow Futures * [interop] hide initial use of FlowCheckedContinuation in flow.h to break dependency cycle * [fdbserver] fix an EncryptionOpsUtils.h modularization issue (showed up with modularized libc++) * Pass GCC toolchain using CMAKE_Swift_COMPILE_EXTERNAL_TOOLCHAIN to Swift's clang importer * [interop] drop the no longer needed libstdc++ include directories * [cmake] add a configuration check to ensure Swift can import C++ standard library * [swift] include msgpack from msgpack_DIR * [interop] make sure the FDB module maps have 'export' directive * add import 'flow_swift' to swift_fdbserver_cxx_swift_value_conformance.swift This is needed for CONFORMS_TO to work in imported modules * make sure the Swift -> C++ manually bridged function signature matches generated signature * [interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed * [interop] make getResolutionBalancer return a pointer to allow Swift to use it We should revert back to a reference once compiler allows references again * [interop] add a workaround for 'pop' being marked as unsafe in Swift * masterserver.swift: MasterData returns the Swift actor pointer in an unsafe manner * Add a 'getCopy' method to AsyncVar to make it more Swift friendly * [interop] bump up the toolchain requirement * Revert "[interop][workaround] force back use of @expose attribute before _Concurrency issue is fixed" This reverts commit b01b271a76d1677bbb7c5c9c64cdad4b8b2b9612. * [interop] add FIXME comments highlighting new issue workarounds * [interop] adopt the new C++ interoperability compiler flag * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * [interop] generate swift compile commands * Do not deduplicate Swift compilation commands * flow actorcompiler.h: add a SWIFT_ACTOR empty macro definition This is needed to make the actor files parsable by clangd * [cmake] add missing dependencies * experimental cross compile * [cmake] fix triple in cross-compiled cmake flags * [interop] update to interop toolchain version 16 * [x-compile] add flags for cross-compiling boost * cleanup x-compile cmake changes * [cmake] fix typo in CMAKE_Swift_COMPILER_EXTERNAL_TOOLCHAIN config variable * [interop] pass MasterDataActor from Swift to C++ and back to Swift * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * Update swift_get_latest_toolchain.sh to fetch 5.9 toochains * set HAVE_FLAG_SEARCH_PATHS_FIRST for cross compilation * Resolve conflicts in net2/sim2/actors, can't build yet * undo SWIFT_ACTOR changes, not necessary for merge * guard c++ compiler flags with is_cxx_compile * Update flow/actorcompiler/ActorParser.cs Co-authored-by: Evan Wilde <etceterawilde@gmail.com> * update the boost dependency * Include boost directory from the container for Swift * conform flow's Optional to FlowOptionalProtocol again * Guard entire RocksDBLogForwarder.h with SSD_ROCKSDB_EXPERIMENTAL to avoid failing on missing rocksdb APIs * remove extraneous merge marker * [swift] update swift_test_streams.swifto to use vars in more places * Add header guard to flow/include/flow/ThreadSafeQueue.h to fix moduralization issue * Update net and sim impls * [cmake] use prebuilt libc++ boost only when we're actually using libc++ * [fdbserver] Swift->C++ header generation for FDBServer should use same module cache path * fixups after merge * remove CustomStringConvertible conformance that would not be used * remove self-caused deprecation warnings in future_support * handle newly added task priority * reformatting * future: make value() not mutating * remove FIXME, not needed anymore * future: clarify why as functions * Support TraceEvent in Swift * Enable TraceEvent using a class wrapper in Swift * prearing WITH_SWIFT flag * wip disabled failing Go stuff * cleanup WITH_SWIFT_FLAG and reenable Go * wip disabled failing Go stuff * move setting flag before printing it * Add SWIFT_IDE_SETUP and cleanup guides and build a bit * Revert "Wipe packet buffers that held serialized WipedString (#10018)" This reverts commit e2df6e33029897360f8e11b3aea8fef97393a98c. * [Swift] Compile workaround in KeyBackedRangeMap; default init is incorrect * [interop] do not add FlowFutureOps conformance when building flow clang module for Flow checked continuation header pre-generation * make sure to show -DUSE_LIBCXX=OFF in readme * readme updates * do not print to stderr * Update Swift and C++ code to build with latest Swift 5.9 toolchain now that we no longer support universal references and bridge the methods that take in a constant reference template parameter correctly * Fix SERVER_KNOBS and enable use them for masterserver * Bump to C++20, Swift is now able to handle it as well * Put waitForPrev behind FLOW_WITH_SWIFT knob * Forward declare updateLiveCommittedVersion * Remove unused code * fix wrong condition set for updateLiveCommittedVersion * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * Enable go-bindings in cmake * Revert "Revert "Wipe packet buffers that held serialized WipedString (#10018)"" This reverts commit 5ad8dce0525fb1844664ed2ccd7ba595db6913dd. * USE_SWIFT flag so we "build without swift" until ready to by default * uncomment a few tests which were disabled during USE_SWIFT enablement * the option is WITH_SWIFT, not USE * formatting * Fix masterserver compile error * Fix some build errors. How did it not merge cleanly? :/ * remove initializer list from constructor * Expect Swift toolchain only if WITH_SWIFT is enabled * Don't require Flow_CheckedContinuation when Swift is disabled * Don't compile FlowCheckedContinuation when WITH_SWIFT=OFF * No-op Swift macros * More compile guards * fix typo * Run clang-format * Guard swift/bridging include in fdbrpc * Remove printf to pass the test * Remove some more printf to avoid potential issues TODO: Need to be TraceEvents instead * Remove __has_feature(nullability) as its only used in Swift * Don't use __FILENAME__ * Don't call generate_module_map outside WITH_SWIFT * Add some more cmake stuff under WITH_SWIFT guard * Some more guards * Bring back TLSTest.cpp * clang-format * fix comment formatting * Remove unused command line arg * fix cmake formatting in some files * Address some review comments * fix clang-format error --------- Co-authored-by: Alex Lorenz <arphaman@gmail.com> Co-authored-by: Russell Sears <russell_sears@apple.com> Co-authored-by: Evan Wilde <etceterawilde@gmail.com> Co-authored-by: Alex Lorenz <aleksei_lorenz@apple.com> Co-authored-by: Vishesh Yadav <vishesh_yadav@apple.com> Co-authored-by: Vishesh Yadav <vishesh3y@gmail.com>
2023-06-03 05:09:28 +08:00
ARGS -b ${CMAKE_CURRENT_BINARY_DIR} -s ${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json -ninjatool ${CMAKE_MAKE_PROGRAM} ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
2021-07-13 20:34:24 +08:00
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/gen_compile_db.py ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json
COMMENT "Build compile commands for IDE"
2018-05-03 00:55:29 +08:00
)
2019-05-16 09:33:58 +08:00
add_custom_target(processed_compile_commands ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json)
2024-07-11 07:04:28 +08:00
# A prebuild target ensures that all actors, Swift-generated headers, and Swift modules are built.
if (WITH_SWIFT)
add_custom_target(prebuild_for_ide ALL DEPENDS fdbserver_swift processed_compile_commands)
endif()
2018-05-03 00:55:29 +08:00
endif()
2019-02-08 14:18:31 +08:00
################################################################################
# Inform user which components we are going to build
################################################################################
print_components()
message(STATUS "CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL}")