Skip to content

Commit d0daae2

Browse files
committed
Fix MSVC arch detection for cross-compiling
1 parent 863d732 commit d0daae2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cmake/godotcpp.cmake

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ function(godot_arch_name OUTVAR)
6464
endif()
6565
endif()
6666

67+
# Special case for MSVC cross-compilation
68+
if(DEFINED CMAKE_VS_PLATFORM_NAME)
69+
if(CMAKE_VS_PLATFORM_NAME STREQUAL "Win32")
70+
set(${OUTVAR} "x86_32" PARENT_SCOPE)
71+
return()
72+
elseif(CMAKE_VS_PLATFORM_NAME STREQUAL "x64")
73+
set(${OUTVAR} "x86_64" PARENT_SCOPE)
74+
return()
75+
elseif(CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
76+
set(${OUTVAR} "arm64" PARENT_SCOPE)
77+
return()
78+
endif()
79+
endif()
80+
6781
# Direct match early out.
6882
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCH)
6983
if(ARCH IN_LIST ARCH_LIST)

0 commit comments

Comments
 (0)