mariadb/newbrt/CMakeLists.txt
Leif Walsh 63b1969fbb [t:4814] merging cmake work to mainline
git-svn-id: file:///svn/toku/tokudb@43179 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-17 00:00:25 -04:00

126 lines
3.1 KiB
CMake

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
option(USE_CILK "Use cilk in tokudb." OFF)
## can't use cilk without icc
if(USE_CILK AND NOT(CMAKE_C_COMPILER_ID MATCHES Intel))
message(FATAL_ERROR "You specified USE_CILK=ON so you need to use an Intel compiler.")
endif()
## generate log_code.c, log_print.c, log_header.c
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/log_code.c PROPERTIES GENERATED TRUE)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/log_print.c PROPERTIES GENERATED TRUE)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/log_header.h PROPERTIES GENERATED TRUE)
add_executable(logformat logformat.c)
target_link_libraries(logformat ${LIBTOKUPORTABILITY})
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/log_code.c"
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/log_print.c"
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/log_header.h"
COMMAND $<TARGET_FILE:logformat> "${CMAKE_CURRENT_SOURCE_DIR}"
)
add_custom_target(generate_logging_code DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/log_code.c"
"${CMAKE_CURRENT_SOURCE_DIR}/log_print.c"
"${CMAKE_CURRENT_SOURCE_DIR}/log_header.h")
set(BRT_SOURCES
block_allocator.c
block_table.c
brtloader.c
brtloader-callback.c
brt-serialize.c
brt-verify.c
brt.c
brt-cachetable-wrappers.c
brt-flusher.c
brt-hot-flusher.c
brt_msg.c
brt-test-helpers.c
cachetable.c
checkpoint.c
compress.c
dbufio.c
fifo.c
key.c
kibbutz.c
leafentry.c
le-cursor.c
logfilemgr.c
logger.c
log_code.c
log_upgrade.c
log_print.c
logcursor.c
memarena.c
mempool.c
minicron.c
omt.c
pqueue.c
queue.c
quicklz.c
recover.c
roll.c
rollback.c
sort.c
sub_block.c
ule.c
threadpool.c
trace_mem.c
txn.c
workqueue.c
x1764.c
xids.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_static STATIC ${BRT_SOURCES})
set_property(TARGET newbrt_static APPEND PROPERTY COMPILE_FLAGS "-fPIC")
maybe_add_gcov_to_libraries(newbrt newbrt_static)
## depend on other generated targets
add_dependencies(newbrt install_tdb_h build_lzma)
add_dependencies(newbrt_static install_tdb_h build_lzma)
## link with lzma (which should be static)
target_link_libraries(newbrt ${LIBTOKUPORTABILITY} lzma)
target_link_libraries(newbrt_static ${LIBTOKUPORTABILITY} lzma)
## conditionally link with cilkrts
if(USE_CILK)
target_link_libraries(newbrt cilkrts)
target_link_libraries(newbrt_static cilkrts)
endif()
## build the bins in this directory
set(bins
brtdump
tdb_logprint
tdb-recover
)
foreach(bin ${bins})
add_executable(${bin} ${bin}.c)
add_dependencies(${bin} install_tdb_h)
target_link_libraries(${bin} newbrt ${LIBTOKUPORTABILITY})
add_executable(${bin}_static ${bin}.c)
add_dependencies(${bin} install_tdb_h)
target_link_libraries(${bin}_static newbrt_static ${LIBTOKUPORTABILITY_STATIC})
endforeach(bin)
install(
TARGETS brtdump_static
DESTINATION bin
)
add_subdirectory(tests)