Skip to content

Commit 2dd72be

Browse files
committed
Fix Windows ARM64 support with regards to Mesa 3D
- Only fail the Mesa 3D arch check, if it's been enabled - Add a cross-compilation CI job for Windows ARM64 - Fix ARM64 architecture detection for the Ninja generator
1 parent 8ff95f7 commit 2dd72be

3 files changed

Lines changed: 9 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
- { name: Windows VS2019 x64, os: windows-2019, flags: -DSFML_USE_MESA3D=ON -GNinja }
3333
- { name: Windows VS2022 x86, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -GNinja }
3434
- { name: Windows VS2022 x64, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -GNinja }
35+
- { name: Windows VS2022 arm64, os: windows-2022, flags: -DSFML_USE_MESA3D=OFF -GNinja -DSFML_BUILD_TEST_SUITE=OFF }
3536
- { name: Windows VS2022 ClangCL MSBuild, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -T ClangCL } # ninja doesn't support specifying the toolset, so use the ClangCL toolset to test building with MSBuild as well
3637
- { name: Windows VS2022 OpenGL ES, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -DSFML_OPENGL_ES=ON -GNinja }
3738
- { name: Windows VS2022 Unity, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -DCMAKE_UNITY_BUILD=ON -GNinja }
@@ -117,7 +118,7 @@ jobs:
117118
if: contains(matrix.platform.name, 'Windows VS') && !contains(matrix.platform.name, 'MSBuild')
118119
uses: ilammy/msvc-dev-cmd@v1
119120
with:
120-
arch: ${{ contains(matrix.platform.name, 'x86') && 'x86' || 'x64' }}
121+
arch: ${{ contains(matrix.platform.name, 'arm64') && 'amd64_arm64' || contains(matrix.platform.name, 'x86') && 'x86' || 'x64' }}
121122

122123
# Although the CMake configuration will run with 3.24 on Windows and 3.22
123124
# elsewhere, we install 3.25 on Windows in order to support specifying
@@ -237,7 +238,7 @@ jobs:
237238
find build/bin -name test-sfml-window -or -name test-sfml-window.exe -exec sh -c "{} *sf::Context* --section=\"Version String\" --success | grep OpenGL" \;
238239
239240
- name: Test (Windows)
240-
if: runner.os == 'Windows' && !contains(matrix.platform.name, 'MinGW')
241+
if: runner.os == 'Windows' && !contains(matrix.platform.name, 'MinGW') && !contains(matrix.platform.name, 'arm64')
241242
run: cmake --build build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
242243

243244
- name: Test (Linux/macOS/MinGW)
@@ -291,7 +292,7 @@ jobs:
291292
ctest --test-dir build --output-on-failure -C ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --repeat until-pass:3
292293
293294
- name: Upload Coverage Report to Coveralls
294-
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' && !contains(matrix.platform.name, 'iOS') && !contains(matrix.platform.name, 'Android') # Disable upload in forks
295+
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' && !contains(matrix.platform.name, 'iOS') && !contains(matrix.platform.name, 'Android') && !contains(matrix.platform.name, 'arm64') # Disable upload in forks
295296
uses: coverallsapp/github-action@v2
296297
with:
297298
file: ./build/coverage.out

cmake/Config.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
66
set(OPENGL_ES 0)
77

88
# detect the architecture
9-
if(${CMAKE_GENERATOR_PLATFORM} MATCHES "ARM64")
10-
set(ARCH_ARM64 1)
11-
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "ARM64")
9+
if("${CMAKE_GENERATOR_PLATFORM}" MATCHES "ARM64" OR "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ARM64")
1210
set(ARCH_ARM64 1)
1311
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
1412
set(ARCH_X86 1)

cmake/Mesa3D.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ set(MESA3D_SHA256 "FEF8A643689414A70347AE8027D24674DEFD85E8D6428C8A9D4145BB3F44A
44
get_filename_component(MESA3D_ARCHIVE "${MESA3D_URL}" NAME)
55
get_filename_component(MESA3D_ARCHIVE_DIRECTORY "${MESA3D_URL}" NAME_WLE)
66

7-
if(${ARCH_X64})
7+
if(ARCH_X64)
88
set(MESA3D_ARCH "x64")
9-
elseif(${ARCH_X86})
9+
elseif(ARCH_X86)
1010
set(MESA3D_ARCH "x86")
11-
else()
11+
elseif(SFML_USE_MESA3D)
1212
message(FATAL_ERROR "Mesa 3D does currently not support the target architecture.")
1313
endif()
1414

@@ -61,7 +61,7 @@ if(SFML_OS_WINDOWS AND SFML_USE_MESA3D)
6161
add_custom_target(install-mesa3d DEPENDS ${MESA3D_INSTALLED_FILES})
6262

6363
set_target_properties(install-mesa3d PROPERTIES EXCLUDE_FROM_ALL ON)
64-
elseif(SFML_OS_WINDOWS AND EXISTS "${MESA3D_ARCH_PATH}")
64+
elseif(SFML_OS_WINDOWS AND MESA3D_ARCH AND EXISTS "${MESA3D_ARCH_PATH}")
6565
# we are removing the files
6666

6767
# compile a list of file names that we have to remove

0 commit comments

Comments
 (0)