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-03-05 02:05:02 -08:00
|
|
|
# Compile flatbuffers
|
|
|
|
|
|
|
|
set(COMMON_FBS_SRC "${CMAKE_CURRENT_LIST_DIR}/format/common.fbs")
|
|
|
|
set(OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/format/)
|
|
|
|
|
2017-05-24 21:52:33 -07:00
|
|
|
set(COMMON_FBS_OUTPUT_FILES
|
|
|
|
"${OUTPUT_DIR}/common_generated.h")
|
2017-03-05 02:05:02 -08:00
|
|
|
|
|
|
|
add_custom_command(
|
2017-05-24 21:52:33 -07:00
|
|
|
OUTPUT ${COMMON_FBS_OUTPUT_FILES}
|
2017-03-15 16:27:52 -07:00
|
|
|
# The --gen-object-api flag generates a C++ class MessageT for each
|
|
|
|
# flatbuffers message Message, which can be used to store deserialized
|
|
|
|
# messages in data structures. This is currently used for ObjectInfo for
|
|
|
|
# example.
|
|
|
|
COMMAND ${FLATBUFFERS_COMPILER} -c -o ${OUTPUT_DIR} ${COMMON_FBS_SRC} --gen-object-api
|
2017-03-05 02:05:02 -08:00
|
|
|
DEPENDS ${FBS_DEPENDS}
|
|
|
|
COMMENT "Running flatc compiler on ${COMMON_FBS_SRC}"
|
|
|
|
VERBATIM)
|
|
|
|
|
2017-05-24 21:52:33 -07:00
|
|
|
add_custom_target(gen_common_fbs DEPENDS ${COMMON_FBS_OUTPUT_FILES})
|
|
|
|
|
2017-03-10 18:35:25 -08:00
|
|
|
# Generate Python bindings for the flatbuffers objects.
|
|
|
|
set(PYTHON_OUTPUT_DIR ${CMAKE_BINARY_DIR}/generated/)
|
|
|
|
add_custom_command(
|
|
|
|
TARGET gen_common_fbs
|
|
|
|
COMMAND ${FLATBUFFERS_COMPILER} -p -o ${PYTHON_OUTPUT_DIR} ${COMMON_FBS_SRC}
|
|
|
|
DEPENDS ${FBS_DEPENDS}
|
|
|
|
COMMENT "Running flatc compiler on ${COMMON_FBS_SRC}"
|
|
|
|
VERBATIM)
|
|
|
|
|
2017-03-27 20:55:50 -07:00
|
|
|
# Encode the fact that the ray redis module requires the autogenerated
|
|
|
|
# flatbuffer files to compile.
|
|
|
|
add_dependencies(ray_redis_module gen_common_fbs)
|
|
|
|
|
2017-03-05 02:05:02 -08:00
|
|
|
add_dependencies(gen_common_fbs flatbuffers_ep)
|
|
|
|
|
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
|
2017-03-05 02:05:02 -08:00
|
|
|
common_protocol.cc
|
2017-03-01 01:17:24 -08:00
|
|
|
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
|
2017-04-24 18:10:21 -07:00
|
|
|
state/driver_table.cc
|
2017-03-01 01:17:24 -08:00
|
|
|
state/actor_notification_table.cc
|
|
|
|
state/local_scheduler_table.cc
|
2017-03-07 00:32:15 -08:00
|
|
|
state/error_table.cc
|
2017-01-17 16:56:40 -08:00
|
|
|
thirdparty/ae/ae.c
|
|
|
|
thirdparty/sha256.c)
|
|
|
|
|
2017-03-05 02:05:02 -08:00
|
|
|
add_dependencies(common gen_common_fbs)
|
|
|
|
|
2017-01-17 16:56:40 -08:00
|
|
|
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-07-31 21:04:15 -07:00
|
|
|
target_link_libraries(${test_name} common ${FLATBUFFERS_STATIC_LIB} ${ARROW_DIR}/cpp/build/release/libarrow.a ${library} -lpthread)
|
2017-06-16 12:11:01 -07:00
|
|
|
target_compile_options(${test_name} PUBLIC "-DPLASMA_TEST -DLOCAL_SCHEDULER_TEST -DCOMMON_TEST -DRAY_COMMON_LOG_LEVEL=4")
|
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)
|