From 671760c474fdcf736d60449ecbbd5583d0e819df Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Tue, 2 Feb 2021 13:52:27 -0500 Subject: [PATCH] vcpkg: Support Windows and arm64 (#478) * Support arm64 default vcpkg triplet * Add default Windows release triplet support --- cmake/vcpkg_helper.cmake | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cmake/vcpkg_helper.cmake b/cmake/vcpkg_helper.cmake index 765c91538..7c979e2ed 100644 --- a/cmake/vcpkg_helper.cmake +++ b/cmake/vcpkg_helper.cmake @@ -19,10 +19,24 @@ if (NOT USE_SYSTEM_DEPENDENCIES) # Set default triplet to Release VCPKG build unless we can't find it if (NOT DEFINED VCPKG_TARGET_TRIPLET) + set(_project_arch "x64") + if (UNIX) + execute_process(COMMAND uname -m + OUTPUT_VARIABLE _SYSTEM_ARCH + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + message(WARNING "No detection of architecture for this platform. Assuming x64") + endif() + if (_SYSTEM_ARCH MATCHES "^[Aa][Aa][Rr][Cc][Hh]64$") + set(_project_arch "arm64") + endif() + if (APPLE) - set(_project_vcpkg_triplet "x64-osx-rel") + set(_project_vcpkg_triplet "${_project_arch}-osx-rel") elseif(UNIX) - set(_project_vcpkg_triplet "x64-linux-rel") + set(_project_vcpkg_triplet "${_project_arch}-linux-rel") + elseif(WIN32) + set(_project_vcpkg_triplet "${_project_arch}-windows-static-md-rel") else() message(FATAL_ERROR "Could not detect default release triplet") endif()