Some more improvements to the build and preparations for packaging
This commit is contained in:
parent
f8eac70700
commit
df0f491c29
|
@ -99,9 +99,9 @@ endif()
|
|||
# we always compile with debug symbols. CPack will strip them out
|
||||
# and create a debuginfo rpm
|
||||
add_compile_options(-ggdb)
|
||||
find_package(Threads REQUIRED)
|
||||
set(USE_ASAN OFF CACHE BOOL "Compile with address sanitizer")
|
||||
if(USE_ASAN)
|
||||
find_package(Threads REQUIRED)
|
||||
add_compile_options(
|
||||
-fno-omit-frame-pointer -fsanitize=address
|
||||
-DUSE_ASAN)
|
||||
|
@ -203,6 +203,7 @@ execute_process(
|
|||
OUTPUT_VARIABLE FDB_PACKAGE_NAME_WNL)
|
||||
string(STRIP "${FDB_VERSION_WNL}" FDB_VERSION)
|
||||
string(STRIP "${FDB_PACKAGE_NAME_WNL}" FDB_PACKAGE_NAME)
|
||||
set(FDB_VERSION_PLAIN ${FDB_VERSION})
|
||||
if(NOT FDB_RELEASE)
|
||||
set(FDB_VERSION "${FDB_VERSION}-PRERELEASE")
|
||||
endif()
|
||||
|
@ -411,6 +412,12 @@ configure_file(fdb.cluster.cmake ${CMAKE_CURRENT_BINARY_DIR}/fdb.cluster)
|
|||
################################################################################
|
||||
enable_testing()
|
||||
|
||||
################################################################################
|
||||
# Directory structure
|
||||
################################################################################
|
||||
|
||||
include(cmake/InstallLayout.cmake)
|
||||
|
||||
################################################################################
|
||||
# components
|
||||
################################################################################
|
||||
|
@ -425,6 +432,8 @@ add_subdirectory(fdbmonitor)
|
|||
add_subdirectory(bindings)
|
||||
add_subdirectory(fdbbackup)
|
||||
|
||||
include(CPack)
|
||||
|
||||
################################################################################
|
||||
# process compile commands for IDE
|
||||
################################################################################
|
||||
|
@ -439,46 +448,3 @@ if (CMAKE_EXPORT_COMPILE_COMMANDS)
|
|||
)
|
||||
add_custom_target(procossed_compile_commands ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Install scripts
|
||||
################################################################################
|
||||
|
||||
#install(FILES scripts/log_writer.py DESTINATION lib/foundationdb COMPONENT server)
|
||||
install(FILES packaging/rpm/init_script/foundationdb
|
||||
DESTINATION /etc/rc.d/init.d
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ
|
||||
COMPONENT server)
|
||||
|
||||
install(FILES packaging/foundationdb.conf
|
||||
DESTINATION /etc/foundationdb
|
||||
COMPONENT server)
|
||||
|
||||
|
||||
################################################################################
|
||||
# Build RPM
|
||||
################################################################################
|
||||
|
||||
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DESCRIPTION ${CMAKE_CURRENT_BINARY_DIR}/DESCRIPTION)
|
||||
#
|
||||
#include (InstallRequiredSystemLibraries)
|
||||
#set(CPACK_GENERATOR RPM)
|
||||
#set(CPACK_RPM_server_USER_FILELIST "%config(noreplace) /etc/foundationdb/foundationdb.conf")
|
||||
#set(CPACK_RPM_DEBUGINFO_PACKAGE ON)
|
||||
#set(CPACK_RPM_PACKAGE_RELOCATABLE NO)
|
||||
#set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX /usr/src)
|
||||
#set(CPACK_RPM_COMPONENT_INSTALL ON)
|
||||
#set(CPACK_PACKAGE_NAME "foundationdb")
|
||||
#set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FoundationDB - A distributed key-value store with ACID transactions")
|
||||
#set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_BINARY_DIR}/DESCRIPTION)
|
||||
#set(CPACK_RESOURCE_FILE_LICENSE
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
#set(CPACK_PACKAGE_VERSION_MAJOR "${FDB_MAJOR}")
|
||||
#set(CPACK_PACKAGE_VERSION_MINOR "${FDB_MINOR}")
|
||||
#set(CPACK_PACKAGE_VERSION_PATCH "${FDB_REVISION}")
|
||||
#set(CPACK_RPM_clients_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/preinstall-client.sh)
|
||||
#set(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/preinstall-server.sh)
|
||||
#set(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/postinstall-server.sh)
|
||||
#
|
||||
#set(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/preuninstall-server.sh)
|
||||
#include (CPack)
|
||||
|
|
|
@ -41,6 +41,13 @@ target_include_directories(fdb_c PUBLIC
|
|||
# TODO: re-enable once the old vcxproj-based build system is removed.
|
||||
#generate_export_header(fdb_c EXPORT_MACRO_NAME "DLLEXPORT"
|
||||
# EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_export.h)
|
||||
install(TARGETS fdb_c DESTINATION lib64 COMPONENT clients)
|
||||
install(FILES foundationdb/fdb_c.h ${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_options.g.h ${CMAKE_SOURCE_DIR}/fdbclient/vexillographer/fdb.options
|
||||
DESTINATION include/foundationdb COMPONENT clients)
|
||||
install(TARGETS fdb_c
|
||||
EXPORT fdbc
|
||||
DESTINATION ${FDB_LIB_DIR}
|
||||
COMPONENT clients)
|
||||
install(
|
||||
FILES foundationdb/fdb_c.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/foundationdb/fdb_c_options.g.h
|
||||
${CMAKE_SOURCE_DIR}/fdbclient/vexillographer/fdb.options
|
||||
DESTINATION ${FDB_INCLUDE_INSTALL_DIR}/foundationdb COMPONENT clients)
|
||||
#install(EXPORT fdbc DESTINATION ${FDB_LIB_DIR}/foundationdb COMPONENT clients)
|
||||
|
|
|
@ -136,5 +136,5 @@ add_dependencies(fdb-java fdb_java_options fdb_java)
|
|||
add_jar(foundationdb-tests SOURCES ${JAVA_TESTS_SRCS} INCLUDE_JARS fdb-java)
|
||||
add_dependencies(foundationdb-tests fdb_java_options)
|
||||
|
||||
install_jar(fdb-java DESTINATION share/java COMPONENT clients)
|
||||
install(TARGETS fdb_java DESTINATION lib64 COMPONENT clients)
|
||||
install_jar(fdb-java DESTINATION ${FDB_SHARE_DIR}/java COMPONENT clients)
|
||||
install(TARGETS fdb_java DESTINATION ${FDB_LIB_DIR} COMPONENT clients)
|
||||
|
|
|
@ -24,22 +24,13 @@ foreach(src ${SRCS})
|
|||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "copy ${src}")
|
||||
set(out_files "${out_files};${PROJECT_BINARY_DIR}/bindings/python/${src}")
|
||||
if(${extname} STREQUAL ".py")
|
||||
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/bindings/python/${src}c
|
||||
COMMAND python -m py_compile ${PROJECT_BINARY_DIR}/bindings/python/${src}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${CMAKE_CURRENT_BINARY_DIR}/${src}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/bindings/python/${dirname}
|
||||
COMMENT "compile ${src}")
|
||||
set(out_files "${out_files};${PROJECT_BINARY_DIR}/bindings/python/${src}c")
|
||||
endif()
|
||||
endforeach()
|
||||
add_custom_target(python_binding ALL DEPENDS ${out_files})
|
||||
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/bindings/python/fdb)
|
||||
set(options_file ${PROJECT_BINARY_DIR}/bindings/python/fdb/fdboptions.py)
|
||||
add_custom_command(OUTPUT ${options_file} ${options_file}c
|
||||
add_custom_command(OUTPUT ${options_file}
|
||||
COMMAND ${MONO_EXECUTABLE} ${VEXILLOGRAPHER_EXE} ${CMAKE_SOURCE_DIR}/fdbclient/vexillographer/fdb.options python ${options_file}
|
||||
COMMAND python -m py_compile ${options_file}
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/fdbclient/vexillographer/fdb.options vexillographer
|
||||
COMMENT "Generate Python options")
|
||||
add_custom_target(fdb_python_options DEPENDS
|
||||
|
@ -49,5 +40,5 @@ add_custom_target(fdb_python_options DEPENDS
|
|||
|
||||
add_dependencies(python_binding fdb_python_options)
|
||||
|
||||
set(out_files "${out_files};${options_file};${options_file}c")
|
||||
install(FILES ${out_files} DESTINATION lib64/python2.6/site-packages/fdb COMPONENT clients)
|
||||
set(out_files "${out_files};${options_file}")
|
||||
install(FILES ${out_files} DESTINATION ${FDB_PYTHON_INSTALL_DIR} COMPONENT clients)
|
||||
|
|
|
@ -2,7 +2,7 @@ include(ExternalProject)
|
|||
ExternalProject_add(boostProject
|
||||
URL "https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2"
|
||||
URL_HASH SHA256=2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ./bootstrap.sh --with-libraries=system,python --with-python=${PYTHON_EXECUTABLE}
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ./bootstrap.sh --with-libraries=system
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} -E env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ./b2 link=static --user-config=${CMAKE_BINARY_DIR}/user-config.jam
|
||||
BUILD_IN_SOURCE ON
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
if(NOT INSTALL_LAYOUT)
|
||||
set(DEFAULT_INSTALL_LAYOUT "STANDALONE")
|
||||
endif()
|
||||
set(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
|
||||
CACHE STRING "Installation directory layout. Options are: TARGZ (as in tar.gz installer), WIN (as in zip installer), STANDALONE, RPM, DEB, OSX")
|
||||
|
||||
set(DIR_LAYOUT ${INSTALL_LAYOUT})
|
||||
if(DIR_LAYOUT MATCHES "TARGZ")
|
||||
set(DIR_LAYOUT "STANDALONE")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
|
||||
set(FDB_CONFIG_DIR "etc/foundationdb")
|
||||
if("${LIB64}" STREQUAL "TRUE")
|
||||
set(LIBSUFFIX 64)
|
||||
else()
|
||||
set(LIBSUFFIX "")
|
||||
endif()
|
||||
if(DIR_LAYOUT MATCHES "STANDALONE")
|
||||
set(FDB_LIB_DIR "lib${LIBSUFFIX}")
|
||||
set(FDB_LIBEXEC_DIR "${FDB_LIB_DIR}")
|
||||
set(FDB_BIN_DIR "bin")
|
||||
set(FDB_SBIN_DIR "sbin")
|
||||
set(FDB_INCLUDE_INSTALL_DIR "include")
|
||||
set(FDB_PYTHON_INSTALL_DIR "${FDB_LIB_DIR}/python2.7/site-packages/fdb")
|
||||
set(FDB_SHARE_DIR "share")
|
||||
elseif(DIR_LAYOUT MATCHES "OSX")
|
||||
set(CPACK_GENERATOR productbuild)
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
|
||||
set(FDB_LIB_DIR "usr/local/lib")
|
||||
set(FDB_LIBEXEC_DIR "usr/local/libexec")
|
||||
set(FDB_BIN_DIR "usr/local/bin")
|
||||
set(FDB_SBIN_DIR "usr/local/sbin")
|
||||
set(FDB_INCLUDE_INSTALL_DIR "usr/local/include")
|
||||
set(FDB_PYTHON_INSTALL_DIR "Library/Python/2.7/site-packages/fdb")
|
||||
set(FDB_SHARE_DIR "usr/local/share")
|
||||
else()
|
||||
# for deb and rpm
|
||||
set(CMAKE_INSTALL_PREFIX "/")
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/")
|
||||
set(FDB_LIB_DIR "usr/lib${LIBSUFFIX}")
|
||||
set(FDB_LIBEXEC_DIR "${FDB_LIB_DIR}")
|
||||
set(FDB_BIN_DIR "usr/bin")
|
||||
set(FDB_INCLUDE_INSTALL_DIR "usr/include")
|
||||
set(FDB_PYTHON_INSTALL_DIR "${FDB_LIB_DIR}/python2.7/site-packages/fdb")
|
||||
set(FDB_SHARE_DIR "usr/share")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
################################################################################
|
||||
# Version information
|
||||
################################################################################
|
||||
|
||||
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)
|
||||
|
||||
################################################################################
|
||||
# General CPack configuration
|
||||
################################################################################
|
||||
|
||||
set(CPACK_PACKAGE_NAME "foundationdb")
|
||||
set(CPACK_PACKAGE_VENDOR "FoundationDB Community")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${FDB_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${FDB_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${FDB_PATCH})
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/packaging/description)
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||
"FoundationDB is a scalable, fault-tolerant, ordered key-value store with full ACID transactions.")
|
||||
set(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/packaging/foundationdb.ico)
|
||||
if (INSTALL_LAYOUT MATCHES "OSX")
|
||||
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/packaging/osx/resources/conclusion.rtf)
|
||||
set(CPACK_PRODUCTBUILD_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/packaging/osx/resources)
|
||||
else()
|
||||
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
|
||||
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md)
|
||||
endif()
|
||||
|
||||
# configuration for rpm
|
||||
if(INSTALL_LAYOUT MATCHES "RPM")
|
||||
set(CPACK_RPM_server_USER_FILELIST "%config(noreplace) /etc/foundationdb/foundationdb.conf")
|
||||
set(CPACK_RPM_DEBUGINFO_PACKAGE ON)
|
||||
set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX /usr/src)
|
||||
set(CPACK_RPM_COMPONENT_INSTALL ON)
|
||||
#set(CPACK_RPM_clients_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/preinstall-client.sh)
|
||||
#set(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/preinstall-server.sh)
|
||||
#set(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/postinstall-server.sh)
|
||||
|
||||
#set(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/packaging/rpm/preuninstall-server.sh)
|
||||
elseif(INSTALL_LAYOUT MATCHES "OSX")
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
# Helper Macros
|
||||
################################################################################
|
||||
|
||||
macro(install_symlink filepath sympath compondent)
|
||||
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${filepath} ${sympath})" COMPONENT ${component})
|
||||
install(CODE "message(\"-- Created symlink: ${sympath} -> ${filepath}\")")
|
||||
endmacro()
|
||||
macro(install_mkdir dirname component)
|
||||
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dirname})" COMPONENT ${component})
|
||||
install(CODE "message(\"-- Created directory: ${dirname}\")")
|
||||
endmacro()
|
|
@ -5,3 +5,21 @@ actor_set(FDBBACKUP_BUILD "${FDBBACKUP_SRCS}")
|
|||
add_executable(fdbbackup "${FDBBACKUP_BUILD}")
|
||||
actor_compile(fdbbackup "${FDBBACKUP_SRCS}")
|
||||
target_link_libraries(fdbbackup PRIVATE fdbclient)
|
||||
|
||||
install(TARGETS fdbbackup DESTINATION ${FDB_BIN_DIR} COMPONENT server)
|
||||
install(PROGRAMS $<TARGET_FILE:fdbbackup>
|
||||
DESTINATION ${FDB_LIB_DIR}/foundationdb/backup_agent
|
||||
RENAME backup_agent
|
||||
COMPONENT clients)
|
||||
install(PROGRAMS $<TARGET_FILE:fdbbackup>
|
||||
DESTINATION ${FDB_BIN_DIR}
|
||||
RENAME fdbrestore
|
||||
COMPONENT clients)
|
||||
install(PROGRAMS $<TARGET_FILE:fdbbackup>
|
||||
DESTINATION ${FDB_BIN_DIR}
|
||||
RENAME dr_agent
|
||||
COMPONENT clients)
|
||||
install(PROGRAMS $<TARGET_FILE:fdbbackup>
|
||||
DESTINATION ${FDB_BIN_DIR}
|
||||
RENAME fdbdr
|
||||
COMPONENT clients)
|
||||
|
|
|
@ -9,3 +9,5 @@ actor_set(FDBCLI_BUILD "${FDBCLI_SRCS}")
|
|||
add_executable(fdbcli "${FDBCLI_BUILD}")
|
||||
actor_compile(fdbcli "${FDBCLI_SRCS}")
|
||||
target_link_libraries(fdbcli PRIVATE fdbclient)
|
||||
|
||||
install(TARGETS fdbcli DESTINATION ${FDB_BIN_DIR} COMPONENT clients)
|
||||
|
|
|
@ -3,4 +3,4 @@ set(FDBMONITOR_SRCS ConvertUTF.h SimpleIni.h fdbmonitor.cpp)
|
|||
add_executable(fdbmonitor ${FDBMONITOR_SRCS})
|
||||
target_link_libraries(fdbmonitor flow)
|
||||
|
||||
install(TARGETS fdbmonitor DESTINATION lib/foundationdb COMPONENT server)
|
||||
install(TARGETS fdbmonitor DESTINATION "${FDB_LIB_DIR}/foundationdb" COMPONENT server)
|
||||
|
|
|
@ -172,3 +172,5 @@ target_include_directories(fdbserver PRIVATE
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/workloads)
|
||||
target_link_libraries(fdbserver PRIVATE fdbclient)
|
||||
|
||||
install(TARGETS fdbserver DESTINATION ${FDB_SBIN_DIR} COMPONENT server)
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ if (NOT APPLE)
|
|||
set (FLOW_LIBS ${FLOW_LIBS} rt)
|
||||
endif()
|
||||
target_link_libraries(flow PRIVATE ${FLOW_LIBS})
|
||||
target_link_libraries(flow PUBLIC boost_system)
|
||||
target_link_libraries(flow PUBLIC boost_system Threads::Threads ${CMAKE_DL_LIBS})
|
||||
|
||||
if(APPLE)
|
||||
find_library(IO_KIT IOKit)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
FoundationDB is a scalable, fault-tolerant, ordered key-value store
|
||||
with full ACID transactions.
|
||||
|
Loading…
Reference in New Issue