mariadb/ft/CMakeLists.txt
Leif Walsh bd63072bdf closes #5485 #5368 clean up cmake and get darwin portability:
for 5485:
 - remove icc handling stuff from cmake
 - clean up remaining cmake files
 - create libtokudb_static.a in a cleaner way using cmake OBJECT libs (requires cmake 2.8.9)
 - use POSITION_INDEPENDENT_CODE property instead of manually setting -fPIC
for 5368:
 - fix compilation failures due to small differences between gcc and clang, mostly in tests
 - use toku_fileids_are_equal instead of memcmp to compare fileids (closes #5505)
 - create dummy implementation of partitioned_counter for osx (quick fix for, and closes #5506)
 - add mutex->valid bit under TOKU_PTHREAD_DEBUG
 - initialize mutex of DB_TXN created during recovery for 2PC (closes #5507)


git-svn-id: file:///svn/toku/tokudb@48024 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-17 00:01:07 -04:00

137 lines
3.3 KiB
CMake

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
## generate log_code.cc, log_print.cc, log_header.cc
set_source_files_properties(
"${CMAKE_CURRENT_BINARY_DIR}/log_code"
"${CMAKE_CURRENT_BINARY_DIR}/log_print"
"${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
PROPERTIES GENERATED TRUE)
add_executable(logformat logformat.cc)
target_link_libraries(logformat ${LIBTOKUPORTABILITY})
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/log_code.cc"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/log_print.cc"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
COMMAND $<TARGET_FILE:logformat> .
DEPENDS logformat
)
add_custom_target(
generate_log_code
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/log_code.cc" "${CMAKE_CURRENT_BINARY_DIR}/log_print.cc" "${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
)
set(FT_SOURCES
background_job_manager
block_allocator
block_table
cachetable
checkpoint
compress
dbufio
fifo
ft
ft-cachetable-wrappers
ft-flusher
ft-hot-flusher
ftloader
ftloader-callback
ft_msg
ft_node-serialize
ft-node-deserialize
ft-ops
ft-serialize
ft-test-helpers
ft-verify
key
kibbutz
leafentry
le-cursor
logcursor
logfilemgr
logger
log_upgrade
memarena
mempool
minicron
omt
partitioned_counter
pqueue
queue
quicklz
recover
rollback
rollback-apply
rollback-ct-callbacks
roll
sort
sub_block
threadpool
txn
txn_manager
ule
x1764
xids
ybt
"${CMAKE_CURRENT_BINARY_DIR}/log_code"
"${CMAKE_CURRENT_BINARY_DIR}/log_print"
)
add_library(ft SHARED ${FT_SOURCES})
add_library(ft_objects OBJECT ${FT_SOURCES})
## we're going to link this into libtokudb.so so it needs to have PIC
set_target_properties(ft_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
maybe_add_gcov_to_libraries(ft ft_objects)
add_library(ft_static STATIC $<TARGET_OBJECTS:ft_objects>)
## depend on other generated targets
add_dependencies(ft install_tdb_h generate_log_code build_lzma)
add_dependencies(ft_objects install_tdb_h generate_log_code build_lzma)
## link with lzma (which should be static) and link dependers with zlib
target_link_libraries(ft LINK_PRIVATE lzma ${LIBTOKUPORTABILITY})
target_link_libraries(ft LINK_PUBLIC z)
target_link_libraries(ft_static LINK_PRIVATE lzma)
if (CMAKE_C_COMPILER_ID STREQUAL Intel)
target_link_libraries(ft LINK_PRIVATE -nodefaultlibs)
endif ()
## conditionally use cilk
if (USE_CILK)
set_property(TARGET ft APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1)
set_property(TARGET ft_static APPEND PROPERTY COMPILE_DEFINITIONS HAVE_CILK=1)
target_link_libraries(ft cilkrts)
target_link_libraries(ft_static cilkrts)
endif (USE_CILK)
## build the bins in this directory
set(bins
ftdump
tdb_logprint
tdb-recover
ftverify
)
foreach(bin ${bins})
add_executable(${bin} ${bin})
add_dependencies(${bin} install_tdb_h)
target_link_libraries(${bin} ft ${LIBTOKUPORTABILITY})
add_executable(${bin}_static ${bin})
add_dependencies(${bin}_static install_tdb_h)
target_link_libraries(${bin}_static ft_static z lzma ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} dl)
add_common_options_to_binary_targets(${bin} ${bin}_static)
endforeach(bin)
# link in math.h library just for this tool.
target_link_libraries(ftverify m)
target_link_libraries(ftverify_static m)
install(
TARGETS ftdump_static
DESTINATION bin
)
add_subdirectory(tests)