cmake: fix host target detection

This commit is contained in:
Jacob Young 2022-12-05 01:52:24 -05:00 committed by Andrew Kelley
parent f421efbcc1
commit 687ea31ef9

View File

@ -723,7 +723,20 @@ else()
set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000")
endif()
string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}-${CMAKE_HOST_SYSTEM_NAME}" HOST_TARGET_TRIPLE)
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
set(HOST_TARGET_ARCH "x86_64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
set(HOST_TARGET_ARCH "aarch64")
else()
string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" HOST_TARGET_ARCH)
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(HOST_TARGET_OS "macos")
else()
string(TOLOWER "${CMAKE_HOST_SYSTEM_NAME}" HOST_TARGET_OS)
endif()
set(HOST_TARGET_TRIPLE "${HOST_TARGET_ARCH}-${HOST_TARGET_OS}")
set(ZIG1_WASM_SOURCE "${CMAKE_SOURCE_DIR}/stage1/zig1.wasm.zst")
set(ZIG1_C_SOURCE "${CMAKE_BINARY_DIR}/zig1.c")
set(ZIG2_C_SOURCE "${CMAKE_BINARY_DIR}/zig2.c")