Skip to content

Commit 102e5f8

Browse files
committed
Update to SFML 2.6.2
1 parent a757fbf commit 102e5f8

144 files changed

Lines changed: 5460 additions & 1656 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/FindOpenAL.cmake

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2+
# file Copyright.txt or https://cmake.org/licensing for details.
3+
4+
#[=======================================================================[.rst:
5+
FindOpenAL
6+
----------
7+
8+
Finds Open Audio Library (OpenAL).
9+
10+
Projects using this module should use ``#include "al.h"`` to include the OpenAL
11+
header file, **not** ``#include <AL/al.h>``. The reason for this is that the
12+
latter is not entirely portable. Windows/Creative Labs does not by default put
13+
their headers in ``AL/`` and macOS uses the convention ``<OpenAL/al.h>``.
14+
15+
Hints
16+
^^^^^
17+
18+
Environment variable ``$OPENALDIR`` can be used to set the prefix of OpenAL
19+
installation to be found.
20+
21+
By default on macOS, system framework is search first. In other words,
22+
OpenAL is searched in the following order:
23+
24+
1. System framework: ``/System/Library/Frameworks``, whose priority can be
25+
changed via setting the :variable:`CMAKE_FIND_FRAMEWORK` variable.
26+
2. Environment variable ``$OPENALDIR``.
27+
3. System paths.
28+
4. User-compiled framework: ``~/Library/Frameworks``.
29+
5. Manually compiled framework: ``/Library/Frameworks``.
30+
6. Add-on package: ``/opt``.
31+
32+
IMPORTED Targets
33+
^^^^^^^^^^^^^^^^
34+
35+
.. versionadded:: 3.25
36+
37+
This module defines the :prop_tgt:`IMPORTED` target:
38+
39+
``OpenAL::OpenAL``
40+
The OpenAL library, if found.
41+
42+
Result Variables
43+
^^^^^^^^^^^^^^^^
44+
45+
This module defines the following variables:
46+
47+
``OPENAL_FOUND``
48+
If false, do not try to link to OpenAL
49+
``OPENAL_INCLUDE_DIR``
50+
OpenAL include directory
51+
``OPENAL_LIBRARY``
52+
Path to the OpenAL library
53+
``OPENAL_VERSION_STRING``
54+
Human-readable string containing the version of OpenAL
55+
#]=======================================================================]
56+
57+
# For Windows, Creative Labs seems to have added a registry key for their
58+
# OpenAL 1.1 installer. I have added that key to the list of search paths,
59+
# however, the key looks like it could be a little fragile depending on
60+
# if they decide to change the 1.00.0000 number for bug fix releases.
61+
# Also, they seem to have laid down groundwork for multiple library platforms
62+
# which puts the library in an extra subdirectory. Currently there is only
63+
# Win32 and I have hardcoded that here. This may need to be adjusted as
64+
# platforms are introduced.
65+
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
66+
# I do not know if the Nvidia OpenAL SDK has a registry key.
67+
68+
find_path(OPENAL_INCLUDE_DIR al.h
69+
HINTS
70+
ENV OPENALDIR
71+
PATHS
72+
~/Library/Frameworks
73+
/Library/Frameworks
74+
/opt
75+
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
76+
PATH_SUFFIXES include/AL include/OpenAL include AL OpenAL
77+
)
78+
79+
find_library(OPENAL_LIBRARY
80+
NAMES OpenAL al openal OpenAL32 openal32
81+
HINTS
82+
ENV OPENALDIR
83+
PATHS
84+
~/Library/Frameworks
85+
/Library/Frameworks
86+
/opt
87+
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
88+
PATH_SUFFIXES libx32 lib64 lib libs64 libs
89+
)
90+
91+
include(FindPackageHandleStandardArgs)
92+
find_package_handle_standard_args(
93+
OpenAL
94+
REQUIRED_VARS OPENAL_LIBRARY OPENAL_INCLUDE_DIR
95+
VERSION_VAR OPENAL_VERSION_STRING
96+
)
97+
98+
mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
99+
100+
if(OPENAL_INCLUDE_DIR AND OPENAL_LIBRARY)
101+
if(NOT TARGET OpenAL::OpenAL)
102+
if(EXISTS "${OPENAL_LIBRARY}")
103+
if(WIN32)
104+
get_filename_component(OPENAL_PATH ${OPENAL_LIBRARY} DIRECTORY)
105+
add_library(OpenAL::OpenAL SHARED IMPORTED)
106+
if (ARCH_x86)
107+
set(DLL_PATH "${OPENAL_PATH}/../../bin/x86/openal32.dll")
108+
elseif(ARCH_X64)
109+
set(DLL_PATH "${OPENAL_PATH}/../../bin/x64/openal32.dll")
110+
else()
111+
set(DLL_PATH "${OPENAL_PATH}/../../bin/ARM64/openal32.dll")
112+
endif()
113+
set_target_properties(OpenAL::OpenAL PROPERTIES
114+
IMPORTED_LOCATION "${DLL_PATH}"
115+
IMPORTED_IMPLIB "${OPENAL_LIBRARY}")
116+
elseif(APPLE)
117+
if(IS_DIRECTORY "${OPENAL_LIBRARY}")
118+
# Framework bundle directory: search for the binary inside it.
119+
find_file(OPENAL_FULL_PATH OpenAL OpenAL.tbd PATHS "${OPENAL_LIBRARY}" REQUIRED)
120+
add_library(OpenAL::OpenAL SHARED IMPORTED)
121+
set_target_properties(OpenAL::OpenAL PROPERTIES
122+
IMPORTED_LOCATION "${OPENAL_FULL_PATH}")
123+
else()
124+
# Plain dylib (e.g. Homebrew openal-soft on macOS 15 where
125+
# OpenAL.framework is no longer present in the system).
126+
add_library(OpenAL::OpenAL SHARED IMPORTED)
127+
set_target_properties(OpenAL::OpenAL PROPERTIES
128+
IMPORTED_LOCATION "${OPENAL_LIBRARY}")
129+
endif()
130+
else()
131+
add_library(OpenAL::OpenAL UNKNOWN IMPORTED)
132+
set_target_properties(OpenAL::OpenAL PROPERTIES
133+
IMPORTED_LOCATION "${OPENAL_LIBRARY}")
134+
endif()
135+
else()
136+
add_library(OpenAL::OpenAL INTERFACE IMPORTED)
137+
set_target_properties(OpenAL::OpenAL PROPERTIES
138+
IMPORTED_LIBNAME "${OPENAL_LIBRARY}")
139+
endif()
140+
set_target_properties(OpenAL::OpenAL PROPERTIES
141+
INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}")
142+
endif()
143+
endif()

