Skip to content

Commit

Permalink
Enable examples for easier testing for now, fix macos isssues
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrilRBS committed Sep 18, 2024
1 parent 2e8de73 commit 07c0706
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 1 deletion.
8 changes: 8 additions & 0 deletions recipes/sfml/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ patches:
- patch_file: "patches/3.0.0-0001-use-zlib-bzip-freetype-conan.patch"
patch_description: "use zlib bzip2 and freetype from conan"
patch_type: "conan"
# TODO: Delete this one when this gets released in a future rc or final version
- patch_file: "patches/3.0.0-0002-windows-arm-build.patch"
patch_description: "fix windows arm build"
patch_type: "backport"

Check warning on line 13 in recipes/sfml/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. found arbitrary text in patch_type: backport ^ (line: 13)
patch_source: "https://github.com/SFML/SFML/pull/3229"
- patch_file: "patches/3.0.0-0003-conan-choose-osx-deplyment-target.patch"
patch_description: "let conan choose osx deployment target"
patch_type: "conan"
9 changes: 8 additions & 1 deletion recipes/sfml/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,17 @@ def generate(self):
tc.cache_variables["SFML_USE_MESA3D"] = False # self.options.use_mesa3d

tc.variables["SFML_INSTALL_PKGCONFIG_FILES"] = False
tc.variables["SFML_CONFIGURE_EXTRAS"] = False
# TODO: Back to false when no more testing is needed
tc.variables["SFML_CONFIGURE_EXTRAS"] = True
# TODO: Remove when no longer testing, this is useful for now to check
tc.variables["SFML_BUILD_EXAMPLES"] = True

tc.cache_variables["SFML_WARNINGS_AS_ERRORS"] = False

# TODO: Remove in Conan 2
if not self.settings.compiler.cppstd:
tc.cache_variables["CMAKE_CXX_STANDARD"] = self._min_cppstd

# tc.cache_variables["SFML_MISC_INSTALL_PREFIX"] = os.path.join(self.package_folder, "licenses").replace("\\", "/")

tc.generate()
Expand Down
96 changes: 96 additions & 0 deletions recipes/sfml/all/patches/3.0.0-0002-windows-arm-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From 64c4c96fa14ffa3fd90ae49df33cca5ba6044034 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20D=C3=BCrrenberger?= <[email protected]>
Date: Fri, 13 Sep 2024 18:16:37 +0200
Subject: [PATCH] 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
---
.github/workflows/ci.yml | 7 ++++---
cmake/Config.cmake | 4 +---
cmake/Mesa3D.cmake | 8 ++++----
3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 317d348261..013c69f1ff 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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
diff --git a/cmake/Config.cmake b/cmake/Config.cmake
index 35dc26ede6..7e5e0c7957 100644
--- a/cmake/Config.cmake
+++ b/cmake/Config.cmake
@@ -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)
diff --git a/cmake/Mesa3D.cmake b/cmake/Mesa3D.cmake
index e5970fa754..2889fc64fa 100644
--- a/cmake/Mesa3D.cmake
+++ b/cmake/Mesa3D.cmake
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64f663f..d0e24da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ endif()

# determine whether to create a debug or release build
sfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
-sfml_set_option(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" STRING "The minimal iOS version that will be able to run the built binaries. Cannot be lower than 13.0")
+# sfml_set_option(CMAKE_OSX_DEPLOYMENT_TARGET "13.0" STRING "The minimal iOS version that will be able to run the built binaries. Cannot be lower than 13.0")

# project name
project(SFML VERSION 3.0.0 LANGUAGES CXX)

0 comments on commit 07c0706

Please sign in to comment.