Skip to content

Commit

Permalink
Windows: Fix ARM64 target detection when using -A ARM64,version=...
Browse files Browse the repository at this point in the history
… notation.
  • Loading branch information
MikuAuahDark committed Dec 1, 2024
1 parent 8c4c865 commit afe097c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_MEGATEMP_CHECKVAR MSVC_CXX_ARCHITECTURE_ID)
endif()
# FIXME: Code below also duplicates MEGA_X64 architecture assignment.
if(${_MEGATEMP_CHECKVAR} STREQUAL "ARM64")
if(${${_MEGATEMP_CHECKVAR}} MATCHES "^ARM64")
set(MEGA_ARM64 TRUE)
set(MEGA_ARCH ARM64)
else()
Expand Down Expand Up @@ -145,9 +145,12 @@ if(MSVC)
else()
set(MEGA_MSVC_VCVARSALL_BAT_ARG "-arch=x86")
endif()
math(EXPR VS_TOOLCHAIN_VERSION_MAJOR "${VSVERSION} / 10")
math(EXPR VS_TOOLCHAIN_VERSION_MINOR "${VSVERSION} % 10")
set(MEGA_MSVC_VCVARSALL_BAT_ARG "${MEGA_MSVC_VCVARSALL_BAT_ARG} -vcvars_ver=${VS_TOOLCHAIN_VERSION_MAJOR}.${VS_TOOLCHAIN_VERSION_MINOR}")
# If we're using MSVC, then the vcvars_ver can be extracted from the MSVC linker version.
# If we're somehow using Clang, then it won't work, but it's fine. VsDevCmd will use highest vcvars_ver available.
string(REGEX MATCH "^([0-9]+)\\.([0-9]+)" VSVERSION_MATCH ${CMAKE_C_COMPILER_LINKER_VERSION})
if(VSVERSION_MATCH)
set(MEGA_MSVC_VCVARSALL_BAT_ARG "${MEGA_MSVC_VCVARSALL_BAT_ARG} -vcvars_ver=${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
endif()
else()
message(STATUS "Found vcvarsall.bat")
if(MEGA_X86)
Expand Down

0 comments on commit afe097c

Please sign in to comment.