Author SHA1 Message Date
Chris Thrasher e0b3a8e28d Add more sfKeyboard tests 2025-01-13 15:53:31 -07:00
8 changed files with 96 additions and 329 deletions

No files matched your search

+2 -2
View File
@@ -79,7 +79,7 @@ jobs:
path: CSFML
- name: Build in an ARM container
uses: uraimo/run-on-arch-action@v2.8.1
uses: uraimo/run-on-arch-action@v2.7.2
with:
arch: armv7
distro: ubuntu22.04
@@ -111,7 +111,7 @@ jobs:
path: CSFML
- name: Build in an ARM64 container
uses: uraimo/run-on-arch-action@v2.8.1
uses: uraimo/run-on-arch-action@v2.7.2
with:
arch: aarch64
distro: ubuntu22.04
-314
View File
@@ -1,314 +0,0 @@
name: Release Builds
on:
push:
branches:
- master
- 2.6.x
tags:
- "**"
workflow_dispatch: {}
concurrency:
group: release-${{github.ref}}
cancel-in-progress: true
jobs:
windows-x86:
name: Windows x86
runs-on: windows-2022
steps:
- name: Cache MinGW x86
id: mingw-x86-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/mingw32
key: 14.2.0posix-19.1.1-12.0.0-ucrt-r2-x86
- name: Install MinGW x86
if: steps.mingw-x86-cache.outputs.cache-hit != 'true'
uses: bwoodsend/setup-winlibs-action@v1
id: winlibs-32
with:
tag: 14.2.0posix-19.1.1-12.0.0-ucrt-r2
with_clang: false
architecture: 32
destination: ${{ github.workspace }}
add_to_path: false
- name: Checkout SFML
uses: actions/checkout@v4
with:
repository: SFML/SFML
ref: 3.0.0
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -A Win32 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-install -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build --config Release --target install
- name: Build CSFML
run: |
cmake -S CSFML -B CSFML-build -A Win32 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=ON -DCSFML_LINK_SFML_STATICALLY=OFF -DCMAKE_BUILD_TYPE=Release -DSFML_ROOT=${{ github.workspace }}/SFML-install -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-install -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build --config Release --target install
- name: Add MinGW to PATH
shell: bash
run: echo "${{ github.workspace }}\mingw32\bin" >> $GITHUB_PATH
- name: Generate Import Libs for MinGW
shell: pwsh
run: |
New-Item -ItemType "directory" -PATH "CSFML-install\lib\gcc"
New-Item -ItemType "directory" -PATH "CSFML-install\lib\msvc"
Move-Item -Path "CSFML-install\lib\*.lib" -Destination "CSFML-install\lib\msvc"
Push-Location CSFML-install\lib\gcc
& gendef.exe "..\..\bin\csfml-graphics-3.dll"
& dlltool.exe -d "csfml-graphics-3.def" -D "..\..\bin\csfml-graphics-3.dll" -l "libcsfml-graphics.a"
Remove-Item -Path "csfml-graphics-3.def"
& gendef.exe "..\..\bin\csfml-window-3.dll"
& dlltool.exe -d "csfml-window-3.def" -D "..\..\bin\csfml-window-3.dll" -l "libcsfml-window.a"
Remove-Item -Path "csfml-window-3.def"
& gendef.exe "..\..\bin\csfml-audio-3.dll"
& dlltool.exe -d "csfml-audio-3.def" -D "..\..\bin\csfml-audio-3.dll" -l "libcsfml-audio.a"
Remove-Item -Path "csfml-audio-3.def"
& gendef.exe "..\..\bin\csfml-network-3.dll"
& dlltool.exe -d "csfml-network-3.def" -D "..\..\bin\csfml-network-3.dll" -l "libcsfml-network.a"
Remove-Item -Path "csfml-network-3.def"
& gendef.exe "..\..\bin\csfml-system-3.dll"
& dlltool.exe -d "csfml-system-3.def" -D "..\..\bin\csfml-system-3.dll" -l "libcsfml-system.a"
Remove-Item -Path "csfml-system-3.def"
Pop-Location
New-Item -ItemType "directory" -PATH "install\CSFML"
Move-Item -Path "CSFML-install\*" -Destination "install\CSFML"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-windows-32-bit
path: install/CSFML
windows-x64:
name: Windows x64
runs-on: windows-2022
steps:
- name: Cache MinGW x64
id: mingw-x64-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/mingw64
key: 14.2.0posix-19.1.1-12.0.0-ucrt-r2-x64
- name: Install MinGW x64
if: steps.mingw-x64-cache.outputs.cache-hit != 'true'
uses: bwoodsend/setup-winlibs-action@v1
id: winlibs-64
with:
tag: 14.2.0posix-19.1.1-12.0.0-ucrt-r2
with_clang: false
architecture: 64
destination: ${{ github.workspace }}
add_to_path: false
- name: Checkout SFML
uses: actions/checkout@v4
with:
repository: SFML/SFML
ref: 3.0.0
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -A x64 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-install -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build --config Release --target install
- name: Build CSFML
run: |
cmake -S CSFML -B CSFML-build -A x64 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=ON -DCSFML_LINK_SFML_STATICALLY=OFF -DCMAKE_BUILD_TYPE=Release -DSFML_ROOT=${{ github.workspace }}/SFML-install -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-install -DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build --config Release --target install
- name: Add MinGW to PATH
shell: bash
run: echo "${{ github.workspace }}\mingw64\bin" >> $GITHUB_PATH
- name: Generate Import Libs for MinGW
shell: pwsh
run: |
New-Item -ItemType "directory" -PATH "CSFML-install\lib\gcc"
New-Item -ItemType "directory" -PATH "CSFML-install\lib\msvc"
Move-Item -Path "CSFML-install\lib\*.lib" -Destination "CSFML-install\lib\msvc"
Push-Location CSFML-install\lib\gcc
& gendef.exe "..\..\bin\csfml-graphics-3.dll"
& dlltool.exe -d "csfml-graphics-3.def" -D "..\..\bin\csfml-graphics-3.dll" -l "libcsfml-graphics.a"
Remove-Item -Path "csfml-graphics-3.def"
& gendef.exe "..\..\bin\csfml-window-3.dll"
& dlltool.exe -d "csfml-window-3.def" -D "..\..\bin\csfml-window-3.dll" -l "libcsfml-window.a"
Remove-Item -Path "csfml-window-3.def"
& gendef.exe "..\..\bin\csfml-audio-3.dll"
& dlltool.exe -d "csfml-audio-3.def" -D "..\..\bin\csfml-audio-3.dll" -l "libcsfml-audio.a"
Remove-Item -Path "csfml-audio-3.def"
& gendef.exe "..\..\bin\csfml-network-3.dll"
& dlltool.exe -d "csfml-network-3.def" -D "..\..\bin\csfml-network-3.dll" -l "libcsfml-network.a"
Remove-Item -Path "csfml-network-3.def"
& gendef.exe "..\..\bin\csfml-system-3.dll"
& dlltool.exe -d "csfml-system-3.def" -D "..\..\bin\csfml-system-3.dll" -l "libcsfml-system.a"
Remove-Item -Path "csfml-system-3.def"
Pop-Location
New-Item -ItemType "directory" -PATH "install\CSFML"
Move-Item -Path "CSFML-install\*" -Destination "install\CSFML"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-windows-64-bit
path: install/CSFML
macos-x64:
name: macOS x64
runs-on: macos-13
steps:
- name: Checkout SFML
uses: actions/checkout@v4
with:
repository: SFML/SFML
ref: 3.0.0
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-install \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DSFML_BUILD_FRAMEWORKS=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build --config Release --target install
- name: Build CSFML
run: |
cmake -S CSFML -B CSFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-install \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DSFML_ROOT=${{ github.workspace }}/SFML-install \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build --config Release --target install
- name: Create Archive
run: |
mkdir CSFML-macOS-clang-64-bit
cp -R CSFML-install/include CSFML-macOS-clang-64-bit
cp -R CSFML-install/lib CSFML-macOS-clang-64-bit
cp CSFML-install/share/CSFML/* CSFML-macOS-clang-64-bit
tar -zcvf CSFML-macOS-clang-64-bit.tar.gz CSFML-macOS-clang-64-bit
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-macOS-clang-64-bit
path: CSFML-macOS-clang-64-bit.tar.gz
macos-arm64:
name: macOS ARM64
runs-on: macos-14
steps:
- name: Checkout SFML
uses: actions/checkout@v4
with:
repository: SFML/SFML
ref: 3.0.0
path: SFML
- name: Checkout CSFML
uses: actions/checkout@v4
with:
path: CSFML
- name: Build SFML
run: |
cmake -S SFML -B SFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-install \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DSFML_BUILD_FRAMEWORKS=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build SFML-build --config Release --target install
- name: Build CSFML
run: |
cmake -S CSFML -B CSFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-install \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DSFML_ROOT=${{ github.workspace }}/SFML-install \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake --build CSFML-build --config Release --target install
- name: Create Archive
run: |
mkdir CSFML-macOS-clang-arm64
cp -R CSFML-install/include CSFML-macOS-clang-arm64
cp -R CSFML-install/lib CSFML-macOS-clang-arm64
cp CSFML-install/share/CSFML/* CSFML-macOS-clang-arm64
tar -zcvf CSFML-macOS-clang-arm64.tar.gz CSFML-macOS-clang-arm64
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: CSFML-macOS-clang-arm64
path: CSFML-macOS-clang-arm64.tar.gz
+2 -2
View File
@@ -38,8 +38,8 @@ add_custom_target(doc ALL
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${INSTALL_MISC_DIR}/doc
COMPONENT doc)
if(DOXYGEN_GENERATE_HTMLHELP)
install(FILES ${DOXYGEN_OUTPUT_DIR}/CSFML.chm
if(DOXYGEN_HHC_PROGRAM)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CSFML.chm
DESTINATION ${INSTALL_MISC_DIR}/doc
COMPONENT doc)
endif()
+43
View File
@@ -26,4 +26,47 @@ TEST_CASE("[Window] sfKeyboard")
STATIC_CHECK(sfScanD == static_cast<int>(sf::Keyboard::Scan::D));
STATIC_CHECK(sfScancodeCount == sf::Keyboard::ScancodeCount);
}
SECTION("sfKeyboard_isKeyPressed")
{
CHECK(!sfKeyboard_isKeyPressed(sfKeyW));
CHECK(!sfKeyboard_isKeyPressed(sfKeyA));
CHECK(!sfKeyboard_isKeyPressed(sfKeyS));
CHECK(!sfKeyboard_isKeyPressed(sfKeyD));
}
SECTION("sfKeyboard_isScancodePressed")
{
CHECK(!sfKeyboard_isScancodePressed(sfScanW));
CHECK(!sfKeyboard_isScancodePressed(sfScanA));
CHECK(!sfKeyboard_isScancodePressed(sfScanS));
CHECK(!sfKeyboard_isScancodePressed(sfScanD));
}
SECTION("sfKeyboard_localize")
{
CHECK(sfKeyboard_localize(sfScanSpace) == sfKeySpace);
}
SECTION("sfKeyboard_delocalize")
{
CHECK(sfKeyboard_delocalize(sfKeySpace) == sfScanSpace);
}
SECTION("sfKeyboard_getDescription")
{
using namespace std::string_literals;
CHECK(sfKeyboard_getDescription(sfScanF1) == "F1"s);
CHECK(sfKeyboard_getDescription(sfScanF2) == "F2"s);
CHECK(sfKeyboard_getDescription(sfScanF3) == "F3"s);
CHECK(sfKeyboard_getDescription(sfScanF4) == "F4"s);
CHECK(sfKeyboard_getDescription(sfScanF5) == "F5"s);
CHECK(sfKeyboard_getDescription(sfScanF6) == "F6"s);
CHECK(sfKeyboard_getDescription(sfScanF7) == "F7"s);
CHECK(sfKeyboard_getDescription(sfScanF8) == "F8"s);
CHECK(sfKeyboard_getDescription(sfScanF9) == "F9"s);
CHECK(sfKeyboard_getDescription(sfScanF10) == "F10"s);
CHECK(sfKeyboard_getDescription(sfScanF11) == "F11"s);
CHECK(sfKeyboard_getDescription(sfScanF12) == "F12"s);
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
#!/bin/sh
VERSION="3.0.0"
VERSION_C="3.0.0"
VERSION="2.6.1"
VERSION_C="2.6.0"
# BUILD_CSFML=FALSE
BUILD_CSFML=TRUE
BUILD_SFML=FALSE
+1 -1
View File
@@ -42,7 +42,7 @@ echo "Please note that all SFML dependencies must be installed and available to
RID="$1"
SFMLBranch="3.0.0" # The branch or tag of the SFML repository to be cloned
SFMLBranch="master" # The branch or tag of the SFML repository to be cloned
CSFMLDir="$(realpath ../../)" # The directory of the source code of CSFML
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
+33 -4
View File
@@ -46,7 +46,7 @@ echo "Please note that all SFML dependencies must be installed and available to
RID="$1"
SFMLBranch="3.0.0" # The branch or tag of the SFML repository to be cloned
SFMLBranch="master" # The branch or tag of the SFML repository to be cloned
CSFMLDir="$(grealpath "$(git rev-parse --show-toplevel)")" # The directory of the source code of CSFML
OutDir="./CSFML/runtimes/$RID/native" # The base directory of all CSFML modules, used to copy the final libraries
@@ -146,12 +146,39 @@ cmake -E env \
"$CSFMLDir"
cmake --build . --config Release --target install
# ======================================== #
# STEP 5: Copy result to the NuGet folders #
# ======================================== #
# ============================ #
# STEP 5: Fix RPATH references #
# ============================ #
SFMLMajorMinor="3.0"
SFMLMajorMinorPatch="$SFMLMajorMinor.0"
# SFML's framework dependencies will always reference @rpath/../Frameworks/<depedency>
# Which is not where we place the frameworks and where SFML should look for them
# This this fixes the dependency with install_name_tool
fixrpath()
{
MODULE="$1"
OLD="$2"
NEW="$3"
install_name_tool -change $OLD $NEW "$SFMLLibDir/libsfml-$MODULE.dylib"
install_name_tool -change $OLD $NEW "$SFMLLibDir/libsfml-$MODULE.$SFMLMajorMinor.dylib"
install_name_tool -change $OLD $NEW "$SFMLLibDir/libsfml-$MODULE.$SFMLMajorMinorPatch.dylib"
}
fixrpath audio "@rpath/../Frameworks/vorbisenc.framework/Versions/A/vorbisenc" "@rpath/vorbisenc.framework/Versions/A/vorbisen"
fixrpath audio "@rpath/../Frameworks/vorbisfile.framework/Versions/A/vorbisfile" "@rpath/vorbisfile.framework/Versions/A/vorbisfile"
fixrpath audio "@rpath/../Frameworks/vorbis.framework/Versions/A/vorbis" "@rpath/vorbis.framework/Versions/A/vorbis"
fixrpath audio "@rpath/../Frameworks/ogg.framework/Versions/A/ogg" "@rpath/ogg.framework/Versions/A/ogg"
fixrpath audio "@rpath/../Frameworks/FLAC.framework/Versions/A/FLAC" "@rpath/FLAC.framework/Versions/A/FLAC"
fixrpath graphics "@rpath/../Frameworks/freetype.framework/Versions/A/freetype" "@rpath/freetype.framework/Versions/A/freetype"
# ======================================== #
# STEP 6: Copy result to the NuGet folders #
# ======================================== #
CSFMLMajorMinor="3.0"
CSFMLMajorMinorPatch="$CSFMLMajorMinor.0"
@@ -181,6 +208,8 @@ copymodule graphics
copymodule system
copymodule window
cp -R "$SFMLLibDir/lib/"*.framework "$OutDir"
popd # Pop CSFML
popd # Pop $RID
popd # Pop Build
+13 -4
View File
@@ -35,7 +35,7 @@ Write-Output "Building $RID"
Write-Output "Using $Generator as the cmake generator"
Write-Output "Using architecture $Architecture"
$SFMLBranch = "3.0.0" # The branch or tag of the SFML repository to be cloned
$SFMLBranch = "master" # The branch or tag of the SFML repository to be cloned
$CSFMLDir = (Get-Item (git rev-parse --show-toplevel)).FullName # The directory of the source code of CSFML
$OutDir = "./CSFML/runtimes/$RID/native" # The directory of all CSFML modules, used to copy the final dlls
@@ -83,9 +83,17 @@ Push-Location "SFML"
$SFMLDir = (Get-Item .).FullName
IF ($RID -ne 'win-x86' -and $RID -ne 'win-x64') {
Write-Error "Unknown RID '$RID'"
exit
switch ($RID) {
'win-x86' {
$SFMLExtLibs = (Get-Item ./extlibs/libs-msvc-universal/x86).FullName
}
'win-x64' {
$SFMLExtLibs = (Get-Item ./extlibs/libs-msvc-universal/x64).FullName
}
Default {
Write-Error "Unknown RID '$RID'"
exit
}
}
Pop-Location # Pop SFML
@@ -134,6 +142,7 @@ $CSFMLLibDir = (Get-Item lib).FullName; # The directory where the final CSFML dl
cmake `
"-DSFML_ROOT=$SFMLInstallDir" `
'-DCSFML_LINK_SFML_STATICALLY=OFF' `
"-DCMAKE_LIBRARY_PATH=$SFMLExtLibs" `
`
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$CSFMLLibDir" `
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=$CSFMLLibDir" `