Skip to content

Commit d2447cc

Browse files
committed
fix dynamic library .pyd support
* should fix bazelbuild#17117 * related to bazelbuild/rules_cc#501 * needed to fix pybind/pybind11_bazel#124
1 parent 6ce603d commit d2447cc

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/main/java/com/google/devtools/build/lib/rules/cpp/ArtifactCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
public enum ArtifactCategory {
2424
STATIC_LIBRARY("lib", ".a", ".lib"),
2525
ALWAYSLINK_STATIC_LIBRARY("lib", ".lo", ".lo.lib"),
26-
DYNAMIC_LIBRARY("lib", ".so", ".dylib", ".dll", ".wasm"),
26+
DYNAMIC_LIBRARY("lib", ".so", ".dylib", ".dll", ".pyd",".wasm"),
2727
EXECUTABLE("", "", ".exe", ".wasm"),
2828
INTERFACE_LIBRARY("lib", ".ifso", ".tbd", ".if.lib", ".lib"),
2929
PIC_FILE("", ".pic"),

src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,9 @@ def _libraries_from_linking_context(linking_context):
128128
# string.endswith() checks)
129129
def _is_valid_shared_library_name(shared_library_name):
130130
if (shared_library_name.endswith(".so") or
131-
shared_library_name.endswith(".dll") or
132131
shared_library_name.endswith(".dylib") or
132+
shared_library_name.endswith(".dll") or
133+
shared_library_name.endswith(".pyd") or
133134
shared_library_name.endswith(".wasm")):
134135
return True
135136

@@ -549,7 +550,7 @@ def _get_toolchain_global_make_variables(cc_toolchain):
549550
result["CROSSTOOLTOP"] = cc_toolchain._crosstool_top_path
550551
return result
551552

552-
_SHARED_LIBRARY_EXTENSIONS = ["so", "dll", "dylib", "wasm"]
553+
_SHARED_LIBRARY_EXTENSIONS = ["so", "dylib", "dll", "pyd", "wasm"]
553554

554555
def _is_valid_shared_library_artifact(shared_library):
555556
if (shared_library.extension in _SHARED_LIBRARY_EXTENSIONS):

src/main/starlark/builtins_bzl/common/cc/cc_helper_internal.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ _ARCHIVE = [".a", ".lib"]
101101
_PIC_ARCHIVE = [".pic.a"]
102102
_ALWAYSLINK_LIBRARY = [".lo"]
103103
_ALWAYSLINK_PIC_LIBRARY = [".pic.lo"]
104-
_SHARED_LIBRARY = [".so", ".dylib", ".dll", ".wasm"]
104+
_SHARED_LIBRARY = [".so", ".dylib", ".dll", ".pyd", ".wasm"]
105105
_INTERFACE_SHARED_LIBRARY = [".ifso", ".tbd", ".lib", ".dll.a"]
106106
_OBJECT_FILE = [".o", ".obj"]
107107
_PIC_OBJECT_FILE = [".pic.o"]
@@ -175,7 +175,7 @@ _ArtifactCategoryInfo, _unused_new_aci = provider(
175175
_artifact_categories = [
176176
_ArtifactCategoryInfo("STATIC_LIBRARY", "lib", ".a", ".lib"),
177177
_ArtifactCategoryInfo("ALWAYSLINK_STATIC_LIBRARY", "lib", ".lo", ".lo.lib"),
178-
_ArtifactCategoryInfo("DYNAMIC_LIBRARY", "lib", ".so", ".dylib", ".dll", ".wasm"),
178+
_ArtifactCategoryInfo("DYNAMIC_LIBRARY", "lib", ".so", ".dylib", ".dll", ".pyd", ".wasm"),
179179
_ArtifactCategoryInfo("EXECUTABLE", "", "", ".exe", ".wasm"),
180180
_ArtifactCategoryInfo("INTERFACE_LIBRARY", "lib", ".ifso", ".tbd", ".if.lib", ".lib"),
181181
_ArtifactCategoryInfo("PIC_FILE", "", ".pic"),

0 commit comments

Comments
 (0)