Skip to content

Commit 7ab9862

Browse files
committed
Fix library qualified name on windows
1 parent 27d4793 commit 7ab9862

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

hatch_cpp/plugin.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,5 @@ def initialize(self, version: str, build_data: dict[str, t.Any]) -> None:
8383

8484
# force include libraries
8585
for library in libraries:
86-
if build_plan.platform.platform == "win32":
87-
suffix = "dll"
88-
else:
89-
suffix = "so"
90-
build_data["force_include"][f"{library.name}.{suffix}"] = f"{library.name}.{suffix}"
86+
name = library.get_qualified_name(build_plan.platform.platform)
87+
build_data["force_include"][name] = name

hatch_cpp/structs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ class HatchCppLibrary(BaseModel):
5252
export_symbols: List[str] = Field(default_factory=list, alias="export-symbols")
5353
depends: List[str] = Field(default_factory=list)
5454

55+
def get_qualified_name(self, platform):
56+
if platform == "win32":
57+
suffix = "dll" if self.binding == "none" else "pyd"
58+
elif platform == "darwin" and self.binding == "none":
59+
suffix = "dylib"
60+
else:
61+
suffix = "so"
62+
return f"{self.name}.{suffix}"
63+
5564

5665
class HatchCppPlatform(BaseModel):
5766
cc: str

0 commit comments

Comments
 (0)