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@) ...@@ -159,4 +159,6 @@ if(NOT @RUN_LONG_TESTS@)
endif() endif()
## don't complain about warnings in xz source ## 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 ...@@ -5,6 +5,7 @@ out=$1; shift
exec \"$@\" >$out") exec \"$@\" >$out")
add_executable(make_tdb make_tdb.c) add_executable(make_tdb make_tdb.c)
set_property(TARGET make_tdb APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
add_custom_command( add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/db.h" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/db.h"
COMMAND bash runcat.sh "${CMAKE_CURRENT_BINARY_DIR}/db.h" $<TARGET_FILE:make_tdb> COMMAND bash runcat.sh "${CMAKE_CURRENT_BINARY_DIR}/db.h" $<TARGET_FILE:make_tdb>
......
...@@ -15,7 +15,6 @@ endif() ...@@ -15,7 +15,6 @@ endif()
## preprocessor definitions we want everywhere ## preprocessor definitions we want everywhere
add_c_defines( add_c_defines(
_SVID_SOURCE _SVID_SOURCE
_GNU_SOURCE
_XOPEN_SOURCE=600 _XOPEN_SOURCE=600
_FILE_OFFSET_BITS=64 _FILE_OFFSET_BITS=64
_LARGEFILE64_SOURCE _LARGEFILE64_SOURCE
...@@ -26,9 +25,6 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin) ...@@ -26,9 +25,6 @@ if(CMAKE_SYSTEM_NAME MATCHES Darwin)
add_c_defines(TOKU_ALLOW_DEPRECATED) add_c_defines(TOKU_ALLOW_DEPRECATED)
endif() endif()
## default warning levels
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
## coverage ## coverage
option(USE_GCOV "Use gcov for test coverage." OFF) option(USE_GCOV "Use gcov for test coverage." OFF)
if (USE_GCOV) if (USE_GCOV)
...@@ -90,6 +86,9 @@ elseif(HAVE_CC_FLAG_IPO) ...@@ -90,6 +86,9 @@ elseif(HAVE_CC_FLAG_IPO)
endif() endif()
if(CMAKE_C_COMPILER_ID MATCHES "^Intel$") 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 # disable some intel-specific warnings
set(intel_warnings set(intel_warnings
94 # allow arrays of length 0 94 # allow arrays of length 0
...@@ -102,9 +101,23 @@ if(CMAKE_C_COMPILER_ID MATCHES "^Intel$") ...@@ -102,9 +101,23 @@ if(CMAKE_C_COMPILER_ID MATCHES "^Intel$")
) )
string(REGEX REPLACE ";" "," intel_warning_string "${intel_warnings}") string(REGEX REPLACE ";" "," intel_warning_string "${intel_warnings}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -diag-disable ${intel_warning_string}") 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(EXTRA_CFLAGS "-Wall -Wcheck")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel") else()
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel") 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")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel")
endif() 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}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
set(both_bins set(both_bins
db-benchmark-test db-benchmark-test
scanscan scanscan
......
...@@ -76,13 +76,6 @@ set(BRT_SOURCES ...@@ -76,13 +76,6 @@ set(BRT_SOURCES
ybt.c 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 SHARED ${BRT_SOURCES})
add_library(newbrt_static STATIC ${BRT_SOURCES}) add_library(newbrt_static STATIC ${BRT_SOURCES})
set_property(TARGET newbrt_static APPEND PROPERTY COMPILE_FLAGS "-fPIC") set_property(TARGET newbrt_static APPEND PROPERTY COMPILE_FLAGS "-fPIC")
...@@ -96,11 +89,17 @@ add_dependencies(newbrt_static install_tdb_h build_lzma) ...@@ -96,11 +89,17 @@ add_dependencies(newbrt_static install_tdb_h build_lzma)
target_link_libraries(newbrt ${LIBTOKUPORTABILITY} lzma) target_link_libraries(newbrt ${LIBTOKUPORTABILITY} lzma)
target_link_libraries(newbrt_static ${LIBTOKUPORTABILITY} lzma) target_link_libraries(newbrt_static ${LIBTOKUPORTABILITY} lzma)
## conditionally link with cilkrts if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if(USE_CILK) 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 cilkrts)
target_link_libraries(newbrt_static cilkrts) target_link_libraries(newbrt_static cilkrts)
endif() endif (USE_CILK)
## build the bins in this directory ## build the bins in this directory
set(bins set(bins
......
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
if(BUILD_TESTING) if(BUILD_TESTING)
file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.c) file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.c)
......
...@@ -13,6 +13,7 @@ set(tokuportability_srcs ...@@ -13,6 +13,7 @@ set(tokuportability_srcs
add_library(${LIBTOKUPORTABILITY} SHARED ${tokuportability_srcs}) add_library(${LIBTOKUPORTABILITY} SHARED ${tokuportability_srcs})
add_library(${LIBTOKUPORTABILITY}_static STATIC ${tokuportability_srcs}) add_library(${LIBTOKUPORTABILITY}_static STATIC ${tokuportability_srcs})
maybe_add_gcov_to_libraries(${LIBTOKUPORTABILITY} ${LIBTOKUPORTABILITY}_static) 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) 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) set_property(SOURCE ${src} APPEND PROPERTY COMPILE_DEFINITIONS TOKU_ALLOW_DEPRECATED=1)
......
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
if(BUILD_TESTING) if(BUILD_TESTING)
file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.c) file(GLOB srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.c)
......
...@@ -23,11 +23,22 @@ add_library(${LIBTOKUDB} SHARED ${tokudb_srcs}) ...@@ -23,11 +23,22 @@ add_library(${LIBTOKUDB} SHARED ${tokudb_srcs})
add_dependencies(${LIBTOKUDB} generate_logging_code install_tdb_h) add_dependencies(${LIBTOKUDB} generate_logging_code install_tdb_h)
target_link_libraries(${LIBTOKUDB} lock_tree_static range_tree_static newbrt_static) 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_library(${LIBTOKUDB}_static STATIC ${tokudb_srcs})
add_dependencies(${LIBTOKUDB}_static generate_logging_code install_tdb_h) add_dependencies(${LIBTOKUDB}_static generate_logging_code install_tdb_h)
target_link_libraries(${LIBTOKUDB}_static lock_tree_static range_tree_static newbrt_static) 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) 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( install(
TARGETS ${LIBTOKUDB} TARGETS ${LIBTOKUDB}
......
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE)
if(BUILD_TESTING) if(BUILD_TESTING)
file(GLOB transparent_upgrade_srcs RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" upgrade*.c) 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) set(utils tokudb_gen tokudb_load tokudb_dump)
foreach(util ${utils}) foreach(util ${utils})
add_executable(${util} ${util}.c) 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