Skip to content

Target compatibility flag being clobbered #133

@mikael-s-persson

Description

@mikael-s-persson

From 3.0.0 to 3.0.1, due to #129, the addition of the target_compatible_with flag in the cc_binary rules are not forwarding that flag if the user is providing one (as I am in some of my projects for arm vs x86 compatibility). So, that flag should be extracted and added when making the cc_binary targets. I believe the patch below should be sufficient:

--- a/build_defs.bzl
+++ b/build_defs.bzl
@@ -135,6 +135,8 @@ def pybind_extension(
     # Mark common dependencies as required for build_cleaner.
     tags = tags + ["req_dep=%s" % dep for dep in PYBIND_DEPS]
 
+    arg_target_compatible_with = kwargs.pop("target_compatible_with", [])
+
     cc_binary(
         name = name + ".so",
         copts = copts + PYBIND_COPTS + select({
@@ -149,7 +151,7 @@ def pybind_extension(
         }),
         linkshared = 1,
         tags = tags,
-        target_compatible_with = select({
+        target_compatible_with = arg_target_compatible_with + select({
             "@platforms//os:windows": ["@platforms//:incompatible"],
             "//conditions:default": [],
         }),
@@ -171,7 +173,7 @@ def pybind_extension(
         }),
         linkshared = 1,
         tags = tags,
-        target_compatible_with = select({
+        target_compatible_with = arg_target_compatible_with + select({
             "@platforms//os:windows": [],
             "//conditions:default": ["@platforms//:incompatible"],
         }),

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions