Skip to content

Commit

Permalink
Move out COPTS and reference them
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Dec 11, 2019
1 parent a6e162e commit 01c8a04
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
15 changes: 2 additions & 13 deletions BUILD.bazel
Expand Up @@ -7,19 +7,7 @@ load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@com_github_grpc_grpc//bazel:cython_library.bzl", "pyx_library")
load("@rules_proto_grpc//python:defs.bzl", "python_grpc_compile")
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")

# TODO(mehrdadn): (How to) support dynamic linking?
PROPAGATED_WINDOWS_DEFINES = ["RAY_STATIC"]

COPTS = ["-DRAY_USE_GLOG"] + select({
"@bazel_tools//src/conditions:windows": [
"-DWIN32_LEAN_AND_MEAN=", # Block the inclusion of WinSock.h, which is obsolete and causes errors
"-Wno-builtin-macro-redefined", # To get rid of warnings caused by deterministic build macros (e.g. #define __DATE__ "redacted")
"-Wno-microsoft-unqualified-friend", # This shouldn't normally be enabled, but otherwise we get: google/protobuf/map_field.h: warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier (for: friend class DynamicMessage)
] + ["-D" + define for define in PROPAGATED_WINDOWS_DEFINES],
"//conditions:default": [
],
})
load("//bazel:ray.bzl", "PROPAGATED_WINDOWS_DEFINES", "COPTS")

# === Begin of protobuf definitions ===

Expand Down Expand Up @@ -833,6 +821,7 @@ pyx_library(
"python/ray/streaming/includes/*.pxd",
"python/ray/streaming/includes/*.pxi",
]),
copts = COPTS,
deps = [
"//streaming:streaming_lib",
],
Expand Down
13 changes: 13 additions & 0 deletions bazel/ray.bzl
Expand Up @@ -2,6 +2,19 @@ load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_library_publ
load("@com_github_checkstyle_java//checkstyle:checkstyle.bzl", "checkstyle_test")
load("@bazel_common//tools/maven:pom_file.bzl", "pom_file")

# TODO(mehrdadn): (How to) support dynamic linking?
PROPAGATED_WINDOWS_DEFINES = ["RAY_STATIC"]

COPTS = ["-DRAY_USE_GLOG"] + select({
"@bazel_tools//src/conditions:windows": [
"-DWIN32_LEAN_AND_MEAN=", # Block the inclusion of WinSock.h, which is obsolete and causes errors
"-Wno-builtin-macro-redefined", # To get rid of warnings caused by deterministic build macros (e.g. #define __DATE__ "redacted")
"-Wno-microsoft-unqualified-friend", # This shouldn't normally be enabled, but otherwise we get: google/protobuf/map_field.h: warning: unqualified friend declaration referring to type outside of the nearest enclosing namespace is a Microsoft extension; add a nested name specifier (for: friend class DynamicMessage)
] + ["-D" + define for define in PROPAGATED_WINDOWS_DEFINES],
"//conditions:default": [
],
})

def flatbuffer_py_library(name, srcs, outs, out_prefix, includes = [], include_paths = []):
flatbuffer_library_public(
name = name,
Expand Down
10 changes: 10 additions & 0 deletions streaming/BUILD.bazel
Expand Up @@ -3,6 +3,7 @@

load("@com_github_grpc_grpc//bazel:cython_library.bzl", "pyx_library")
load("@rules_proto_grpc//python:defs.bzl", "python_proto_compile")
load("//bazel:ray.bzl", "COPTS")

proto_library(
name = "streaming_proto",
Expand Down Expand Up @@ -30,20 +31,23 @@ cc_proto_library(
# be linked into streaming libs by dynamic linker. See bazel rule `//:_raylet`
cc_binary(
name = "ray_util.so",
copts = COPTS,
linkshared = 1,
visibility = ["//visibility:public"],
deps = ["//:ray_util"],
)

cc_binary(
name = "ray_common.so",
copts = COPTS,
linkshared = 1,
visibility = ["//visibility:public"],
deps = ["//:ray_common"],
)

cc_binary(
name = "core_worker_lib.so",
copts = COPTS,
linkshared = 1,
deps = ["//:core_worker_lib"],
)
Expand All @@ -56,6 +60,7 @@ cc_library(
hdrs = glob([
"src/util/*.h",
]),
copts = COPTS,
includes = [
"src",
],
Expand All @@ -72,6 +77,7 @@ cc_library(
srcs = glob([
"src/config/*.cc",
]),
copts = COPTS,
hdrs = glob([
"src/config/*.h",
]),
Expand All @@ -87,6 +93,7 @@ cc_library(
srcs = glob([
"src/message/*.cc",
]),
copts = COPTS,
hdrs = glob([
"src/message/*.h",
]),
Expand All @@ -102,6 +109,7 @@ cc_library(
srcs = glob([
"src/queue/*.cc",
]),
copts = COPTS,
hdrs = glob([
"src/queue/*.h",
]),
Expand All @@ -128,6 +136,7 @@ cc_library(
"src/queue/*.h",
"src/test/*.h",
]),
copts = COPTS,
includes = ["src"],
visibility = ["//visibility:public"],
deps = [
Expand All @@ -154,6 +163,7 @@ cc_binary(
srcs = glob(["src/test/*.h"]) + [
"src/test/mock_actor.cc",
],
copts = COPTS,
includes = [
"streaming/src/test",
],
Expand Down

0 comments on commit 01c8a04

Please sign in to comment.