Skip to content

[3.0] Update SDL and ClangSharp#2570

Open
Exanite wants to merge 44 commits intodevelop/3.0from
feature/update-sdl
Open

[3.0] Update SDL and ClangSharp#2570
Exanite wants to merge 44 commits intodevelop/3.0from
feature/update-sdl

Conversation

@Exanite
Copy link
Copy Markdown
Member

@Exanite Exanite commented Apr 17, 2026

Summary of the PR

This PR updates ClangSharp and SDL. This was originally part of #2567, but proved to be a more involved change than anticipated due to SDL build problems.

Related issues, Discord discussions, or proposals

This will fix #2402
This PR should also be closed since this PR effectively supersedes it: #2433

Further Comments

Tasks

Native builds

(Currently disabling this command by adding a space; the builds are already committed so there's no reason to run them again)
/ build-native SDL OpenAL-Soft

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

File Coverage
All files 16%

Minimum allowed coverage is 0%

Generated by 🐒 cobertura-action against ad14c0e

@Exanite Exanite mentioned this pull request Apr 17, 2026
7 tasks
Exanite added 6 commits April 17, 2026 23:45
(cherry picked from commit 7938a0c)
(cherry picked from commit b0db2ba)
(cherry picked from commit 156aa5c)
armv7s seems to be legacy.

(cherry picked from commit 25b0e27)
@Exanite Exanite force-pushed the feature/update-sdl branch from 8622118 to dc21675 Compare April 18, 2026 03:48
Exanite and others added 16 commits April 18, 2026 01:40
CMAKE_LIBRARY_ARCHITECTURE fixes the issue where system libraries weren't being found.
Eg: "SDL_X11                     (Wanted: ON): ON" was OFF without this setting.
Eg: "Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so " was a not found error without this setting.

I removed the pkg-config settings since they didn't seem to do anything and I couldn't figure out if they were correct in the first place.
I'm assuming CMake figures these out automatically (it should automatically find the host version of the pkg-config executable and I'm *assuming* (please verify) it uses the CMAKE_LIBRARY_ARCHITECTURE variable to figure out which set of .pc files to use).
x64/amd64 is handled the same way for consistency.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

All native library builds modified in this PR shall attempt to be built by CI.

Exanite added 2 commits April 19, 2026 02:22
This is because it otherwise gets confusing in the "run project" dropdown.
Copy link
Copy Markdown
Member Author

@Exanite Exanite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self code review complete. My review comments mainly explain why the changes were made. I didn't make an effort to comment how the code works this time though. This is because I want to rework this setup eventually.

set(PKG_CONFIG_EXECUTABLE "/usr/bin/${ZIG_ARCH}-${ZIG_OS}-${LINUX_ABI}-pkg-config")
set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/${ZIG_ARCH}-${ZIG_OS}-${LINUX_ABI}/pkgconfig")
set(ENV{PKG_CONFIG_PATH} "/usr/lib/pkgconfig:/usr/share/pkgconfig")
set(CMAKE_FIND_ROOT_PATH "/usr/${ZIG_ARCH}-${ZIG_OS}-${LINUX_ABI}")
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This folder doesn't exist on Ubuntu and the include, lib, and bin folders instead have the following format:

/usr/bin/{target-triple}
/usr/include/{target-triple}
/usr/lib/{target-triple}

Setting CMAKE_LIBRARY_ARCHITECTURE lets CMake find these automatically.

Copy link
Copy Markdown
Member Author

@Exanite Exanite Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefixed the OpenAL example project name and folder name since it was confusing in the "run project" dropdown of Rider (and maybe other IDEs).

git submodule update --init --recursive --depth 1 ..\..\..\eng\submodules\openal-soft
)

call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" arm64
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arm64 seems to work when using MSVC, but breaks for Clang. Using amd64_arm64 specifies the host_target setting properly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also verified that the output binary is arm64 as intended.
Image

rm -rf build
mkdir build
cd build
cmake ../../../../eng/submodules/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos "-DCMAKE_OSX_ARCHITECTURES=arm64;armv7s" -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

armv7s was breaking the build since Xcode doesn't support it anymore. Looking it up online also shows that armv7s is old and unsupported.

