mirror of
https://github.com/wassname/ray.git
synced 2026-08-20 12:40:44 +08:00
[JavaWorker] Changes to the build system for support java worker (#2092)
* Changes to the build system for support java worker -------------------------- This commit includes changes to the build system, which is part of the java worker support of Ray. It consists of the following changes: - the changes of CMakeLists.txt files - the changes of the python setup.py and init files for the adaptation of the changed build system - move the location of local_scheduler_extension.cc for the adaptation of the changed build system which maybe better support multi-language worker * minor whitespace * Linting
This commit is contained in:
committed by
Philipp Moritz
parent
71e5cca59f
commit
5918776dd4
+41
-14
@@ -29,22 +29,43 @@ add_custom_command(
|
||||
COMMENT "Running flatc compiler on ${COMMON_FBS_SRC}"
|
||||
VERBATIM)
|
||||
|
||||
add_custom_target(gen_common_fbs DEPENDS ${COMMON_FBS_OUTPUT_FILES})
|
||||
if ("${CMAKE_RAY_LANG_PYTHON}" STREQUAL "YES")
|
||||
add_custom_target(gen_common_python_fbs DEPENDS ${COMMON_FBS_OUTPUT_FILES})
|
||||
|
||||
# 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)
|
||||
# Generate Python bindings for the flatbuffers objects.
|
||||
set(PYTHON_OUTPUT_DIR ${CMAKE_BINARY_DIR}/generated/)
|
||||
add_custom_command(
|
||||
TARGET gen_common_python_fbs
|
||||
COMMAND ${FLATBUFFERS_COMPILER} -p -o ${PYTHON_OUTPUT_DIR} ${COMMON_FBS_SRC}
|
||||
DEPENDS ${FBS_DEPENDS}
|
||||
COMMENT "Running flatc compiler on ${COMMON_FBS_SRC}"
|
||||
VERBATIM)
|
||||
|
||||
# Encode the fact that the ray redis module requires the autogenerated
|
||||
# flatbuffer files to compile.
|
||||
add_dependencies(ray_redis_module gen_common_fbs)
|
||||
# Encode the fact that the ray redis module requires the autogenerated
|
||||
# flatbuffer files to compile.
|
||||
add_dependencies(ray_redis_module gen_common_python_fbs)
|
||||
|
||||
add_dependencies(gen_common_fbs flatbuffers_ep)
|
||||
add_dependencies(gen_common_python_fbs flatbuffers_ep)
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_RAY_LANG_JAVA}" STREQUAL "YES")
|
||||
add_custom_target(gen_common_java_fbs DEPENDS ${COMMON_FBS_OUTPUT_FILES})
|
||||
|
||||
# Generate Java bindings for the flatbuffers objects.
|
||||
set(JAVA_OUTPUT_DIR ${CMAKE_BINARY_DIR}/generated/java)
|
||||
add_custom_command(
|
||||
TARGET gen_common_java_fbs
|
||||
COMMAND ${FLATBUFFERS_COMPILER} -j -o ${JAVA_OUTPUT_DIR} ${COMMON_FBS_SRC}
|
||||
DEPENDS ${FBS_DEPENDS}
|
||||
COMMENT "Running flatc compiler on ${COMMON_FBS_SRC}"
|
||||
VERBATIM)
|
||||
|
||||
# Encode the fact that the ray redis module requires the autogenerated
|
||||
# flatbuffer files to compile.
|
||||
add_dependencies(ray_redis_module gen_common_java_fbs)
|
||||
|
||||
add_dependencies(gen_common_java_fbs flatbuffers_ep)
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
hiredis
|
||||
@@ -71,7 +92,13 @@ add_library(common STATIC
|
||||
thirdparty/ae/ae.c
|
||||
thirdparty/sha256.c)
|
||||
|
||||
add_dependencies(common gen_common_fbs)
|
||||
if ("${CMAKE_RAY_LANG_PYTHON}" STREQUAL "YES")
|
||||
add_dependencies(common gen_common_python_fbs)
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_RAY_LANG_JAVA}" STREQUAL "YES")
|
||||
add_dependencies(common gen_common_java_fbs)
|
||||
endif()
|
||||
|
||||
target_link_libraries(common "${CMAKE_CURRENT_LIST_DIR}/thirdparty/hiredis/libhiredis.a")
|
||||
|
||||
|
||||
@@ -43,17 +43,33 @@ include_directories(SYSTEM ${FLATBUFFERS_INCLUDE_DIR})
|
||||
|
||||
set(CMAKE_C_FLAGS "-g -Wall -Wextra -Werror=implicit-function-declaration -Wno-sign-compare -Wno-unused-parameter -Wno-type-limits -Wno-missing-field-initializers --std=c99 -fPIC -std=c99")
|
||||
|
||||
# Code for finding Python
|
||||
find_package(PythonInterp REQUIRED)
|
||||
find_package(NumPy REQUIRED)
|
||||
# language-specific
|
||||
if ("${CMAKE_RAY_LANG_PYTHON}" STREQUAL "YES")
|
||||
# Code for finding Python
|
||||
find_package(PythonInterp REQUIRED)
|
||||
find_package(NumPy REQUIRED)
|
||||
|
||||
# Now find the Python include directories.
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print(get_python_inc())"
|
||||
OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "PYTHON_INCLUDE_DIRS: " ${PYTHON_INCLUDE_DIRS})
|
||||
# Now find the Python include directories.
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print(get_python_inc())"
|
||||
OUTPUT_VARIABLE PYTHON_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "PYTHON_INCLUDE_DIRS: " ${PYTHON_INCLUDE_DIRS})
|
||||
|
||||
message(STATUS "Using PYTHON_EXECUTABLE: " ${PYTHON_EXECUTABLE})
|
||||
message(STATUS "Using PYTHON_INCLUDE_DIRS: " ${PYTHON_INCLUDE_DIRS})
|
||||
message(STATUS "Using PYTHON_EXECUTABLE: " ${PYTHON_EXECUTABLE})
|
||||
message(STATUS "Using PYTHON_INCLUDE_DIRS: " ${PYTHON_INCLUDE_DIRS})
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_RAY_LANG_JAVA}" STREQUAL "YES")
|
||||
find_package(JNI REQUIRED)
|
||||
# add jni support
|
||||
include_directories(${JAVA_INCLUDE_PATH})
|
||||
include_directories(${JAVA_INCLUDE_PATH2})
|
||||
if (JNI_FOUND)
|
||||
message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
|
||||
message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
|
||||
else()
|
||||
message (WARNING "NOT FIND JNI")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Common libraries
|
||||
|
||||
@@ -62,4 +78,6 @@ set(COMMON_LIB "${CMAKE_BINARY_DIR}/src/common/libcommon.a"
|
||||
|
||||
include_directories("${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
include_directories("${CMAKE_CURRENT_LIST_DIR}/../thirdparty/")
|
||||
include_directories("${CMAKE_CURRENT_LIST_DIR}/../lib/python")
|
||||
if ("${CMAKE_RAY_LANG_PYTHON}" STREQUAL "YES")
|
||||
include_directories("${CMAKE_CURRENT_LIST_DIR}/../lib/python")
|
||||
endif ()
|
||||
|
||||
Reference in New Issue
Block a user