.github/scripts/build-sfml-unix.sh

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
version="${1:?SFML version is required}"
6+
prefix="${2:?install prefix is required}"
7+
install_deps="${3:-0}"
8+
openal_prefix=""
9+
10+
cmake_args=(
11+
-G Ninja
12+
-DBUILD_SHARED_LIBS=ON
13+
-DCMAKE_BUILD_TYPE=Release
14+
"-DCMAKE_INSTALL_PREFIX=${prefix}"
15+
-DCMAKE_INSTALL_LIBDIR=lib
16+
-DSFML_BUILD_DOC=OFF
17+
-DSFML_BUILD_EXAMPLES=OFF
18+
-DSFML_BUILD_TEST_SUITE=OFF
19+
)
20+
21+
if [[ -f "${prefix}/include/SFML/Config.hpp" ]]; then
22+
exit 0
23+
fi
24+
25+
if [[ "${install_deps}" == "1" ]]; then
26+
if command -v apt-get >/dev/null 2>&1; then
27+
export DEBIAN_FRONTEND=noninteractive
28+
apt-get update
29+
apt-get install -y \
30+
build-essential \
31+
cmake \
32+
git \
33+
libflac-dev \
34+
libfreetype6-dev \
35+
libgl1-mesa-dev \
36+
libjpeg-dev \
37+
libopenal-dev \
38+
libudev-dev \
39+
libvorbis-dev \
40+
libx11-dev \
41+
libxcursor-dev \
42+
libxi-dev \
43+
libxinerama-dev \
44+
libxrandr-dev \
45+
ninja-build \
46+
pkg-config
47+
elif command -v dnf >/dev/null 2>&1; then
48+
dnf install -y \
49+
cmake \
50+
freetype-devel \
51+
gcc-c++ \
52+
git \
53+
libX11-devel \
54+
libXcursor-devel \
55+
libXext-devel \
56+
libXi-devel \
57+
libXinerama-devel \
58+
libXrandr-devel \
59+
libjpeg-turbo-devel \
60+
libudev-devel \
61+
mesa-libGL-devel \
62+
ninja-build \
63+
openal-soft-devel \
64+
pkgconf-pkg-config \
65+
flac-devel \
66+
libvorbis-devel
67+
elif command -v yum >/dev/null 2>&1; then
68+
yum install -y \
69+
cmake \
70+
freetype-devel \
71+
gcc-c++ \
72+
git \
73+
libX11-devel \
74+
libXcursor-devel \
75+
libXext-devel \
76+
libXi-devel \
77+
libXinerama-devel \
78+
libXrandr-devel \
79+
libjpeg-turbo-devel \
80+
libudev-devel \
81+
mesa-libGL-devel \
82+
ninja-build \
83+
openal-soft-devel \
84+
pkgconfig \
85+
flac-devel \
86+
libvorbis-devel
87+
elif command -v brew >/dev/null 2>&1; then
88+
brew update
89+
brew install cmake ninja pkg-config freetype libogg libvorbis flac jpeg-turbo openal-soft
90+
91+
brew_prefix="$(brew --prefix)"
92+
openal_prefix="$(brew --prefix openal-soft)"
93+
macos_rpath="${prefix}/lib;${brew_prefix}/lib;/System/Library/Frameworks;/Library/Frameworks"
94+
cmake_args+=(
95+
-DCMAKE_FIND_FRAMEWORK=LAST
96+
"-DCMAKE_PREFIX_PATH=${brew_prefix}"
97+
"-DOPENAL_LIBRARY=${openal_prefix}/lib/libopenal.dylib"
98+
"-DOPENAL_INCLUDE_DIR=${openal_prefix}/include/AL"
99+
"-DCMAKE_INSTALL_RPATH=${macos_rpath}"
100+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON
101+
)
102+
fi
103+
fi
104+
105+
src_dir="$(mktemp -d)"
106+
build_dir="$(mktemp -d)"
107+
trap 'rm -rf "${src_dir}" "${build_dir}"' EXIT
108+
109+
git clone --branch "${version}" --depth 1 https://github.com/SFML/SFML "${src_dir}"
110+
111+
if [[ -n "${openal_prefix:-}" ]]; then
112+
cp "$(dirname "$0")/FindOpenAL.cmake" "${src_dir}/cmake/Modules/FindOpenAL.cmake"
113+
fi
114+
115+
cmake -S "${src_dir}" -B "${build_dir}" "${cmake_args[@]}"
116+
cmake --build "${build_dir}"
117+
cmake --install "${build_dir}"
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
param(
2+
[Parameter(Mandatory = $true)]
3+
[string]$Version,
4+
[Parameter(Mandatory = $true)]
5+
[string]$Prefix,
6+
[string]$Architecture = "x64"
7+
)
8+
9+
$ErrorActionPreference = "Stop"
10+
11+
$cmakeExe = if ($env:CMAKE_EXE) { $env:CMAKE_EXE } else { "cmake" }
12+
if (Test-Path $cmakeExe -PathType Container) {
13+
$cmakeExe = Join-Path $cmakeExe "cmake.exe"
14+
}
15+
16+
if (-not ($cmakeExe -like "*.exe") -and $cmakeExe -ne "cmake") {
17+
$candidateExe = Join-Path $cmakeExe "cmake.exe"
18+
if (Test-Path $candidateExe -PathType Leaf) {
19+
$cmakeExe = $candidateExe
20+
}
21+
}
22+
23+
if ($cmakeExe -ne "cmake" -and -not (Test-Path $cmakeExe -PathType Leaf)) {
24+
throw "Configured CMake executable was not found: $cmakeExe"
25+
}
26+
27+
$Prefix = [System.IO.Path]::GetFullPath($Prefix)
28+
$configHeader = Join-Path $Prefix "include\SFML\Config.hpp"
29+
30+
if (Test-Path $configHeader) {
31+
exit 0
32+
}
33+
34+
New-Item -ItemType Directory -Force -Path $Prefix | Out-Null
35+
36+
$cmakeInstallPrefix = $Prefix -replace '\\', '/'
37+
38+
$generatorArch = if ($Architecture -eq "x86") { "Win32" } else { "x64" }
39+
$srcDir = Join-Path $env:RUNNER_TEMP "sfml-src"
40+
$buildDir = Join-Path $env:RUNNER_TEMP "sfml-build"
41+
$archivePath = Join-Path $env:RUNNER_TEMP "sfml-src.zip"
42+
43+
if (Test-Path $srcDir) {
44+
Remove-Item $srcDir -Recurse -Force
45+
}
46+
47+
if (Test-Path $buildDir) {
48+
Remove-Item $buildDir -Recurse -Force
49+
}
50+
51+
if (Test-Path $archivePath) {
52+
Remove-Item $archivePath -Force
53+
}
54+
55+
$archiveUrl = "https://github.com/SFML/SFML/archive/refs/tags/$Version.zip"
56+
Invoke-WebRequest -Uri $archiveUrl -OutFile $archivePath
57+
Expand-Archive -Path $archivePath -DestinationPath $env:RUNNER_TEMP -Force
58+
59+
$extractedDir = Join-Path $env:RUNNER_TEMP "SFML-$Version"
60+
if (-not (Test-Path $extractedDir)) {
61+
throw "Downloaded SFML source archive did not extract to expected directory: $extractedDir"
62+
}
63+
64+
Move-Item -Path $extractedDir -Destination $srcDir
65+
& $cmakeExe -S $srcDir -B $buildDir -G "Visual Studio 17 2022" -A $generatorArch `
66+
-DBUILD_SHARED_LIBS=ON `
67+
-DCMAKE_BUILD_TYPE=Release `
68+
"-DCMAKE_INSTALL_PREFIX=$cmakeInstallPrefix" `
69+
-DSFML_BUILD_DOC=OFF `
70+
-DSFML_BUILD_EXAMPLES=OFF `
71+
-DSFML_BUILD_TEST_SUITE=OFF
72+
& $cmakeExe --build $buildDir --config Release
73+
& $cmakeExe --install $buildDir --config Release
74+
75+
if (-not (Test-Path $configHeader)) {
76+
throw "SFML install did not produce expected header: $configHeader"
77+
}

