Commit cadf4f16 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4858] merge 4858 to mainline

git-svn-id: file:///svn/toku/tokudb@43285 c7de825b-a66e-492c-adef-691d508d4ae1
parent f33271cd
......@@ -159,4 +159,6 @@ if(NOT @RUN_LONG_TESTS@)
endif()
## don't complain about warnings in xz source
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "xz-4.999.9beta/src/liblzma")
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"xz-4.999.9beta/src/liblzma"
)
......@@ -5,6 +5,7 @@ out=$1; shift
exec \"$@\" >$out")
add_executable(make_tdb make_tdb.c)
set_property(TARGET make_tdb APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/db.h"
COMMAND bash runcat.sh "${CMAKE_CURRENT_BINARY_DIR}/db.h" $<TARGET_FILE:make_tdb>
......
......@@ -15,7 +15,6 @@ endif()
## preprocessor definitions we want everywhere
add_c_defines(
_SVID_SOURCE
_GNU_SOURCE
_XOPEN_SOURCE=600
_FILE_OFFSET_BITS=64
_LARGEFILE64_SOURCE
......@@ -26,9 +25,6 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin)
add_c_defines(TOKU_ALLOW_DEPRECATED)
endif()
## default warning levels
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
## coverage
option(USE_GCOV "Use gcov for test coverage." OFF)
if (USE_GCOV)
......@@ -90,6 +86,9 @@ elseif(HAVE_CC_FLAG_IPO)
endif()
if(CMAKE_C_COMPILER_ID MATCHES "^Intel$")
# make sure intel libs are linked statically
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel")
# disable some intel-specific warnings
set(intel_warnings
94 # allow arrays of length 0
......@@ -102,9 +101,23 @@ if(CMAKE_C_COMPILER_ID MATCHES "^Intel$")
)
string(REGEX REPLACE ";" "," intel_warning_string "${intel_warnings}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -diag-disable ${intel_warning_string}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -debug all")
# make sure intel libs are linked statically
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel")
set(EXTRA_CFLAGS "-Wall -Wcheck")
else()
set(EXTRA_CFLAGS "-Wall -Wextra -Wcast-align -Wbad-function-cast -Wno-missing-noreturn -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wmissing-format-attribute -Wshadow")
endif()
## default warning levels
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
## function for adding -fvisibility=hidden to targets
function(set_targets_visibility_hidden)
if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel")
foreach(target ${ARGN})
get_target_property(flags ${target} COMPILE_FLAGS)
set_target_properties(${target} PROPERTIES
COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden")
endforeach(target)
endif ()
endfunction(set_targets_visibility_hidden)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
set(both_bins
db-benchmark-test
scanscan
......
......@@ -76,13 +76,6 @@ set(BRT_SOURCES
ybt.c
)
## define HAVE_CILK if we want cilk
if(USE_CILK)
foreach(src ${BRT_SOURCES})
set_property(SOURCE ${src} APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1)
endforeach(src)
endif()
add_library(newbrt SHARED ${BRT_SOURCES})
add_library(newbrt_static STATIC ${BRT_SOURCES})
set_property(TARGET newbrt_static APPEND PROPERTY COMPILE_FLAGS "-fPIC")
......@@ -96,11 +89,17 @@ add_dependencies(newbrt_static install_tdb_h build_lzma)
target_link_libraries(newbrt ${LIBTOKUPORTABILITY} lzma)
target_link_libraries(newbrt_static ${LIBTOKUPORTABILITY} lzma)
## conditionally link with cilkrts
if(USE_CILK)
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
target_link_libraries(newbrt -nodefaultlibs c -Bstatic irc -Bdynamic)
endif ()
## conditionally use cilk
if (USE_CILK)
set_property(TARGET newbrt APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1)
set_property(TARGET newbrt_static APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1)
target_link_libraries(newbrt cilkrts)
target_link_libraries(newbrt_static cilkrts)
endif()
endif (USE_CILK)
## build the bins in this directory
set(bins
......
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
if(BUILD_TESTING)
file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.c)
......
......@@ -13,6 +13,7 @@ set(tokuportability_srcs
add_library(${LIBTOKUPORTABILITY} SHARED ${tokuportability_srcs})
add_library(${LIBTOKUPORTABILITY}_static STATIC ${tokuportability_srcs})
maybe_add_gcov_to_libraries(${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static)
set_property(TARGET ${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
foreach(src file.c memory.c os_malloc.c portability.c toku_assert.c toku_rwlock.c)
set_property(SOURCE ${src} APPEND PROPERTY COMPILE_DEFINITIONS TOKU_ALLOW_DEPRECATED=1)
......
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
if(BUILD_TESTING)
file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.c)
......
......@@ -23,11 +23,22 @@ add_library(${LIBTOKUDB} SHARED ${tokudb_srcs})
add_dependencies(${LIBTOKUDB} generate_logging_code install_tdb_h)
target_link_libraries(${LIBTOKUDB} lock_tree_static range_tree_static newbrt_static)
configure_file(export.map . COPYONLY)
get_target_property(link_flags ${LIBTOKUDB} LINK_FLAGS)
set_target_properties(${LIBTOKUDB} PROPERTIES
LINK_FLAGS "${LINK_FLAGS} -Wl,--version-script=export.map")
add_library(${LIBTOKUDB}_static STATIC ${tokudb_srcs})
add_dependencies(${LIBTOKUDB}_static generate_logging_code install_tdb_h)
target_link_libraries(${LIBTOKUDB}_static lock_tree_static range_tree_static newbrt_static)
set_targets_visibility_hidden(${LIBTOKUDB} ${LIBTOKUDB}_static)
maybe_add_gcov_to_libraries(${LIBTOKUDB} ${LIBTOKUDB}_static)
set_property(TARGET ${LIBTOKUDB} ${LIBTOKUDB}_static APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
target_link_libraries(${LIBTOKUDB} -nodefaultlibs c -Bstatic irc -Bdynamic)
endif ()
install(
TARGETS ${LIBTOKUDB}
......
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
if(BUILD_TESTING)
file(GLOB transparent_upgrade_srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" upgrade*.c)
......
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
set(utils tokudb_gen tokudb_load tokudb_dump)
foreach(util ${utils})
add_executable(${util} ${util}.c)
......
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