diff --git a/hatch_cpp/tests/test_vcpkg_ref.py b/hatch_cpp/tests/test_vcpkg_ref.py index 614c55c..897cf0d 100644 --- a/hatch_cpp/tests/test_vcpkg_ref.py +++ b/hatch_cpp/tests/test_vcpkg_ref.py @@ -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.""" @@ -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") diff --git a/hatch_cpp/toolchains/vcpkg.py b/hatch_cpp/toolchains/vcpkg.py index a9bd722..464464d 100644 --- a/hatch_cpp/toolchains/vcpkg.py +++ b/hatch_cpp/toolchains/vcpkg.py @@ -24,6 +24,7 @@ "x86-windows", "arm-neon-android", "arm64-android", + "arm64-linux", "arm64-osx", "arm64-uwp", "arm64-windows", @@ -31,7 +32,7 @@ ] 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",