mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-15 21:58:06 +08:00
[meson] fix build_machine (#17845)
This commit is contained in:
parent
117cf538f4
commit
37a5a94f48
@ -199,8 +199,8 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/
|
||||
set(BUILD_ARCH $ENV{PROCESSOR_ARCHITECTURE})
|
||||
endif()
|
||||
if(BUILD_ARCH MATCHES "(amd|AMD)64")
|
||||
set(BUILD_CPU_FAM x86_x64)
|
||||
set(BUILD_CPU x86_x64)
|
||||
set(BUILD_CPU_FAM x86_64)
|
||||
set(BUILD_CPU x86_64)
|
||||
elseif(BUILD_ARCH MATCHES "(x|X)86")
|
||||
set(BUILD_CPU_FAM x86)
|
||||
set(BUILD_CPU i686)
|
||||
@ -211,16 +211,41 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/
|
||||
set(BUILD_CPU_FAM arm)
|
||||
set(BUILD_CPU armv7hl)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported host architecture ${BUILD_ARCH}!" )
|
||||
message(FATAL_ERROR "Unsupported host architecture ${BUILD_ARCH}!")
|
||||
endif()
|
||||
else() # TODO: add correct detection for OSX and Linux. Currently only x64 triplets are available in official vcpkg.
|
||||
set(BUILD_CPU_FAM x86_x64)
|
||||
set(BUILD_CPU x86_x64)
|
||||
elseif(CMAKE_HOST_UNIX)
|
||||
# at this stage, CMAKE_HOST_SYSTEM_PROCESSOR is not defined
|
||||
execute_process(
|
||||
COMMAND uname -m
|
||||
OUTPUT_VARIABLE MACHINE
|
||||
COMMAND_ERROR_IS_FATAL ANY)
|
||||
|
||||
if(MACHINE MATCHES "arm64")
|
||||
set(BUILD_CPU_FAM aarch64)
|
||||
set(BUILD_CPU armv8)
|
||||
elseif(MACHINE MATCHES "x86_64|amd64")
|
||||
set(BUILD_CPU_FAM x86_64)
|
||||
set(BUILD_CPU x86_64)
|
||||
elseif(MACHINE MATCHES "x86|i686")
|
||||
set(BUILD_CPU_FAM x86)
|
||||
set(BUILD_CPU i686)
|
||||
elseif(MACHINE MATCHES "i386")
|
||||
set(BUILD_CPU_FAM x86)
|
||||
set(BUILD_CPU i386)
|
||||
else()
|
||||
unset(BUILD_CPU_FAM)
|
||||
unset(BUILD_CPU)
|
||||
|
||||
# https://github.com/mesonbuild/meson/blob/master/docs/markdown/Reference-tables.md#cpu-families
|
||||
message(FATAL_ERROR "Unhandled machine: ${MACHINE}")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Failed to detect the host architecture!")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE MATCHES "(amd|AMD|x|X)64")
|
||||
set(HOST_CPU_FAM x86_x64)
|
||||
set(HOST_CPU x86_x64)
|
||||
set(HOST_CPU_FAM x86_64)
|
||||
set(HOST_CPU x86_64)
|
||||
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "(x|X)86")
|
||||
set(HOST_CPU_FAM x86)
|
||||
set(HOST_CPU i686)
|
||||
@ -283,8 +308,13 @@ function(vcpkg_internal_meson_generate_cross_file _additional_binaries) #https:/
|
||||
else()
|
||||
string(APPEND CROSS "system = 'linux'\n")
|
||||
endif()
|
||||
string(APPEND CROSS "cpu_family = '${BUILD_CPU_FAM}'\n")
|
||||
string(APPEND CROSS "cpu = '${BUILD_CPU}'\n")
|
||||
|
||||
if(DEFINED BUILD_CPU_FAM)
|
||||
string(APPEND CROSS "cpu_family = '${BUILD_CPU_FAM}'\n")
|
||||
endif()
|
||||
if(DEFINED BUILD_CPU)
|
||||
string(APPEND CROSS "cpu = '${BUILD_CPU}'\n")
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_CPU_FAM MATCHES "${HOST_CPU_FAM}" OR VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_UWP)
|
||||
set(_file "${CURRENT_BUILDTREES_DIR}/meson-cross-${TARGET_TRIPLET}.log")
|
||||
|
Loading…
x
Reference in New Issue
Block a user