diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/aws_sdk.cmake | 95 | ||||
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 3 | ||||
-rw-r--r-- | cmake/cpack_rpm.cmake | 2 | ||||
-rw-r--r-- | cmake/make_dist.cmake.in | 8 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 19 | ||||
-rw-r--r-- | cmake/os/WindowsCache.cmake | 1 | ||||
-rw-r--r-- | cmake/readline.cmake | 2 | ||||
-rw-r--r-- | cmake/submodules.cmake | 8 | ||||
-rw-r--r-- | cmake/wsrep.cmake | 37 |
9 files changed, 156 insertions, 19 deletions
diff --git a/cmake/aws_sdk.cmake b/cmake/aws_sdk.cmake new file mode 100644 index 00000000000..92e1e78ad3f --- /dev/null +++ b/cmake/aws_sdk.cmake @@ -0,0 +1,95 @@ +MACRO (SKIP_AWS_SDK MSG) + SET(${RETVAL} OFF PARENT_SCOPE) + SET(${REASON} ${MSG} PARENT_SCOPE) + RETURN() +ENDMACRO() + +FUNCTION (CHECK_AWS_SDK RETVAL REASON) + # AWS_SDK_EXTERNAL_PROJECT must be ON + IF(NOT AWS_SDK_EXTERNAL_PROJECT) + SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON") + ENDIF() + IF(NOT NOT_FOR_DISTRIBUTION) + SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it") + ENDIF() + # Check compiler support + IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + IF (GCC_VERSION VERSION_LESS 4.8) + SKIP_AWS_SDK("GCC VERSION too old (${GCC_VERSION}, required is 4.8 or later") + ENDIF() + ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR + (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3)) + SKIP_AWS_SDK("Clang version too old, required is 3.3 or later") + ENDIF() + ELSEIF(MSVC) + IF (MSVC_VERSION LESS 1800) + SKIP_AWS_SDK("MSVC version too old, required is VS2015 or later") + ENDIF() + ELSE() + SKIP_AWS_SDK("Unsupported compiler") + ENDIF() + + # Check OS support + IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux"))) + SKIP_AWS_SDK("OS unsupported by AWS SDK") + ENDIF() + + # Build from source, using ExternalProject_Add + # AWS C++ SDK requires cmake 2.8.12 + IF(CMAKE_VERSION VERSION_LESS "2.8.12") + SKIP_AWS_SDK("CMake is too old") + ENDIF() + + IF(UNIX) + # Check librairies required for building SDK + FIND_PACKAGE(CURL) + IF(NOT CURL_FOUND) + SKIP_AWS_SDK("AWS C++ SDK requires libcurl development package") + ENDIF() + FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h) + IF(NOT UUID_INCLUDE_DIR) + SKIP_AWS_SDK("AWS C++ SDK requires uuid development package") + ENDIF() + IF(NOT APPLE) + FIND_LIBRARY(UUID_LIBRARIES uuid) + IF(NOT UUID_LIBRARIES) + SKIP_AWS_SDK("AWS C++ SDK requires uuid development package") + ENDIF() + FIND_PACKAGE(OpenSSL) + IF(NOT OPENSSL_FOUND) + SKIP_AWS_SDK("AWS C++ SDK requires openssl development package") + ENDIF() + ENDIF() + ENDIF() + SET(${RETVAL} ON PARENT_SCOPE) +ENDFUNCTION() + + +# USE_AWS_SDK_LIBS(target sdk_component1 ... sdk_component_N) +# Example usage +# USE_AWS_SDK_LIBS(aws_key_management kms s3) +FUNCTION(USE_AWS_SDK_LIBS) + SET(SDK_COMPONENTS ${ARGN}) + LIST(GET SDK_COMPONENTS 0 target) + IF(NOT TARGET ${target}) + MESSAGE(FATAL_ERROR "${target} is not a valid target") + ENDIF() + SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" CACHE INTERNAL "") + LIST(REMOVE_AT SDK_COMPONENTS 0) + FOREACH(comp ${SDK_COMPONENTS}) + SET_PROPERTY(GLOBAL PROPERTY AWS_SDK_LIBS ${comp} APPEND) + TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-${comp}) + ENDFOREACH() + TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-core) + TARGET_INCLUDE_DIRECTORIES(${target} PRIVATE ${PROJECT_BINARY_DIR}/aws_sdk/aws_sdk_cpp/include) + # Link OS libraries that AWS SDK depends on + IF(WIN32) + TARGET_LINK_LIBRARIES(${target} bcrypt winhttp wininet userenv version) + ELSE() + FIND_PACKAGE(CURL REQUIRED) + FIND_PACKAGE(OpenSSL REQUIRED) + TARGET_LINK_LIBRARIES(${target} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES}) + ENDIF() +ENDFUNCTION() diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index a6eb8fad3d2..466255ad7d1 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -97,17 +97,20 @@ ELSEIF(RPM) SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "") SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "") SET(WITH_LIBARCHIVE ON CACHE STRING "") + SET(PLUGIN_AUTH_SOCKET YES) ELSEIF(DEB) SET(WITH_SSL system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "") SET(WITH_LIBWRAP ON) SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) SET(WITH_LIBARCHIVE ON CACHE STRING "") + SET(PLUGIN_AUTH_SOCKET YES) ELSE() SET(WITH_SSL bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "") SET(WITH_LIBARCHIVE STATIC CACHE STRING "") + SET(PLUGIN_AUTH_SOCKET STATIC) ENDIF() IF(NOT COMPILATION_COMMENT) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 36d426257ea..19293e9a176 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -171,7 +171,7 @@ SETA(CPACK_RPM_server_PACKAGE_REQUIRES IF(WITH_WSREP) SETA(CPACK_RPM_server_PACKAGE_REQUIRES - "galera" "rsync" "lsof" "grep" "gawk" "iproute" + "galera-4" "rsync" "lsof" "grep" "gawk" "iproute" "coreutils" "findutils" "tar") ENDIF() diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 6fad17137fd..8e77b700eb7 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -50,6 +50,14 @@ IF(GIT_EXECUTABLE) IF(NOT RESULT EQUAL 0) SET(GIT_EXECUTABLE) ENDIF() + EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/wsrep-lib/$path/" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wsrep-lib + RESULT_VARIABLE RESULT + ) + IF(NOT RESULT EQUAL 0) + SET(GIT_EXECUTABLE) + ENDIF() ENDIF() CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index d7e748a6d71..44a9c2e823c 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -96,7 +96,8 @@ IF(MSVC) # Disable mingw based pkg-config found in Strawberry perl SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "") - SET(MSVC_CRT_TYPE /MT CACHE STRING + + SET(MSVC_CRT_TYPE /MD CACHE STRING "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" ) SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) @@ -106,9 +107,7 @@ IF(MSVC) IF(MSVC_CRT_TYPE MATCHES "/MD") # Dynamic runtime (DLLs), need to install CRT libraries. - SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)# upgrade wizard SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS TRUE) SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) IF(MSVC_CRT_TYPE STREQUAL "/MDd") SET (CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE) @@ -277,3 +276,17 @@ ENDIF() SET(FN_NO_CASE_SENSE 1) SET(USE_SYMDIR 1) + +# Force static C runtime for targets in current directory +# (useful to get rid of MFC dll's dependency, or in installer) +MACRO(FORCE_STATIC_CRT) + FOREACH(flag + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT + CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT + CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL + ) + STRING(REGEX REPLACE "/MD[d]?" "/MT" "${flag}" "${${flag}}" ) + ENDFOREACH() +ENDMACRO() diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 2ba3aec16b4..f51015e436c 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -153,6 +153,7 @@ SET(HAVE_SIGSET CACHE INTERNAL "") SET(HAVE_SIGTERM 1 CACHE INTERNAL "") SET(HAVE_SIGTHREADMASK CACHE INTERNAL "") SET(HAVE_SIGWAIT CACHE INTERNAL "") +SET(HAVE_SIGWAITINFO CACHE INTERNAL "") SET(HAVE_SIZEOF_CHARP TRUE CACHE INTERNAL "") SET(SIZEOF_CHARP ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "") SET(HAVE_SIZEOF_IN6_ADDR TRUE CACHE INTERNAL "") diff --git a/cmake/readline.cmake b/cmake/readline.cmake index f1c6f62e311..f7a5291135c 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -134,7 +134,7 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE) SET(USE_NEW_READLINE_INTERFACE 1) ELSE() IF(NOT_FOR_DISTRIBUTION) - SET(NON_DISTRIBUTABLE_WARNING "GPLv3") + SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "") SET(USE_NEW_READLINE_INTERFACE 1) ELSE() SET(USE_NEW_READLINE_INTERFACE 0) diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake index 34d1f37c956..c8f7b3cc400 100644 --- a/cmake/submodules.cmake +++ b/cmake/submodules.cmake @@ -19,16 +19,16 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") SET(update_result 0) ELSEIF (cmake_update_submodules MATCHES force) MESSAGE(STATUS "Updating submodules (forced)") - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE update_result) ELSEIF (cmake_update_submodules MATCHES yes) - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE update_result) ELSE() MESSAGE(STATUS "Updating submodules") - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE update_result) ENDIF() @@ -36,6 +36,6 @@ ENDIF() IF(update_result OR NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt) MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run - ${GIT_EXECUTABLE} submodule update --init + ${GIT_EXECUTABLE} submodule update --init --recursive Then restart the build.${SUBMODULE_UPDATE_CONFIG_MESSAGE}") ENDIF() diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index b272df51adb..603f1955e5f 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -24,20 +24,37 @@ ELSE() ENDIF() OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default}) +OPTION(WITH_WSREP_ALL + "Build all components of WSREP (unit tests, sample programs)" + OFF) -# Set the patch version -SET(WSREP_PATCH_VERSION "24") +IF(WITH_WSREP) + # Set the patch version + SET(WSREP_PATCH_VERSION "22") -# Obtain wsrep API version -FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION - LIMIT_COUNT 1 REGEX "WSREP_INTERFACE_VERSION") -STRING(REGEX MATCH "([0-9]+)" WSREP_API_VERSION "${WSREP_API_VERSION}") + IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26/wsrep_api.h") + MESSAGE(FATAL_ERROR "No MariaDB wsrep-API code! Run + ${GIT_EXECUTABLE} submodule update --init --recursive +Then restart the build. +") + ENDIF() + # Obtain wsrep API version + FILE(STRINGS "${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26/wsrep_api.h" WSREP_API_VERSION + LIMIT_COUNT 1 REGEX "WSREP_INTERFACE_VERSION") + STRING(REGEX MATCH "([0-9]+)" WSREP_API_VERSION "${WSREP_API_VERSION}") -SET(WSREP_VERSION "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}" - CACHE INTERNAL "WSREP version") + SET(WSREP_VERSION "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}" + CACHE INTERNAL "WSREP version") -SET(WSREP_PROC_INFO ${WITH_WSREP}) + SET(WSREP_PROC_INFO ${WITH_WSREP}) -IF(WITH_WSREP) SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}") + if (NOT WITH_WSREP_ALL) + SET(WSREP_LIB_WITH_UNIT_TESTS OFF CACHE BOOL + "Disable unit tests for wsrep-lib") + SET(WSREP_LIB_WITH_DBSIM OFF CACHE BOOL + "Disable building dbsim for wsrep-lib") + endif() + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/include) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26) ENDIF() |