.github/scripts/run-wheel-tests.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python3
2+
3+
from __future__ import annotations
4+
5+
import os
6+
import subprocess
7+
import sys
8+
from pathlib import Path
9+
10+
11+
TEST_FILES = [
12+
"tests/test_smoke_imports.py",
13+
"tests/test_typing_artifacts.py",
14+
]
15+
16+
17+
def sanitized_env() -> dict[str, str]:
18+
env = os.environ.copy()
19+
20+
for name in ("SFML_HEADERS", "SFML_LIBRARIES", "PKG_CONFIG_PATH", "LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH"):
21+
env.pop(name, None)
22+
23+
if os.name == "nt":
24+
blocked = ("c:/cibw-sfml-2.6.2/bin", "c:\\cibw-sfml-2.6.2\\bin")
25+
path_parts = env.get("PATH", "").split(os.pathsep)
26+
env["PATH"] = os.pathsep.join(
27+
part
28+
for part in path_parts
29+
if part and all(token not in part.lower() for token in blocked)
30+
)
31+
32+
return env
33+
34+
35+
def main() -> int:
36+
project_dir = Path(sys.argv[1]).resolve() if len(sys.argv) > 1 else Path.cwd()
37+
command = [sys.executable, "-m", "pytest", "-q", *[str(project_dir / test_file) for test_file in TEST_FILES]]
38+
return subprocess.run(command, cwd=project_dir, env=sanitized_env(), check=False).returncode
39+
40+
41+
if __name__ == "__main__":
42+
raise SystemExit(main())

0 commit comments

Comments
 (0)