2013-04-17 00:00:25 -04:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
|
|
|
|
## generate log_code.c, log_print.c, log_header.c
|
2013-04-17 00:00:47 -04:00
|
|
|
set_source_files_properties(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/log_code.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/log_print.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/log_header.h
|
|
|
|
PROPERTIES GENERATED TRUE)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
|
|
|
add_executable(logformat logformat.c)
|
2013-04-17 00:00:49 -04:00
|
|
|
add_space_separated_property(TARGET logformat COMPILE_FLAGS "-fvisibility=hidden -fPIE")
|
|
|
|
add_space_separated_property(TARGET logformat LINK_FLAGS -pie)
|
2013-04-17 00:00:25 -04:00
|
|
|
target_link_libraries(logformat ${LIBTOKUPORTABILITY})
|
|
|
|
|
|
|
|
add_custom_command(
|
2013-04-17 00:00:30 -04:00
|
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/log_code.c"
|
|
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/log_print.c"
|
|
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
|
|
|
|
COMMAND $<TARGET_FILE:logformat> .
|
2013-04-17 00:00:30 -04:00
|
|
|
DEPENDS logformat
|
2013-04-17 00:00:30 -04:00
|
|
|
)
|
2013-04-17 00:00:41 -04:00
|
|
|
add_custom_target(
|
|
|
|
generate_log_code
|
|
|
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/log_code.c" "${CMAKE_CURRENT_BINARY_DIR}/log_print.c" "${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
|
|
|
|
)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
2013-04-17 00:00:35 -04:00
|
|
|
set(FT_SOURCES
|
2013-04-17 00:00:25 -04:00
|
|
|
block_allocator.c
|
|
|
|
block_table.c
|
|
|
|
cachetable.c
|
|
|
|
checkpoint.c
|
|
|
|
compress.c
|
|
|
|
dbufio.c
|
|
|
|
fifo.c
|
2013-04-17 00:00:35 -04:00
|
|
|
ft.c
|
|
|
|
ft-cachetable-wrappers.c
|
|
|
|
ft-flusher.c
|
|
|
|
ft-hot-flusher.c
|
|
|
|
ftloader.c
|
|
|
|
ftloader-callback.c
|
|
|
|
ft_msg.c
|
2013-04-17 00:00:35 -04:00
|
|
|
ft_node-serialize.c
|
2013-04-17 00:00:43 -04:00
|
|
|
ft-node-deserialize.c
|
2013-04-17 00:00:35 -04:00
|
|
|
ft-ops.c
|
|
|
|
ft-serialize.c
|
|
|
|
ft-test-helpers.c
|
|
|
|
ft-verify.c
|
2013-04-17 00:00:25 -04:00
|
|
|
key.c
|
|
|
|
kibbutz.c
|
|
|
|
leafentry.c
|
|
|
|
le-cursor.c
|
2013-04-17 00:00:35 -04:00
|
|
|
logcursor.c
|
2013-04-17 00:00:25 -04:00
|
|
|
logfilemgr.c
|
|
|
|
logger.c
|
|
|
|
log_upgrade.c
|
|
|
|
memarena.c
|
|
|
|
mempool.c
|
|
|
|
minicron.c
|
|
|
|
omt.c
|
|
|
|
pqueue.c
|
|
|
|
queue.c
|
|
|
|
quicklz.c
|
|
|
|
recover.c
|
|
|
|
rollback.c
|
2013-04-17 00:00:42 -04:00
|
|
|
rollback-apply.c
|
|
|
|
rollback-ct-callbacks.c
|
2013-04-17 00:00:35 -04:00
|
|
|
roll.c
|
2013-04-17 00:00:25 -04:00
|
|
|
sort.c
|
|
|
|
sub_block.c
|
|
|
|
threadpool.c
|
|
|
|
txn.c
|
2013-04-17 00:00:37 -04:00
|
|
|
txn_manager.c
|
2013-04-17 00:00:35 -04:00
|
|
|
ule.c
|
2013-04-17 00:00:25 -04:00
|
|
|
workqueue.c
|
|
|
|
x1764.c
|
|
|
|
xids.c
|
|
|
|
ybt.c
|
2013-04-17 00:00:35 -04:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/log_code.c"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/log_header.h"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/log_print.c"
|
2013-04-17 00:00:25 -04:00
|
|
|
)
|
|
|
|
|
2013-04-17 00:00:35 -04:00
|
|
|
add_library(ft SHARED ${FT_SOURCES})
|
|
|
|
add_library(ft_static STATIC ${FT_SOURCES})
|
2013-04-17 00:00:27 -04:00
|
|
|
## we're going to link this into libtokudb.so so it needs to have PIC
|
2013-04-17 00:00:49 -04:00
|
|
|
add_space_separated_property(TARGET ft_static COMPILE_FLAGS -fPIC)
|
2013-04-17 00:00:35 -04:00
|
|
|
maybe_add_gcov_to_libraries(ft ft_static)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
|
|
|
## depend on other generated targets
|
2013-04-17 00:00:35 -04:00
|
|
|
add_dependencies(ft install_tdb_h build_lzma)
|
|
|
|
add_dependencies(ft_static install_tdb_h build_lzma)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
2013-04-17 00:00:49 -04:00
|
|
|
## link with lzma (which should be static) and link dependers with zlib
|
2013-04-17 00:00:49 -04:00
|
|
|
target_link_libraries(ft LINK_PRIVATE lzma ${LIBTOKUPORTABILITY})
|
|
|
|
target_link_libraries(ft LINK_PUBLIC z)
|
2013-04-17 00:00:49 -04:00
|
|
|
target_link_libraries(ft_static LINK_PRIVATE lzma)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
2013-04-17 00:00:27 -04:00
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL Intel)
|
2013-04-17 00:00:49 -04:00
|
|
|
target_link_libraries(ft LINK_PRIVATE -nodefaultlibs)
|
2013-04-17 00:00:26 -04:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
## conditionally use cilk
|
|
|
|
if (USE_CILK)
|
2013-04-17 00:00:35 -04:00
|
|
|
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)
|
2013-04-17 00:00:26 -04:00
|
|
|
endif (USE_CILK)
|
2013-04-17 00:00:25 -04:00
|
|
|
|
|
|
|
## build the bins in this directory
|
|
|
|
set(bins
|
2013-04-17 00:00:35 -04:00
|
|
|
ftdump
|
2013-04-17 00:00:25 -04:00
|
|
|
tdb_logprint
|
|
|
|
tdb-recover
|
2013-04-17 00:00:43 -04:00
|
|
|
ftverify
|
2013-04-17 00:00:25 -04:00
|
|
|
)
|
|
|
|
foreach(bin ${bins})
|
|
|
|
add_executable(${bin} ${bin}.c)
|
|
|
|
add_dependencies(${bin} install_tdb_h)
|
2013-04-17 00:00:49 -04:00
|
|
|
add_space_separated_property(TARGET ${bin} COMPILE_FLAGS "-fvisibility=hidden -fPIE")
|
|
|
|
add_space_separated_property(TARGET ${bin} LINK_FLAGS -pie)
|
2013-04-17 00:00:35 -04:00
|
|
|
target_link_libraries(${bin} ft ${LIBTOKUPORTABILITY})
|
2013-04-17 00:00:25 -04:00
|
|
|
|
|
|
|
add_executable(${bin}_static ${bin}.c)
|
2013-04-17 00:00:49 -04:00
|
|
|
add_dependencies(${bin}_static install_tdb_h)
|
|
|
|
add_space_separated_property(TARGET ${bin}_static COMPILE_FLAGS "-fvisibility=hidden -fPIE")
|
|
|
|
add_space_separated_property(TARGET ${bin}_static LINK_FLAGS -pie)
|
2013-04-17 00:00:49 -04:00
|
|
|
target_link_libraries(${bin}_static ft_static z ${LIBTOKUPORTABILITY}_static ${CMAKE_THREAD_LIBS_INIT} dl)
|
2013-04-17 00:00:25 -04:00
|
|
|
endforeach(bin)
|
|
|
|
|
2013-04-17 00:00:43 -04:00
|
|
|
# link in math.h library just for this tool.
|
|
|
|
target_link_libraries(ftverify m)
|
|
|
|
target_link_libraries(ftverify_static m)
|
|
|
|
|
2013-04-17 00:00:25 -04:00
|
|
|
install(
|
2013-04-17 00:00:35 -04:00
|
|
|
TARGETS ftdump_static
|
2013-04-17 00:00:25 -04:00
|
|
|
DESTINATION bin
|
|
|
|
)
|
|
|
|
|
|
|
|
add_subdirectory(tests)
|