2018-05-03 00:55:29 +08:00
|
|
|
#
|
2018-12-14 09:39:51 +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-2018 Apple Inc. and the FoundationDB project authors
|
|
|
|
#
|
|
|
|
# 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)
|
2021-07-08 17:42:16 +08:00
|
|
|
|
2022-09-13 01:03:40 +08:00
|
|
|
# silence deprecation warnings in newer versions of cmake
|
|
|
|
if(POLICY CMP0135)
|
|
|
|
cmake_policy(SET CMP0135 NEW)
|
|
|
|
endif()
|
|
|
|
|
2019-02-09 06:10:13 +08:00
|
|
|
project(foundationdb
|
2022-11-10 20:01:41 +08:00
|
|
|
VERSION 7.3.0
|
2019-01-03 05:32:26 +08:00
|
|
|
DESCRIPTION "FoundationDB is a scalable, fault-tolerant, ordered key-value store with full ACID transactions."
|
|
|
|
HOMEPAGE_URL "http://www.foundationdb.org/"
|
2019-02-28 08:54:41 +08:00
|
|
|
LANGUAGES C CXX ASM)
|
2018-05-03 00:55:29 +08:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake")
|
|
|
|
message (STATUS "${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}")
|
|
|
|
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
|
2019-05-21 06:51:52 +08:00
|
|
|
message(FATAL_ERROR "In-source builds are forbidden")
|
2018-05-03 00:55:29 +08:00
|
|
|
endif()
|
|
|
|
|
2019-09-26 13:10:02 +08:00
|
|
|
set(OPEN_FOR_IDE OFF CACHE BOOL "Open this in an IDE (won't compile/link)")
|
|
|
|
|
2018-05-03 00:55:29 +08:00
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
2019-09-26 13:10:02 +08:00
|
|
|
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()
|
|
|
|
|
2019-01-03 13:19:08 +08:00
|
|
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
|
|
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
2018-05-03 00:55:29 +08:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Packages used for bindings
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
|
|
|
|
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
|
|
|
################################################################################
|
|
|
|
# Compiler configuration
|
|
|
|
################################################################################
|
|
|
|
|
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}
|
2020-09-11 02:06:56 +08:00
|
|
|
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
|
|
|
|
################################################################################
|
2021-11-24 01:35:30 +08:00
|
|
|
if (FDB_RELEASE_CANDIDATE)
|
2021-11-30 03:35:52 +08:00
|
|
|
set(FDB_RELEASE_CANDIDATE_VERSION 1 CACHE STRING "release candidate version")
|
|
|
|
set(FDB_VERSION ${PROJECT_VERSION}-rc${FDB_RELEASE_CANDIDATE_VERSION})
|
2021-11-24 01:35:30 +08:00
|
|
|
else()
|
|
|
|
set(FDB_VERSION ${PROJECT_VERSION})
|
|
|
|
endif()
|
2022-04-09 04:00:57 +08:00
|
|
|
if (NOT FDB_RELEASE)
|
2023-02-17 05:54:02 +08:00
|
|
|
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")
|
2022-04-09 04:00:57 +08:00
|
|
|
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})
|
2021-11-24 01:35:30 +08:00
|
|
|
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}")
|
2021-11-11 10:00:07 +08:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/versions.target.cmake ${CMAKE_CURRENT_BINARY_DIR}/versions.target)
|
2021-11-24 01:35:30 +08:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/version.txt ${FDB_VERSION})
|
2019-01-03 05:32:26 +08:00
|
|
|
|
2022-11-25 20:16:33 +08:00
|
|
|
set(FDB_CURRENT_VERSION ${PROJECT_VERSION})
|
|
|
|
set(FDB_FUTURE_VERSION "7.4.0")
|
|
|
|
set(FDB_PREV_RELEASE_VERSION "7.1.25")
|
|
|
|
set(FDB_PREV2_RELEASE_VERSION "7.0.0")
|
|
|
|
set(FDB_PREV3_RELEASE_VERSION "6.3.25")
|
|
|
|
|
2018-05-03 00:55:29 +08:00
|
|
|
################################################################################
|
2019-01-03 05:32:26 +08:00
|
|
|
# Flow
|
2018-05-03 00:55:29 +08:00
|
|
|
################################################################################
|
|
|
|
|
2022-06-24 04:37:35 +08:00
|
|
|
include(utils)
|
|
|
|
|
2019-02-09 08:51:13 +08:00
|
|
|
# Flow and other tools are written in C# - so we need that dependency
|
2019-02-11 04:48:15 +08:00
|
|
|
include(EnableCsharp)
|
2019-02-09 08:51:13 +08:00
|
|
|
|
2019-01-03 05:32:26 +08:00
|
|
|
# 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
|
|
|
|
2019-02-09 08:51:13 +08:00
|
|
|
include(CompileCoverageTool)
|
|
|
|
|
2019-01-03 05:32:26 +08:00
|
|
|
# with the actor compiler, we can now make the flow commands available
|
|
|
|
include(FlowCommands)
|
2018-05-03 00:55:29 +08:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Vexilographer
|
|
|
|
################################################################################
|
|
|
|
|
2019-01-03 05:32:26 +08:00
|
|
|
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
|
|
|
|
################################################################################
|
|
|
|
enable_testing()
|
|
|
|
|
2018-05-06 00:43:50 +08:00
|
|
|
################################################################################
|
|
|
|
# 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)
|
2021-06-04 06:10:04 +08:00
|
|
|
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)
|
2018-05-04 07:06:30 +08:00
|
|
|
add_subdirectory(fdbcli)
|
2019-02-07 11:27:38 +08:00
|
|
|
if(NOT WIN32)
|
|
|
|
add_subdirectory(fdbmonitor)
|
|
|
|
else()
|
|
|
|
add_subdirectory(fdbservice)
|
|
|
|
endif()
|
2018-05-04 07:06:30 +08:00
|
|
|
add_subdirectory(fdbbackup)
|
2019-01-23 06:25:20 +08:00
|
|
|
add_subdirectory(tests)
|
2020-10-11 06:02:26 +08:00
|
|
|
add_subdirectory(flowbench EXCLUDE_FROM_ALL)
|
2021-08-05 21:31:15 +08:00
|
|
|
if(WITH_PYTHON AND WITH_C_BINDING)
|
2020-03-27 07:01:58 +08:00
|
|
|
add_subdirectory(bindings)
|
|
|
|
endif()
|
2019-02-15 08:37:48 +08:00
|
|
|
if(WITH_DOCUMENTATION)
|
2019-02-09 05:46:50 +08:00
|
|
|
add_subdirectory(documentation)
|
|
|
|
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()
|
2018-05-06 00:43:50 +08:00
|
|
|
|
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
|
|
|
################################################################################
|
2020-02-10 00:34:52 +08:00
|
|
|
if (CMAKE_EXPORT_COMPILE_COMMANDS AND WITH_PYTHON)
|
2018-05-03 00:55:29 +08:00
|
|
|
add_custom_command(
|
2020-02-10 00:34:52 +08:00
|
|
|
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
|
2020-02-10 00:34:52 +08:00
|
|
|
ARGS -b ${CMAKE_CURRENT_BINARY_DIR} -s ${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json ${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
|
2020-02-10 00:34:52 +08:00
|
|
|
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)
|
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()
|
2019-02-11 12:51:36 +08:00
|
|
|
|
|
|
|
message(STATUS "CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL}")
|