2016-12-20 14:46:25 -08:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
|
|
|
project(common)
|
|
|
|
|
2017-01-17 16:56:40 -08:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Common.cmake)
|
2016-12-20 14:46:25 -08:00
|
|
|
|
2017-01-17 16:56:40 -08:00
|
|
|
add_subdirectory(redis_module)
|
2016-12-20 14:46:25 -08:00
|
|
|
|
2017-03-01 01:17:24 -08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
|
|
2017-01-17 16:56:40 -08:00
|
|
|
include_directories(thirdparty/ae)
|
2016-12-20 14:46:25 -08:00
|
|
|
|
2017-01-17 16:56:40 -08:00
|
|
|
add_custom_target(
|
|
|
|
hiredis
|
|
|
|
COMMAND make
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/thirdparty/hiredis)
|
|
|
|
|
|
|
|
add_library(common STATIC
|
2017-03-01 01:17:24 -08:00
|
|
|
event_loop.cc
|
|
|
|
common.cc
|
|
|
|
task.cc
|
|
|
|
io.cc
|
|
|
|
net.cc
|
|
|
|
logging.cc
|
|
|
|
state/redis.cc
|
|
|
|
state/table.cc
|
|
|
|
state/object_table.cc
|
|
|
|
state/task_table.cc
|
|
|
|
state/db_client_table.cc
|
|
|
|
state/actor_notification_table.cc
|
|
|
|
state/local_scheduler_table.cc
|
2017-01-17 16:56:40 -08:00
|
|
|
thirdparty/ae/ae.c
|
|
|
|
thirdparty/sha256.c)
|
|
|
|
|
|
|
|
target_link_libraries(common "${CMAKE_CURRENT_LIST_DIR}/thirdparty/hiredis/libhiredis.a")
|
|
|
|
|
|
|
|
function(define_test test_name library)
|
2017-03-01 01:17:24 -08:00
|
|
|
add_executable(${test_name} test/${test_name}.cc ${ARGN})
|
2017-02-28 18:47:40 -08:00
|
|
|
add_dependencies(${test_name} hiredis flatbuffers_ep)
|
2017-01-17 16:56:40 -08:00
|
|
|
target_link_libraries(${test_name} common ${FLATBUFFERS_STATIC_LIB} ${library})
|
2017-02-27 12:24:07 -08:00
|
|
|
target_compile_options(${test_name} PUBLIC "-DPLASMA_TEST -DLOCAL_SCHEDULER_TEST -DCOMMON_TEST -DRAY_COMMON_LOG_LEVEL=4 -DRAY_TIMEOUT=50")
|
2017-01-17 16:56:40 -08:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
define_test(common_tests "")
|
|
|
|
define_test(db_tests "")
|
|
|
|
define_test(io_tests "")
|
|
|
|
define_test(task_tests "")
|
|
|
|
define_test(redis_tests "")
|
|
|
|
define_test(task_table_tests "")
|
|
|
|
define_test(object_table_tests "")
|
|
|
|
|
|
|
|
add_custom_target(
|
|
|
|
redis
|
|
|
|
COMMAND make
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/thirdparty/redis)
|
|
|
|
|
|
|
|
add_custom_target(copy_redis ALL)
|
|
|
|
foreach(file "redis-cli" "redis-server")
|
|
|
|
add_custom_command(TARGET copy_redis POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E
|
|
|
|
copy ${CMAKE_CURRENT_LIST_DIR}/thirdparty/redis/src/${file}
|
|
|
|
${CMAKE_BINARY_DIR}/src/common/thirdparty/redis/src/${file})
|
|
|
|
endforeach()
|
|
|
|
add_dependencies(copy_redis redis)
|