add missing config checks to CMakeLists.txt
Summary: Bring CMakeLists.txt back up to parity with build_detect_platform. Closes https://github.com/facebook/rocksdb/pull/3211 Differential Revision: D6452908 Pulled By: ajkr fbshipit-source-id: 93f5f336ad7eff6ecf65dec47bfaf114dd24cfb2
This commit is contained in:
parent
fad14050ae
commit
3e40a5e832
@ -249,6 +249,20 @@ if(WITH_UBSAN)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
find_package(NUMA)
|
||||||
|
if(NUMA_FOUND)
|
||||||
|
add_definitions(-DNUMA)
|
||||||
|
include_directories(${NUMA_INCLUDE_DIR})
|
||||||
|
list(APPEND THIRDPARTY_LIBS ${NUMA_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(TBB)
|
||||||
|
if(TBB_FOUND)
|
||||||
|
add_definitions(-DTBB)
|
||||||
|
include_directories(${TBB_INCLUDE_DIR})
|
||||||
|
list(APPEND THIRDPARTY_LIBS ${TBB_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Used to run CI build and tests so we can run faster
|
# Used to run CI build and tests so we can run faster
|
||||||
set(OPTIMIZE_DEBUG_DEFAULT 0) # Debug build is unoptimized by default use -DOPTDBG=1 to optimize
|
set(OPTIMIZE_DEBUG_DEFAULT 0) # Debug build is unoptimized by default use -DOPTDBG=1 to optimize
|
||||||
|
|
||||||
@ -316,11 +330,8 @@ if(NOT WIN32)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(WITH_FALLOCATE "build with fallocate" ON)
|
option(WITH_FALLOCATE "build with fallocate" ON)
|
||||||
|
|
||||||
if(WITH_FALLOCATE)
|
if(WITH_FALLOCATE)
|
||||||
set(CMAKE_REQUIRED_FLAGS ${CMAKE_C_FLAGS})
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
include(CheckCSourceCompiles)
|
|
||||||
CHECK_C_SOURCE_COMPILES("
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/falloc.h>
|
#include <linux/falloc.h>
|
||||||
int main() {
|
int main() {
|
||||||
@ -333,12 +344,38 @@ int main() {
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckFunctionExists)
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
CHECK_FUNCTION_EXISTS(malloc_usable_size HAVE_MALLOC_USABLE_SIZE)
|
#include <fcntl.h>
|
||||||
|
int main() {
|
||||||
|
int fd = open(\"/dev/null\", 0);
|
||||||
|
sync_file_range(fd, 0, 1024, SYNC_FILE_RANGE_WRITE);
|
||||||
|
}
|
||||||
|
" HAVE_SYNC_FILE_RANGE_WRITE)
|
||||||
|
if(HAVE_SYNC_FILE_RANGE_WRITE)
|
||||||
|
add_definitions(-DROCKSDB_RANGESYNC_PRESENT)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("
|
||||||
|
#include <pthread.h>
|
||||||
|
int main() {
|
||||||
|
(void) PTHREAD_MUTEX_ADAPTIVE_NP;
|
||||||
|
}
|
||||||
|
" HAVE_PTHREAD_MUTEX_ADAPTIVE_NP)
|
||||||
|
if(HAVE_PTHREAD_MUTEX_ADAPTIVE_NP)
|
||||||
|
add_definitions(-DROCKSDB_PTHREAD_ADAPTIVE_MUTEX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(CheckCXXSymbolExists)
|
||||||
|
check_cxx_symbol_exists(malloc_usable_size malloc.h HAVE_MALLOC_USABLE_SIZE)
|
||||||
if(HAVE_MALLOC_USABLE_SIZE)
|
if(HAVE_MALLOC_USABLE_SIZE)
|
||||||
add_definitions(-DROCKSDB_MALLOC_USABLE_SIZE)
|
add_definitions(-DROCKSDB_MALLOC_USABLE_SIZE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
check_cxx_symbol_exists(sched_getcpu sched.h HAVE_SCHED_GETCPU)
|
||||||
|
if(HAVE_SCHED_GETCPU)
|
||||||
|
add_definitions(-DROCKSDB_SCHED_GETCPU_PRESENT)
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR})
|
include_directories(${PROJECT_SOURCE_DIR})
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||||
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src)
|
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src)
|
||||||
|
21
cmake/modules/FindNUMA.cmake
Normal file
21
cmake/modules/FindNUMA.cmake
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# - Find NUMA
|
||||||
|
# Find the NUMA library and includes
|
||||||
|
#
|
||||||
|
# NUMA_INCLUDE_DIR - where to find numa.h, etc.
|
||||||
|
# NUMA_LIBRARIES - List of libraries when using NUMA.
|
||||||
|
# NUMA_FOUND - True if NUMA found.
|
||||||
|
|
||||||
|
find_path(NUMA_INCLUDE_DIR
|
||||||
|
NAMES numa.h numaif.h
|
||||||
|
HINTS ${NUMA_ROOT_DIR}/include)
|
||||||
|
|
||||||
|
find_library(NUMA_LIBRARIES
|
||||||
|
NAMES numa
|
||||||
|
HINTS ${NUMA_ROOT_DIR}/lib)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(NUMA DEFAULT_MSG NUMA_LIBRARIES NUMA_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
NUMA_LIBRARIES
|
||||||
|
NUMA_INCLUDE_DIR)
|
21
cmake/modules/FindTBB.cmake
Normal file
21
cmake/modules/FindTBB.cmake
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# - Find TBB
|
||||||
|
# Find the Thread Building Blocks library and includes
|
||||||
|
#
|
||||||
|
# TBB_INCLUDE_DIR - where to find tbb.h, etc.
|
||||||
|
# TBB_LIBRARIES - List of libraries when using TBB.
|
||||||
|
# TBB_FOUND - True if TBB found.
|
||||||
|
|
||||||
|
find_path(TBB_INCLUDE_DIR
|
||||||
|
NAMES tbb/tbb.h
|
||||||
|
HINTS ${TBB_ROOT_DIR}/include)
|
||||||
|
|
||||||
|
find_library(TBB_LIBRARIES
|
||||||
|
NAMES tbb
|
||||||
|
HINTS ${TBB_ROOT_DIR}/lib)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARIES TBB_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
TBB_LIBRARIES
|
||||||
|
TBB_INCLUDE_DIR)
|
Loading…
Reference in New Issue
Block a user