How to make example.cc with CMakeList.txt?

How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

How to use cmake to implement the bazel function?

What is Ray Core? — Ray 2.8.0

The C++ Ray API is currently experimental with limited support and it’s not supported on Windows. You can track its development here and report issues on GitHub. Run the following commands to get started:

Install ray with C++ API support and generate a bazel project with the ray command.

pip install "ray[cpp]"
mkdir ray-template && ray cpp --generate-bazel-project-template-to ray-template

BUILD.bazel

# ray
cc_binary(
    name = "example",
    srcs = glob([
        "*.cc",
    ]),
    data = [
        "example.so",
    ],
    linkstatic = True,
    deps = [
        ":ray_api",
    ],
)

cc_binary(
    name = "example.so",
    srcs = glob([
        "*.cc",
    ]),
    linkopts = ["-shared"],
    linkstatic = True,
    deps = [
        ":ray_api",
    ],
)

cc_library(
    name = "ray_api",
    srcs = [
        "thirdparty/lib/libray_api.so",
    ],
    hdrs = glob([
        "thirdparty/include/**/*.h",
        "thirdparty/include/**/*.hpp",
    ]),
    linkopts = ["-Wl,-rpath, ./"],
    strip_include_prefix = "thirdparty/include",
    visibility = ["//visibility:public"],
)

CMakeList.txt

# cmake verson
cmake_minimum_required(VERSION 3.22.3)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

project(ray_demo)

link_directories(./build)
link_directories(thirdparty/lib)
include_directories(thirdparty/include)

add_executable(ray_demo src/example.cc)
target_link_libraries(ray_demo libray_api.so)

cc @qicosmos can you help with this question?

[Core] In C++, there are D_GLIBCXX_USE_CXX11_ABI settings conflicts when both Ray and Arrow are used. · Issue #24566 · ray-project/ray · GitHub see more discussion here.