Skip to content

Commit 8f2ee3c

Browse files
committed
Improve and fix the AppImage and MacOS builds.
1 parent 63f44d2 commit 8f2ee3c

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ jobs:
5151
- name: Install Dependencies
5252
run: |
5353
echo "Installing dependencies"
54-
brew install meson ninja create-dmg glew libarchive
54+
brew install meson ninja create-dmg libarchive
55+
56+
# Install glew 2.2.0 because the latest version doesn't ship with a static library anymore
57+
brew tap-new hades/dependencies
58+
brew extract --version=2.2.0 glew hades/dependencies
59+
brew install hades/dependencies/glew@2.2.0
5560
5661
- name: Build the SDL3
5762
run: |
@@ -221,7 +226,7 @@ jobs:
221226
- name: Build Hades
222227
run: |
223228
# Setup the Meson project
224-
meson setup build --buildtype=release -Dstatic_sdl3=true --prefix=/usr
229+
meson setup build --buildtype=release -Dstatic_sdl3=true -Dwith_wayland=false --prefix=/usr
225230
226231
# Build & Install the project
227232
DESTDIR=$(pwd)/AppDir ninja -C build install

meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ if get_option('static_executable')
4343
ldflags += ['-static']
4444
endif
4545

46+
if get_option('with_wayland')
47+
cflags += ['-DWITH_WAYLAND']
48+
ldflags += ['-DWITH_WAYLAND']
49+
endif
50+
4651
debugger_cflags = ['-DWITH_DEBUGGER']
4752
debugger_ldflags = ['-DWITH_DEBUGGER']
4853

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
option('with_debugger', type: 'boolean', value: false, description: 'Build hades with its builtin debugger.')
2+
option('with_wayland', type: 'boolean', value: true, description: 'Will try to use wayland (if available) by default on Linux.')
23
option('static_executable', type: 'boolean', value: false, description: 'Build hades as a static executable.')
34
option('static_dependencies', type: 'boolean', value: false, description: 'Similar to `static_executable\' but only link the external dependencies and not the system ones.')
45
option('static_glew', type: 'boolean', value: false, description: 'Link statically against glew.')

resource/linux/AppImageBuilder.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ AppDir:
3636
- libgtk-3-0
3737
- libgtk-3-common
3838
- libglew2.2
39-
- libdecor-0-0
40-
- libdecor-0-plugin-1-cairo
4139
- librsvg2-common # See https://github.com/hades-emu/Hades/issues/102
40+
- libwayland-client0
4241

4342
files:
4443
include: []

source/app/main.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,15 @@ SDL_AppInit(
7171
if (!app->args.without_gui) {
7272

7373
#if defined(__linux__)
74+
#if defined(WITH_WAYLAND)
7475
// On Linux, hint at SDL that we are using Wayland if WAYLAND_DISPLAY is set.
7576
if (getenv("WAYLAND_DISPLAY")) {
7677
SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "wayland");
7778
}
79+
#else
80+
SDL_SetHint(SDL_HINT_VIDEO_DRIVER, "x11");
81+
#endif
7882
#endif
79-
80-
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD | SDL_INIT_AUDIO)) {
81-
logln(HS_ERROR, "Failed to init the SDL: %s", SDL_GetError());
82-
return SDL_APP_FAILURE;
83-
}
8483

8584
SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING, "Hades");
8685
SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_VERSION_STRING, HADES_VERSION);
@@ -90,6 +89,11 @@ SDL_AppInit(
9089
SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_URL_STRING, "https://hades-emu.org");
9190
SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_TYPE_STRING, "application");
9291

92+
if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD | SDL_INIT_AUDIO)) {
93+
logln(HS_ERROR, "Failed to init the SDL: %s", SDL_GetError());
94+
return SDL_APP_FAILURE;
95+
}
96+
9397
app_sdl_audio_init(app);
9498
app_sdl_video_init(app);
9599

0 commit comments

Comments
 (0)