Skip to content

Commit

Permalink
Fix target_compatible_with config
Browse files Browse the repository at this point in the history
  • Loading branch information
mvukov committed Sep 15, 2024
1 parent 234a18c commit b0f44aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
13 changes: 8 additions & 5 deletions ros/repositories/ros_comm.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""

load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
Expand Down Expand Up @@ -106,7 +107,7 @@ expand_template(
{"#cmakedefine HAVE_EPOLL": "/*#cmakedefine HAVE_EPOLL*/"},
),
},
no_match_error = "Only Linux and macOS are supported!",
no_match_error = "Supported OSs: Linux, macOS",
),
template = "clients/roscpp/src/libros/config.h.in",
)
Expand All @@ -119,10 +120,12 @@ cc_ros_library(
includes = ["clients/roscpp/include"],
linkopts = ["-lm"],
ros_package_name = "roscpp",
target_compatible_with = [
"@platforms//os:linux",
"@platforms//os:macos",
],
target_compatible_with = selects.with_or(
{
("@platforms//os:linux", "@platforms//os:macos"): [],
"//conditions:default": ["@platforms//:incompatible"],
},
),
visibility = ["//visibility:public"],
deps = [
":cc_roscpp",
Expand Down
11 changes: 7 additions & 4 deletions ros/repositories/roscpp_core.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Builds roscpp_core.
"""

load("@bazel_skylib//lib:selects.bzl", "selects")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_ros//ros:cc_defs.bzl", "cc_ros_library")

Expand Down Expand Up @@ -63,10 +64,12 @@ cc_ros_library(

cc_library(
name = "roscpp_core",
target_compatible_with = [
"@platforms//os:linux",
"@platforms//os:macos",
],
target_compatible_with = selects.with_or(
{
("@platforms//os:linux", "@platforms//os:macos"): [],
"//conditions:default": ["@platforms//:incompatible"],
},
),
visibility = ["//visibility:public"],
deps = [
":cpp_common",
Expand Down

0 comments on commit b0f44aa

Please sign in to comment.