From a7a15ce3630ddc1517a47acc5ed8f4e96cd0a573 Mon Sep 17 00:00:00 2001 From: Lukas Oyen Date: Thu, 5 Jan 2023 16:27:51 +0100 Subject: [PATCH] fix: add the windows `*.lib` interface file to the `python_headers` library A user might use `python_headers` to build an extension module that does not itself pull in the python shared library. On Windows, this needs to expose the `*.lib` interface file to compile correctly. --- python/repositories.bzl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/repositories.bzl b/python/repositories.bzl index 011d4f9112..25e8f88547 100644 --- a/python/repositories.bzl +++ b/python/repositories.bzl @@ -246,6 +246,12 @@ filegroup( ), ) +cc_import( + name = "interface", + interface_library = "libs/python{python_version_nodot}.lib", + system_provided = True, +) + filegroup( name = "includes", srcs = glob(["include/**/*.h"]), @@ -253,6 +259,10 @@ filegroup( cc_library( name = "python_headers", + deps = select({{ + "@bazel_tools//src/conditions:windows": [":interface"], + "//conditions:default": None, + }}), hdrs = [":includes"], includes = [ "include",