foundationdb/cmake/FDBComponents.cmake

143 lines
5.0 KiB
CMake
Raw Normal View History

set(FORCE_ALL_COMPONENTS OFF CACHE BOOL "Fails cmake if not all dependencies are found")
2019-06-11 06:30:57 +08:00
################################################################################
# Valgrind
################################################################################
if(USE_VALGRIND)
find_package(Valgrind REQUIRED)
endif()
2019-02-08 14:18:31 +08:00
################################################################################
2020-02-14 06:42:45 +08:00
# SSL
2019-02-08 14:18:31 +08:00
################################################################################
2020-04-30 06:16:43 +08:00
include(CheckSymbolExists)
set(DISABLE_TLS OFF CACHE BOOL "Don't try to find OpenSSL and always build without TLS support")
2019-02-08 14:18:31 +08:00
if(DISABLE_TLS)
set(WITH_TLS OFF)
else()
2020-02-14 06:42:45 +08:00
set(OPENSSL_USE_STATIC_LIBS TRUE)
find_package(OpenSSL)
if(OPENSSL_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
2020-04-30 06:11:35 +08:00
check_symbol_exists("OPENSSL_INIT_NO_ATEXIT" "openssl/crypto.h" OPENSSL_HAS_NO_ATEXIT)
if(OPENSSL_HAS_NO_ATEXIT)
set(WITH_TLS ON)
add_compile_options(-DHAVE_OPENSSL)
else()
message(WARNING "An OpenSSL version was found, but it doesn't support OPENSSL_INIT_NO_ATEXIT - Will compile without TLS Support")
set(WITH_TLS OFF)
endif()
2019-02-08 14:18:31 +08:00
else()
message(STATUS "OpenSSL was not found - Will compile without TLS Support")
message(STATUS "You can set OPENSSL_ROOT_DIR to help cmake find it")
2019-02-08 14:18:31 +08:00
set(WITH_TLS OFF)
endif()
if(WIN32)
message(STATUS "TLS is temporarilty disabled on macOS while libressl -> openssl transition happens")
set(WITH_TLS OFF)
endif()
2019-02-08 14:18:31 +08:00
endif()
2019-02-10 14:08:34 +08:00
################################################################################
# Java Bindings
################################################################################
2019-02-15 08:37:48 +08:00
set(WITH_JAVA OFF)
find_package(JNI 1.8)
2019-02-10 14:08:34 +08:00
find_package(Java 1.8 COMPONENTS Development)
2020-02-02 02:13:41 +08:00
# leave FreeBSD JVM compat for later
if(JNI_FOUND AND Java_FOUND AND Java_Development_FOUND AND NOT (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD"))
2019-02-15 08:37:48 +08:00
set(WITH_JAVA ON)
2019-02-10 14:08:34 +08:00
include(UseJava)
enable_language(Java)
2019-02-11 02:30:18 +08:00
else()
2019-02-15 08:37:48 +08:00
set(WITH_JAVA OFF)
2019-02-10 14:08:34 +08:00
endif()
################################################################################
# Python Bindings
################################################################################
find_package(Python COMPONENTS Interpreter)
if(Python_Interpreter_FOUND)
set(WITH_PYTHON ON)
else()
#message(FATAL_ERROR "Could not found a suitable python interpreter")
2019-02-10 14:08:34 +08:00
set(WITH_PYTHON OFF)
endif()
################################################################################
# Pip
################################################################################
find_package(Python3 COMPONENTS Interpreter)
if (Python3_Interpreter_FOUND)
2019-02-15 08:37:48 +08:00
set(WITH_DOCUMENTATION ON)
2019-02-11 02:30:18 +08:00
else()
2019-02-15 08:37:48 +08:00
set(WITH_DOCUMENTATION OFF)
2019-02-10 14:08:34 +08:00
endif()
################################################################################
# GO
################################################################################
find_program(GO_EXECUTABLE go)
2019-02-11 04:48:15 +08:00
# building the go binaries is currently not supported on Windows
if(GO_EXECUTABLE AND NOT WIN32)
2019-02-10 14:08:34 +08:00
set(WITH_GO ON)
else()
set(WITH_GO OFF)
endif()
################################################################################
# Ruby
################################################################################
2019-02-11 04:48:15 +08:00
find_program(GEM_EXECUTABLE gem)
set(WITH_RUBY OFF)
2019-02-11 04:48:15 +08:00
if(GEM_EXECUTABLE)
set(GEM_COMMAND ${RUBY_EXECUTABLE} ${GEM_EXECUTABLE})
set(WITH_RUBY ON)
endif()
2020-06-11 05:07:49 +08:00
################################################################################
# RocksDB
################################################################################
set(SSD_ROCKSDB_EXPERIMENTAL OFF CACHE BOOL "Build with experimental RocksDB support")
2020-06-11 05:07:49 +08:00
if (SSD_ROCKSDB_EXPERIMENTAL)
set(WITH_ROCKSDB_EXPERIMENTAL ON)
else()
set(WITH_ROCKSDB_EXPERIMENTAL OFF)
2020-06-11 05:07:49 +08:00
endif()
################################################################################
2019-02-10 14:08:34 +08:00
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/packages)
add_custom_target(packages)
2019-02-08 14:18:31 +08:00
function(print_components)
2019-02-10 14:08:34 +08:00
message(STATUS "=========================================")
2019-02-08 14:18:31 +08:00
message(STATUS " Components Build Overview ")
2019-02-10 14:08:34 +08:00
message(STATUS "=========================================")
2019-02-15 08:37:48 +08:00
message(STATUS "Build Java Bindings: ${WITH_JAVA}")
2019-02-10 14:08:34 +08:00
message(STATUS "Build with TLS support: ${WITH_TLS}")
message(STATUS "Build Go bindings: ${WITH_GO}")
message(STATUS "Build Ruby bindings: ${WITH_RUBY}")
2019-02-10 14:08:34 +08:00
message(STATUS "Build Python sdist (make package): ${WITH_PYTHON}")
2019-02-15 08:37:48 +08:00
message(STATUS "Build Documentation (make html): ${WITH_DOCUMENTATION}")
message(STATUS "Build Bindings (depends on Python): ${WITH_PYTHON}")
message(STATUS "Configure CTest (depends on Python): ${WITH_PYTHON}")
2020-06-11 05:07:49 +08:00
message(STATUS "Build with RocksDB: ${WITH_ROCKSDB_EXPERIMENTAL}")
2019-02-10 14:08:34 +08:00
message(STATUS "=========================================")
2019-02-08 14:18:31 +08:00
endfunction()
if(FORCE_ALL_COMPONENTS)
2019-02-15 08:37:48 +08:00
if(NOT WITH_JAVA OR NOT WITH_TLS OR NOT WITH_GO OR NOT WITH_RUBY OR NOT WITH_PYTHON OR NOT WITH_DOCUMENTATION)
print_components()
message(FATAL_ERROR "FORCE_ALL_COMPONENTS is set but not all dependencies could be found")
endif()
endif()