diff --git a/MODULE.bazel b/MODULE.bazel index 75e808f0..17190ecb 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -8,7 +8,6 @@ bazel_dep(name = "googletest", version = "1.14.0.bcr.1") bazel_dep(name = "lz4", version = "1.9.4") bazel_dep(name = "nlohmann_json", version = "3.11.3") bazel_dep(name = "platforms", version = "0.0.8") -bazel_dep(name = "pybind11_bazel", version = "2.11.1.bzl.1") bazel_dep(name = "readerwriterqueue", version = "1.0.6") bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "rules_foreign_cc", version = "0.10.1") @@ -57,10 +56,6 @@ pip.parse( ) use_repo(pip, "rules_ros2_resolver_deps") -python_configure = use_extension("@pybind11_bazel//:python_configure.bzl", "extension") -python_configure.toolchain(python_version = "3") -use_repo(python_configure, "local_config_python", "pybind11") - non_module_deps = use_extension("@com_github_mvukov_rules_ros2//:extensions.bzl", "non_module_deps") use_repo( non_module_deps, @@ -68,6 +63,7 @@ use_repo( "foxglove_bridge", "iceoryx", "osrf_pycommon", + "pybind11", "ros2_ament_cmake_ros", "ros2_ament_index", "ros2_class_loader", diff --git a/WORKSPACE b/WORKSPACE index 654cb5df..fd88e2a4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -37,13 +37,6 @@ load( install_rules_ros2_pip_deps() -load("@pybind11_bazel//:python_configure.bzl", "python_configure") - -python_configure( - name = "local_config_python", - python_interpreter_target = python_interpreter_target, -) - # Below are internal deps. pip_parse( diff --git a/repositories/pybind11.BUILD.bazel b/repositories/pybind11.BUILD.bazel new file mode 100644 index 00000000..b542963f --- /dev/null +++ b/repositories/pybind11.BUILD.bazel @@ -0,0 +1,12 @@ +""" Builds pybind11. +""" + +load("@rules_cc//cc:defs.bzl", "cc_library") + +cc_library( + name = "pybind11", + hdrs = glob(["include/pybind11/**/*.h"]), + includes = ["include"], + visibility = ["//visibility:public"], + deps = ["@rules_python//python/cc:current_py_cc_headers"], +) diff --git a/repositories/repositories.bzl b/repositories/repositories.bzl index d542062d..18e299f1 100644 --- a/repositories/repositories.bzl +++ b/repositories/repositories.bzl @@ -102,22 +102,6 @@ def rules_ros2_workspace_deps(): urls = ["https://github.com/leethomason/tinyxml2/archive/refs/tags/9.0.0.tar.gz"], ) - maybe( - http_archive, - name = "pybind11_bazel", - sha256 = "56397b31ab55eb151e45d4e0a6b28d90a854290728595607c9a04d0ffee05c49", - strip_prefix = "pybind11_bazel-2.11.1.bzl.1", - urls = ["https://github.com/pybind/pybind11_bazel/releases/download/v2.11.1.bzl.1/pybind11_bazel-2.11.1.bzl.1.tar.gz"], - ) - maybe( - http_archive, - name = "pybind11", - build_file = "@pybind11_bazel//:pybind11.BUILD", - sha256 = "d475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c", - strip_prefix = "pybind11-2.11.1", - urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz"], - ) - maybe( http_archive, name = "readerwriterqueue", @@ -165,6 +149,18 @@ def rules_ros2_workspace_deps(): def ros2_repositories(): """Import external/third-party build http_archive dependencies.""" + + # Move pybind stuff to rules_ros2_workspace_deps() and configure in MODULE.bazel + # once https://github.com/pybind/pybind11_bazel/issues/66 is resolved. + maybe( + http_archive, + name = "pybind11", + build_file = "@com_github_mvukov_rules_ros2//repositories:pybind11.BUILD.bazel", + sha256 = "d475978da0cdc2d43b73f30910786759d593a9d8ee05b1b6846d1eb16c6d2e0c", + strip_prefix = "pybind11-2.11.1", + urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.tar.gz"], + ) + maybe( http_archive, name = "libyaml",