Skip to content

Commit a305cd2

Browse files
committed
Migrate to SDL3/OGL3
1 parent 6ed9922 commit a305cd2

File tree

184 files changed

+6835
-67455
lines changed

Some content is hidden

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

184 files changed

+6835
-67455
lines changed

.github/workflows/codeql.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,20 @@ jobs:
3939
run: sudo apt-get update -qq
4040

4141
- name: Install dependencies
42-
run: sudo apt-get install -y libsdl2-dev libgtk-3-dev
42+
run: |
43+
sudo apt-get install -y build-essential cmake libgtk-3-dev \
44+
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev \
45+
libxi-dev libxss-dev libxkbcommon-dev libwayland-dev libdecor-0-dev \
46+
libdrm-dev libgbm-dev libgl1-mesa-dev libegl1-mesa-dev libdbus-1-dev libudev-dev
47+
48+
- name: Build and install SDL3
49+
run: |
50+
SDL3_TAG=$(curl -s https://api.github.com/repos/libsdl-org/SDL/releases/latest | jq -r '.tag_name')
51+
echo "Building SDL3 $SDL3_TAG"
52+
git clone --depth 1 --branch "$SDL3_TAG" https://github.com/libsdl-org/SDL.git /tmp/SDL3
53+
cmake -S /tmp/SDL3 -B /tmp/SDL3/build -DCMAKE_INSTALL_PREFIX=/usr -DSDL_TESTS=OFF -DSDL_EXAMPLES=OFF
54+
cmake --build /tmp/SDL3/build -j$(nproc)
55+
sudo cmake --install /tmp/SDL3/build
4356
4457
- name: Get build number
4558
run: |

.github/workflows/geargrafx.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ jobs:
4141
- name: Update OS
4242
run: sudo apt-get update -qq
4343
- name: Install dependencies
44-
run: sudo apt-get install -y libsdl2-dev libgtk-3-dev
44+
run: sudo apt-get install -y build-essential cmake libgtk-3-dev
45+
- name: Build and install SDL3
46+
run: |
47+
SDL3_TAG=$(curl -s https://api.github.com/repos/libsdl-org/SDL/releases/latest | jq -r '.tag_name')
48+
echo "Building SDL3 $SDL3_TAG"
49+
git clone --depth 1 --branch "$SDL3_TAG" https://github.com/libsdl-org/SDL.git /tmp/SDL3
50+
cmake -S /tmp/SDL3 -B /tmp/SDL3/build -DCMAKE_INSTALL_PREFIX=/usr -DSDL_TESTS=OFF -DSDL_EXAMPLES=OFF
51+
cmake --build /tmp/SDL3/build -j$(nproc)
52+
sudo cmake --install /tmp/SDL3/build
4553
- name: Get build number
4654
run: |
4755
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
@@ -73,7 +81,15 @@ jobs:
7381
- name: Update OS
7482
run: sudo apt-get update -qq
7583
- name: Install dependencies
76-
run: sudo apt-get install -y libsdl2-dev libgtk-3-dev
84+
run: sudo apt-get install -y build-essential cmake libgtk-3-dev
85+
- name: Build and install SDL3
86+
run: |
87+
SDL3_TAG=$(curl -s https://api.github.com/repos/libsdl-org/SDL/releases/latest | jq -r '.tag_name')
88+
echo "Building SDL3 $SDL3_TAG"
89+
git clone --depth 1 --branch "$SDL3_TAG" https://github.com/libsdl-org/SDL.git /tmp/SDL3
90+
cmake -S /tmp/SDL3 -B /tmp/SDL3/build -DCMAKE_INSTALL_PREFIX=/usr -DSDL_TESTS=OFF -DSDL_EXAMPLES=OFF
91+
cmake --build /tmp/SDL3/build -j$(nproc)
92+
sudo cmake --install /tmp/SDL3/build
7793
- name: Get build number
7894
run: |
7995
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
@@ -124,7 +140,7 @@ jobs:
124140
with:
125141
fetch-depth: 0
126142
- name: Install dependencies
127-
run: brew install sdl2
143+
run: brew install sdl3
128144
- name: Get build number
129145
run: |
130146
echo "BUILD_NUMBER=$(git describe --abbrev=7 --dirty --always --tags)" >> $GITHUB_ENV
@@ -147,6 +163,7 @@ jobs:
147163
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
148164
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
149165
166+
codesign -v -f -o runtime --sign "$MACOS_CERTIFICATE_NAME" ${{ env.NAME_UPPER }}.app/Contents/Frameworks/libSDL3.0.dylib
150167
codesign -v -f -o runtime --entitlements "app.entitlements" --sign "$MACOS_CERTIFICATE_NAME" ${{ env.NAME_UPPER }}.app/Contents/MacOS/${{ env.NAME_LOWER }}
151168
codesign -v -f -o runtime --sign "$MACOS_CERTIFICATE_NAME" ${{ env.NAME_UPPER }}.app
152169
@@ -231,7 +248,7 @@ jobs:
231248
uses: vmactions/freebsd-vm@v1
232249
with:
233250
usesh: true
234-
prepare: pkg install -y git gmake pkgconf sdl2 lang/gcc gtk3
251+
prepare: pkg install -y git gmake pkgconf sdl3 lang/gcc gtk3
235252
run: |
236253
cd platforms/bsd
237254
gmake

.vscode/c_cpp_properties.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"intelliSenseMode": "linux-gcc-x64",
99
"includePath": [
1010
"${workspaceFolder}/**",
11-
"/usr/include/SDL2"
11+
"/usr/include"
1212
],
1313
"browse": {
1414
"path": ["${workspaceFolder}"]
@@ -22,7 +22,7 @@
2222
"intelliSenseMode": "macos-clang-arm64",
2323
"includePath": [
2424
"${workspaceFolder}/**",
25-
"/opt/homebrew/include/SDL2"
25+
"/opt/homebrew/include"
2626
],
2727
"macFrameworkPath": ["/System/Library/Frameworks", "/Library/Frameworks"],
2828
"browse": {

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Don't hesitate to report bugs or ask for new features by [opening an issue](http
101101

102102
**Notes:**
103103
- **Windows**: May need [Visual C++ Redistributable](https://go.microsoft.com/fwlink/?LinkId=746572) and [OpenGL Compatibility Pack](https://apps.microsoft.com/detail/9nqpsl29bfff)
104-
- **Linux**: May need `libsdl2`
104+
- **Linux**: May need `libsdl3`
105105

106106
## Features
107107

@@ -176,7 +176,7 @@ For complete setup instructions and tool documentation, see [MCP_README.md](MCP_
176176
- Run these commands to generate a Mac *app* bundle:
177177

178178
``` shell
179-
brew install sdl2
179+
brew install sdl3
180180
cd platforms/macos
181181
make dist
182182
```
@@ -185,24 +185,38 @@ make dist
185185

186186
- Ubuntu / Debian / Raspberry Pi (Raspbian):
187187

188+
If you are using Ubuntu 25.04 or later, you can install SDL3 directly. Use the following commands to build:
189+
190+
``` shell
191+
sudo apt install build-essential libsdl3-dev libgtk-3-dev
192+
cd platforms/linux
193+
make
194+
```
195+
196+
For older Ubuntu versions (22.04, 24.04), you need to build SDL3 from source first. Use the following commands to build both SDL3 and Geargrafx:
197+
188198
``` shell
189-
sudo apt install build-essential libsdl2-dev libgtk-3-dev
199+
sudo apt install build-essential cmake libgtk-3-dev
200+
git clone --depth 1 --branch release-3.4.x https://github.com/libsdl-org/SDL.git /tmp/SDL3
201+
cmake -S /tmp/SDL3 -B /tmp/SDL3/build -DCMAKE_INSTALL_PREFIX=/usr -DSDL_TESTS=OFF -DSDL_EXAMPLES=OFF
202+
cmake --build /tmp/SDL3/build -j$(nproc)
203+
sudo cmake --install /tmp/SDL3/build
190204
cd platforms/linux
191205
make
192206
```
193207

194208
- Fedora:
195209

196210
``` shell
197-
sudo dnf install @development-tools gcc-c++ SDL2-devel gtk3-devel
211+
sudo dnf install @development-tools gcc-c++ SDL3-devel gtk3-devel
198212
cd platforms/linux
199213
make
200214
```
201215

202216
- Arch Linux:
203217

204218
``` shell
205-
sudo pacman -S base-devel sdl2 gtk3
219+
sudo pacman -S base-devel sdl3 gtk3
206220
cd platforms/linux
207221
make
208222
```
@@ -212,15 +226,15 @@ make
212226
- FreeBSD:
213227

214228
``` shell
215-
su root -c "pkg install -y git gmake pkgconf SDL2 lang/gcc gtk3"
229+
su root -c "pkg install -y git gmake pkgconf SDL3 lang/gcc gtk3"
216230
cd platforms/bsd
217231
gmake
218232
```
219233

220234
- NetBSD:
221235

222236
``` shell
223-
su root -c "pkgin install gmake pkgconf SDL2 lang/gcc gtk3"
237+
su root -c "pkgin install gmake pkgconf SDL3 lang/gcc gtk3"
224238
cd platforms/bsd
225239
gmake
226240
```

platforms/bsd/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
include ../shared/makefiles/Makefile.sources
22

3-
SOURCES_CXX += $(DEPS_DIR)/nfd/nfd_gtk.cpp
4-
CPPFLAGS += `pkg-config --cflags gtk+-3.0`
5-
LDFLAGS += `pkg-config --libs gtk+-3.0`
6-
73
include ../shared/makefiles/Makefile.common

platforms/linux/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
include ../shared/makefiles/Makefile.sources
22

3-
SOURCES_CXX += $(DEPS_DIR)/nfd/nfd_gtk.cpp
4-
CPPFLAGS += `pkg-config --cflags gtk+-3.0`
5-
LDFLAGS += `pkg-config --libs gtk+-3.0`
6-
73
include ../shared/makefiles/Makefile.common

platforms/macos/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
include ../shared/makefiles/Makefile.sources
22

3-
SOURCES_MM += $(DEPS_DIR)/nfd/nfd_cocoa.mm
43
SOURCES_MM += macos.mm
54
OBJECTS += $(SOURCES_MM:.mm=.o)
6-
LDFLAGS += -framework AppKit -framework UniformTypeIdentifiers
5+
LDFLAGS += -framework AppKit
76

87
include ../shared/makefiles/Makefile.common
98

@@ -16,6 +15,10 @@ bundle:
1615
cp iconfile.icns $(APP_NAME).app/Contents/Resources/
1716
cp $(TARGET) $(APP_NAME).app/Contents/MacOS/
1817
cp run.sh $(APP_NAME).app/Contents/MacOS/
18+
$(eval SDL3_DYLIB := $(shell otool -L $(TARGET) | grep libSDL3 | awk '{print $$1}'))
19+
cp $(SDL3_DYLIB) $(APP_NAME).app/Contents/Frameworks/
20+
chmod 755 $(APP_NAME).app/Contents/Frameworks/libSDL3.0.dylib
21+
install_name_tool -change $(SDL3_DYLIB) @executable_path/../Frameworks/libSDL3.0.dylib $(APP_NAME).app/Contents/MacOS/$(TARGET)
1922
mkdir -p $(APP_NAME).app/Contents/Resources/mcp
2023
cp ../shared/gamecontrollerdb.txt $(APP_NAME).app/Contents/Resources/
2124
cp -r ../shared/desktop/mcp/resources $(APP_NAME).app/Contents/Resources/mcp/

0 commit comments

Comments
 (0)