tensorflow/third_party/pybind11_protobuf/protobuf.patch
Vadym Matsishevskyi 5720ab7845 Introduce pywrap bazel rules and migrate Tensorflow to it
The gist of this change (the new rules implementation) is contained within `rules_pywrap` folder. The rules are generic and not tensorflow-specific

1) (internal-specific)

2) (internal-specific)

3) It provides same linking strategy of final artifacts on all 3 supported platforms (no major differences between Linux, Mac and Windows).

4) It makes it possible to abandon usage of header-only targets to prevent ODR violations. Simply speaking you can now depend on generated protobuf message classes normally, without need to worry how that is linked afterwards.

5) The current version is backward-compatible and unless explicitly enabled is a no-op. To enable the new rules pass `--repo_env=USE_PYWRAP_RULES=True` flag to build/test command.

6) The `if_pywrap` construct is temporary and will be removed once full migration is completed. Currently if_pywrap is mainly used to pass normal dependencies (instead of header-only). The header-only stuff is kept for backward compatibility and smoother migration but will be eventually removed.

7) This CL migrates TF and the most problematic among all google ML repositories. Once TF is sabilized the other repositories, such as JAX and XLA will be migrated too (which should be way easier than migrating TF anyways)

PiperOrigin-RevId: 684324990
2024-10-10 00:12:03 -07:00

20 lines
786 B
Diff

diff --git a/pybind11_protobuf/BUILD b/pybind11_protobuf/BUILD
--- a/pybind11_protobuf/BUILD (revision 80f3440cd8fee124e077e2e47a8a17b78b451363)
+++ b/pybind11_protobuf/BUILD (date 1714533560692)
@@ -53,8 +53,8 @@
"proto_caster_impl.h",
],
local_defines = select({
- ":enable_pyproto_api_setting": ["PYBIND11_PROTOBUF_ENABLE_PYPROTO_API"],
- "//conditions:default": [],
+ ":enable_pyproto_api_setting": ["PROTOBUF_USE_DLLS", "PYBIND11_PROTOBUF_ENABLE_PYPROTO_API"],
+ "//conditions:default": ["PROTOBUF_USE_DLLS"],
}),
deps = [
":check_unknown_fields",
@@ -95,4 +95,5 @@
"@com_google_absl//absl/synchronization",
"@com_google_protobuf//:protobuf",
],
+ local_defines = ["PROTOBUF_USE_DLLS"],
)