forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
135 lines (105 loc) · 4.36 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
cmake_minimum_required(VERSION 3.4)
project(ray)
set(CMAKE_RAY_LANG_PYTHON "NO")
set(CMAKE_RAY_LANG_JAVA "NO")
if ("${CMAKE_RAY_LANGUAGE}" STREQUAL "python")
set(CMAKE_RAY_LANG_PYTHON "YES")
elseif ("${CMAKE_RAY_LANGUAGE}" STREQUAL "java")
set(CMAKE_RAY_LANG_JAVA "YES")
elseif ("${CMAKE_RAY_LANGUAGE}" STREQUAL "")
message(WARNING "Language is not set, choose Python as default.")
set(CMAKE_RAY_LANG_PYTHON "YES")
else()
message(FATAL_ERROR "Unrecognized language, use -DCMAKE_RAY_LANGUAGE=java|python. Abort.")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
include(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/scripts/thirdparty.cmake)
find_package(Arrow)
find_package(Plasma)
# This ensures that things like gnu++11 get passed correctly
set(CMAKE_CXX_STANDARD 11)
# Use old C++ ABI to be compatible with TensorFlow
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
# We require a C++11 compliant compiler
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(RAY_BUILD_STATIC
"Build the libray static libraries"
ON)
option(RAY_BUILD_SHARED
"Build the libray shared libraries"
ON)
option(RAY_BUILD_TESTS
"Build the Ray googletest unit tests"
ON)
option(RAY_USE_NEW_GCS
"Use the new GCS implementation"
OFF)
if (RAY_USE_NEW_GCS)
add_definitions(-DRAY_USE_NEW_GCS)
endif()
include(ExternalProject)
include(GNUInstallDirs)
include(BuildUtils)
enable_testing()
include(ThirdpartyToolchain)
# TODO(rkn): Fix all of this. This include is needed for the following
# reason. The local scheduler depends on tables.cc which depends on
# node_manager_generated.h which depends on gcs_generated.h. However,
# the include statement for gcs_generated.h doesn't include the file
# path, so we include the relevant directory here.
set(GCS_FBS_OUTPUT_DIRECTORY
"${CMAKE_CURRENT_LIST_DIR}/src/ray/gcs/format")
include_directories(${GCS_FBS_OUTPUT_DIRECTORY})
include_directories(SYSTEM ${ARROW_INCLUDE_DIR})
include_directories(SYSTEM ${PLASMA_INCLUDE_DIR})
include_directories("${CMAKE_CURRENT_LIST_DIR}/src/")
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src/ray/)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src/common/)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src/plasma/)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src/local_scheduler/)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src/global_scheduler/)
if ("${CMAKE_RAY_LANG_PYTHON}" STREQUAL "YES")
# NOTE: The lists below must be kept in sync with ray/python/setup.py.
set(ray_file_list
"src/common/thirdparty/redis/src/redis-server"
"src/common/redis_module/libray_redis_module.so"
"src/plasma/plasma_manager"
"src/local_scheduler/local_scheduler"
"src/local_scheduler/liblocal_scheduler_library_python.so"
"src/global_scheduler/global_scheduler"
"src/ray/raylet/raylet_monitor"
"src/ray/raylet/raylet")
if (RAY_USE_NEW_GCS)
list(APPEND ray_file_list "src/credis/build/src/libmember.so")
list(APPEND ray_file_list "src/credis/build/src/libmaster.so")
list(APPEND ray_file_list "src/credis/redis/src/redis-server")
endif()
if (DEFINED ENV{INCLUDE_UI} AND "$ENV{INCLUDE_UI}" STREQUAL "1")
list(APPEND ray_file_list "src/catapult_files/index.html")
list(APPEND ray_file_list "src/catapult_files/trace_viewer_full.html")
endif()
set(build_ray_file_list)
foreach(file ${ray_file_list})
list(APPEND build_ray_file_list ${CMAKE_BINARY_DIR}/${file})
endforeach()
add_custom_target(copy_ray ALL
DEPENDS ${build_ray_file_list})
# Make sure redis-server is ready before copying.
add_dependencies(copy_ray copy_redis)
# Make sure that the Python extensions are built before copying the files.
if ("${CMAKE_RAY_LANG_PYTHON}" STREQUAL "YES")
get_local_scheduler_library("python" LOCAL_SCHEDULER_LIBRARY_LANG)
add_dependencies(copy_ray ${LOCAL_SCHEDULER_LIBRARY_LANG})
endif()
if ("${CMAKE_RAY_LANG_JAVA}" STREQUAL "YES")
get_local_scheduler_library("java" LOCAL_SCHEDULER_LIBRARY_LANG)
add_dependencies(copy_ray ${LOCAL_SCHEDULER_LIBRARY_LANG})
endif()
add_dependencies(copy_ray ray_redis_module)
foreach(file ${ray_file_list})
add_custom_command(TARGET copy_ray POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_BINARY_DIR}/${file}
${CMAKE_BINARY_DIR}/../python/ray/core/${file})
endforeach()
endif()