Commit b64910ce authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-12452 MDEV-12453 : Fix building rocksdb and aws_key_management on macOS

use  CMAKE_CXX_STANDARD to set C++11 flags  with CMake 3.1+ (apples flags are somehow different from standard clang)
port htonbe16/32/64 macros for rocksdb
use reinterpret_cast<size_t> to cast macOS's pthread_t (pointer type) to  size_t , for rocksdb
parent 428a922c
......@@ -50,7 +50,6 @@ ENDIF()
FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
SET(CMAKE_REQUIRED_FLAGS ${CXX11_FLAGS})
FIND_PATH(AWS_CPP_SDK_INCLUDE_DIR NAMES aws/kms/KMSClient.h)
IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND AWS_CPP_SDK_INCLUDE_DIR)
......@@ -121,6 +120,7 @@ ELSE()
-DBUILD_ONLY=kms
-DBUILD_SHARED_LIBS=OFF
-DFORCE_SHARED_CRT=OFF
-DENABLE_TESTING=OFF
"-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} ${PIC_FLAG}"
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}"
"-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}"
......@@ -140,7 +140,11 @@ ELSE()
ENDIF()
ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
IF(CMAKE_VERSION GREATER "3.0")
SET(CMAKE_CXX_STANDARD 11)
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
ENDIF()
IF(WIN32)
SET(AWS_CPP_SDK_DEPENDENCIES bcrypt winhttp wininet userenv version)
ELSE()
......
......@@ -54,7 +54,9 @@ ELSE()
SKIP_ROCKSDB_PLUGIN("Compiler not supported")
ENDIF()
IF(CXX11_FLAGS)
IF(CMAKE_VERSION GREATER 3.0)
SET(CMAKE_CXX_STANDARD 11)
ELSEIF(CXX11_FLAGS)
ADD_DEFINITIONS(${CXX11_FLAGS})
ENDIF()
......
......@@ -29,10 +29,6 @@ else()
endif()
endif()
include (CheckTypeSize)
check_type_size(size_t SIZEOF_SIZE_T)
set_property(SOURCE ha_rocksdb.cc APPEND PROPERTY COMPILE_DEFINITIONS
SIZEOF_SIZE_T=${SIZEOF_SIZE_T} SIZEOF_UINT64_T=8)
# Optional compression libraries.
......
......@@ -30,6 +30,16 @@
#define be16toh _byteswap_ushort
#endif
#if __APPLE__
#include <libkern/OSByteOrder.h>
#define htobe64(x) OSSwapHostToBigInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define htobe16(x) OSSwapHostToBigInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#endif
namespace myrocks {
/*
......
......@@ -78,7 +78,7 @@ struct thread_id_indexer_t : public generic_indexer_t<Type, N> {
thread id is represented as a pointer, it may not work as
effectively. */
size_t get_rnd_index() const {
return get_curr_thread_id();
return reinterpret_cast<size_t>(get_curr_thread_id());
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment