mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
Improve detection of the target architecture on Apple platforms. (#34054)
This commit is contained in:
parent
681e510ff1
commit
cc97b4536a
@ -268,6 +268,39 @@ else()
|
|||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
||||||
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022")
|
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022")
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
|
||||||
|
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED CMAKE_OSX_ARCHITECTURES)
|
||||||
|
list(LENGTH CMAKE_OSX_ARCHITECTURES Z_VCPKG_OSX_ARCH_COUNT)
|
||||||
|
if(Z_VCPKG_OSX_ARCH_COUNT EQUAL "0")
|
||||||
|
message(WARNING "Unable to determine target architecture. "
|
||||||
|
"Consider providing a value for the CMAKE_OSX_ARCHITECTURES cache variable. "
|
||||||
|
"Continuing without vcpkg.")
|
||||||
|
set(VCPKG_TOOLCHAIN ON)
|
||||||
|
cmake_policy(POP)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(Z_VCPKG_OSX_ARCH_COUNT GREATER "1")
|
||||||
|
message(WARNING "Detected more than one target architecture. Using the first one.")
|
||||||
|
endif()
|
||||||
|
list(GET CMAKE_OSX_ARCHITECTURES "0" Z_VCPKG_OSX_TARGET_ARCH)
|
||||||
|
if(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "arm64")
|
||||||
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
||||||
|
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "arm64s")
|
||||||
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64s)
|
||||||
|
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "armv7s")
|
||||||
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH armv7s)
|
||||||
|
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "armv7")
|
||||||
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
|
||||||
|
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "x86_64")
|
||||||
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
|
||||||
|
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "i386")
|
||||||
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
|
||||||
|
else()
|
||||||
|
message(WARNING "Unable to determine target architecture, continuing without vcpkg.")
|
||||||
|
set(VCPKG_TOOLCHAIN ON)
|
||||||
|
cmake_policy(POP)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
find_program(Z_VCPKG_CL cl)
|
find_program(Z_VCPKG_CL cl)
|
||||||
if(Z_VCPKG_CL MATCHES "amd64/cl.exe$" OR Z_VCPKG_CL MATCHES "x64/cl.exe$")
|
if(Z_VCPKG_CL MATCHES "amd64/cl.exe$" OR Z_VCPKG_CL MATCHES "x64/cl.exe$")
|
||||||
@ -278,39 +311,6 @@ else()
|
|||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
||||||
elseif(Z_VCPKG_CL MATCHES "bin/cl.exe$" OR Z_VCPKG_CL MATCHES "x86/cl.exe$")
|
elseif(Z_VCPKG_CL MATCHES "bin/cl.exe$" OR Z_VCPKG_CL MATCHES "x86/cl.exe$")
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
|
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
|
||||||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
||||||
list(LENGTH CMAKE_OSX_ARCHITECTURES Z_VCPKG_OSX_ARCH_COUNT)
|
|
||||||
if(Z_VCPKG_OSX_ARCH_COUNT EQUAL "0")
|
|
||||||
message(WARNING "Unable to determine target architecture. "
|
|
||||||
"Consider providing a value for the CMAKE_OSX_ARCHITECTURES cache variable. "
|
|
||||||
"Continuing without vcpkg.")
|
|
||||||
set(VCPKG_TOOLCHAIN ON)
|
|
||||||
cmake_policy(POP)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(Z_VCPKG_OSX_ARCH_COUNT GREATER "1")
|
|
||||||
message(WARNING "Detected more than one target architecture. Using the first one.")
|
|
||||||
endif()
|
|
||||||
list(GET CMAKE_OSX_ARCHITECTURES "0" Z_VCPKG_OSX_TARGET_ARCH)
|
|
||||||
if(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "arm64")
|
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64)
|
|
||||||
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "arm64s")
|
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm64s)
|
|
||||||
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "armv7s")
|
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH armv7s)
|
|
||||||
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "armv7")
|
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH arm)
|
|
||||||
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "x86_64")
|
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH x64)
|
|
||||||
elseif(Z_VCPKG_OSX_TARGET_ARCH STREQUAL "i386")
|
|
||||||
set(Z_VCPKG_TARGET_TRIPLET_ARCH x86)
|
|
||||||
else()
|
|
||||||
message(WARNING "Unable to determine target architecture, continuing without vcpkg.")
|
|
||||||
set(VCPKG_TOOLCHAIN ON)
|
|
||||||
cmake_policy(POP)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
|
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
|
||||||
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64" OR
|
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64" OR
|
||||||
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64")
|
CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "amd64")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user