mkdir build
cd build
cmake ../../../../eng/submodules/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos "-DCMAKE_OSX_ARCHITECTURES=arm64;armv7s" -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON
cmake ../../../../eng/submodules/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos "-DCMAKE_OSX_ARCHITECTURES=arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON -DSDL_TEST_LIBRARY=OFF
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DSDL_TEST_LIBRARY was defaulting to ON and led to some build issues on Linux x64. I've updated all the build scripts to consistently disable it.

Comment thread sources/SDL/Native/build-linux-x64.sh Outdated
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev \
libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev
pkg-config cmake ninja-build gnome-desktop-testing \
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These also specify :amd64 purely for consistency.

Comment thread sources/SDL/Native/build-linux-arm.sh Outdated
Comment thread sources/SDL/Native/build-linux-arm.sh Outdated
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev \
libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev
pkg-config cmake ninja-build gnome-desktop-testing \
libglib2.0-dev-bin \
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executables must use the host architecture, so they are unsuffixed.
Compile dependencies must use the target architecture, so they are suffixed (armhf in this case).

Comment thread Silk.NET.sln Outdated
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenAL", "OpenAL", "{662A1AEC-91F2-48FA-AA29-6F27038D30F2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tutorial001.HelloSound", "examples\CSharp\OpenAL\Tutorial001.HelloSound\Tutorial001.HelloSound.csproj", "{946C912C-5BBB-446A-A566-0D1696D19F59}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAL.Tutorial001.HelloSound", "examples\CSharp\OpenAL\OpenAL.Tutorial001.HelloSound\OpenAL.Tutorial001.HelloSound.csproj", "{946C912C-5BBB-446A-A566-0D1696D19F59}"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll probably convert this .sln file to an .slnx file as my next PR and ensure that Nuke works with the new format (should work after updating Nuke).

@Exanite Exanite marked this pull request as ready for review April 19, 2026 07:02
@Exanite Exanite requested a review from a team as a code owner April 19, 2026 07:02
@Exanite Exanite marked this pull request as draft April 19, 2026 07:05
@Exanite Exanite marked this pull request as ready for review April 19, 2026 07:09
@Exanite Exanite changed the title [3.0] Update SDL [3.0] Update SDL and ClangSharp Apr 19, 2026
@Exanite Exanite marked this pull request as draft April 20, 2026 19:18
@github-actions
Copy link
Copy Markdown
Contributor

Some of the native library builds modified in this PR were not referenced in the PR description. Please ensure that the PR description contains /build-native OpenAL-Soft SDL. These libraries won't be rebuilt without this being specified. If you believe this is in error, then please write a comment explaining why and ignore this suggestion. This comment will be automatically updated if rectified.

Copy link
Copy Markdown
Member Author

@Exanite Exanite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self code review completed for the new changes I added.
Should be ready for review and merging now.


if [ ! -e ../../../eng/submodules/openal-soft/CMakeLists.txt ]; then
git submodule update --init --recursive --depth 1 ../../../eng/submodules/openal-soft
# Dependencies
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added marker comments to each script to make the code easier to skim and to enforce a light structure to the scripts.

I also made each script follow the "dependencies, submodule, build" section order.
In case we have exceptions to this rule in the future, we should explain with a comment.

Note I plan to further rework these in a separate PR.

cmake python3 libpipewire-0.3-dev:armhf qt6-base-dev:armhf pulseaudio:armhf \
gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
else
if [[ -z ${SILKDOTNET_DockerBuild+x} ]]; then
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reordered this so that it matches the actual execution order, which is to enter Docker, then install packages.

exit
else
dpkg --add-architecture armhf
apt-get update
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very subtle detail, but apt-get is recommended for scripting purposes. apt is for human usage.

Reference: https://manpages.debian.org/stretch/apt/apt.8.en.html

sudo apt install -y libasound2-dev:amd64 libpulse-dev:amd64 libsoundio-dev:amd64 libsndfile1-dev:amd64 \
libmysofa-dev:amd64 qtbase5-dev:amd64 libdbus-1-dev:amd64 libjack-dev:amd64 portaudio19-dev:amd64 git \
cmake build-essential python3 libpipewire-0.3-dev:amd64 qt6-base-dev:amd64 pulseaudio:amd64
sudo apt-get update
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm debating whether to add a Debian docker container step here as well.
Currently x64 builds on Ubuntu while ARM builds on Debian.

I'll experiment with this in a separate PR.

@Exanite Exanite marked this pull request as ready for review April 30, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants