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
This commit is contained in:
Lukas Dürrenberger 2024-09-13 18:16:37 +02:00
parent 8ff95f7a5e
commit 2dd72be036
3 changed files with 9 additions and 10 deletions

View File

@ -32,6 +32,7 @@ jobs:
- { name: Windows VS2019 x64, os: windows-2019, flags: -DSFML_USE_MESA3D=ON -GNinja }
- { name: Windows VS2022 x86, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -GNinja }
- { name: Windows VS2022 x64, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -GNinja }
- { name: Windows VS2022 arm64, os: windows-2022, flags: -DSFML_USE_MESA3D=OFF -GNinja -DSFML_BUILD_TEST_SUITE=OFF }
- { 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
- { name: Windows VS2022 OpenGL ES, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -DSFML_OPENGL_ES=ON -GNinja }
- { name: Windows VS2022 Unity, os: windows-2022, flags: -DSFML_USE_MESA3D=ON -DCMAKE_UNITY_BUILD=ON -GNinja }
@ -117,7 +118,7 @@ jobs:
if: contains(matrix.platform.name, 'Windows VS') && !contains(matrix.platform.name, 'MSBuild')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ contains(matrix.platform.name, 'x86') && 'x86' || 'x64' }}
arch: ${{ contains(matrix.platform.name, 'arm64') && 'amd64_arm64' || contains(matrix.platform.name, 'x86') && 'x86' || 'x64' }}
# Although the CMake configuration will run with 3.24 on Windows and 3.22
# elsewhere, we install 3.25 on Windows in order to support specifying
@ -237,7 +238,7 @@ jobs:
find build/bin -name test-sfml-window -or -name test-sfml-window.exe -exec sh -c "{} *sf::Context* --section=\"Version String\" --success | grep OpenGL" \;
- name: Test (Windows)
if: runner.os == 'Windows' && !contains(matrix.platform.name, 'MinGW')
if: runner.os == 'Windows' && !contains(matrix.platform.name, 'MinGW') && !contains(matrix.platform.name, 'arm64')
run: cmake --build build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
- name: Test (Linux/macOS/MinGW)
@ -291,7 +292,7 @@ jobs:
ctest --test-dir build --output-on-failure -C ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --repeat until-pass:3
- name: Upload Coverage Report to Coveralls
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' && !contains(matrix.platform.name, 'iOS') && !contains(matrix.platform.name, 'Android') # Disable upload in forks
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
uses: coverallsapp/github-action@v2
with:
file: ./build/coverage.out

View File

@ -6,9 +6,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(OPENGL_ES 0)
# detect the architecture
if(${CMAKE_GENERATOR_PLATFORM} MATCHES "ARM64")
set(ARCH_ARM64 1)
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "ARM64")
if("${CMAKE_GENERATOR_PLATFORM}" MATCHES "ARM64" OR "${MSVC_CXX_ARCHITECTURE_ID}" MATCHES "ARM64" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ARM64")
set(ARCH_ARM64 1)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCH_X86 1)

View File

@ -4,11 +4,11 @@ set(MESA3D_SHA256 "FEF8A643689414A70347AE8027D24674DEFD85E8D6428C8A9D4145BB3F44A
get_filename_component(MESA3D_ARCHIVE "${MESA3D_URL}" NAME)
get_filename_component(MESA3D_ARCHIVE_DIRECTORY "${MESA3D_URL}" NAME_WLE)
if(${ARCH_X64})
if(ARCH_X64)
set(MESA3D_ARCH "x64")
elseif(${ARCH_X86})
elseif(ARCH_X86)
set(MESA3D_ARCH "x86")
else()
elseif(SFML_USE_MESA3D)
message(FATAL_ERROR "Mesa 3D does currently not support the target architecture.")
endif()
@ -61,7 +61,7 @@ if(SFML_OS_WINDOWS AND SFML_USE_MESA3D)
add_custom_target(install-mesa3d DEPENDS ${MESA3D_INSTALLED_FILES})
set_target_properties(install-mesa3d PROPERTIES EXCLUDE_FROM_ALL ON)
elseif(SFML_OS_WINDOWS AND EXISTS "${MESA3D_ARCH_PATH}")
elseif(SFML_OS_WINDOWS AND MESA3D_ARCH AND EXISTS "${MESA3D_ARCH_PATH}")
# we are removing the files
# compile a list of file names that we have to remove