Skip to content

Commit d5c5082

Browse files
authored
[core] [revert] Manually revert cpp example change (ray-project#49701)
Signed-off-by: dentiny <[email protected]>
1 parent 0c4f6ac commit d5c5082

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

cpp/example/BUILD

Lines changed: 0 additions & 11 deletions
This file was deleted.

cpp/example/BUILD.bazel

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cc_binary(
2+
name = "example",
3+
srcs = glob([
4+
"*.cc",
5+
]),
6+
data = [
7+
"example.so",
8+
],
9+
linkstatic = True,
10+
deps = [
11+
":ray_api",
12+
],
13+
)
14+
15+
cc_binary(
16+
name = "example.so",
17+
srcs = glob([
18+
"*.cc",
19+
]),
20+
linkopts = ["-shared"],
21+
linkstatic = True,
22+
deps = [
23+
":ray_api",
24+
],
25+
)
26+
27+
cc_library(
28+
name = "ray_api",
29+
srcs = [
30+
"thirdparty/lib/libray_api.so",
31+
],
32+
hdrs = glob([
33+
"thirdparty/include/**/*.h",
34+
"thirdparty/include/**/*.hpp",
35+
]),
36+
linkopts = ["-Wl,-rpath,./"],
37+
strip_include_prefix = "thirdparty/include",
38+
visibility = ["//visibility:public"],
39+
)

cpp/example/run.sh

100755100644
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/usr/bin/env bash
22

3-
# Cause the script to exit if a single command fails.
3+
#Cause the script to exit if a single command fails.
44
set -e
55

6-
bazel --nosystem_rc --nohome_rc build //cpp/example:example
6+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE:-$0}")" || exit; pwd)"
7+
8+
bazel --nosystem_rc --nohome_rc build //:example
79
if [[ "$OSTYPE" == "darwin"* ]]; then
8-
bazel-bin/cpp/example/example
10+
DYLD_LIBRARY_PATH="$ROOT_DIR/thirdparty/lib" "${ROOT_DIR}"/bazel-bin/example
911
else
10-
bazel-bin/cpp/example/example
12+
LD_LIBRARY_PATH="$ROOT_DIR/thirdparty/lib" "${ROOT_DIR}"/bazel-bin/example
1113
fi

0 commit comments

Comments
 (0)