Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions hatch_cpp/tests/test_vcpkg_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def test_explicit_vcpkg_ref_commit_sha(self):
cfg = HatchCppVcpkgConfiguration(vcpkg_ref=sha)
assert cfg.vcpkg_ref == sha

def test_linux_arm64_triplet(self):
cfg = HatchCppVcpkgConfiguration(vcpkg_triplet="arm64-linux")
assert cfg.vcpkg_triplet == "arm64-linux"


class TestResolveVcpkgRef:
"""Tests for _resolve_vcpkg_ref priority logic."""
Expand Down Expand Up @@ -163,6 +167,17 @@ def test_generate_uses_posix_command_paths(self, tmp_path, monkeypatch):
assert "./vcpkg/bootstrap-vcpkg.sh" in commands
assert "./vcpkg/vcpkg install --triplet x64-linux" in commands

def test_generate_detects_linux_arm64_triplet(self, tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
monkeypatch.setattr("hatch_cpp.toolchains.vcpkg.sys_platform", "linux")
monkeypatch.setattr("hatch_cpp.toolchains.vcpkg.platform_machine", lambda: "aarch64")
self._make_vcpkg_env(tmp_path)

cfg = HatchCppVcpkgConfiguration()
commands = cfg.generate(None)

assert "./vcpkg/vcpkg install --triplet arm64-linux" in commands

def test_generate_uses_windows_command_paths(self, tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
monkeypatch.setattr("hatch_cpp.toolchains.vcpkg.sys_platform", "win32")
Expand Down
3 changes: 2 additions & 1 deletion hatch_cpp/toolchains/vcpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
"x86-windows",
"arm-neon-android",
"arm64-android",
"arm64-linux",
"arm64-osx",
"arm64-uwp",
"arm64-windows",
"arm64-windows-static-md",
]
VcpkgPlatformDefaults = {
("linux", "x86_64"): "x64-linux",
# ("linux", "arm64"): "",
("linux", "aarch64"): "arm64-linux",
("darwin", "x86_64"): "x64-osx",
("darwin", "arm64"): "arm64-osx",
("win32", "x86_64"): "x64-windows-static-md",
Expand Down