Skip to content

Commit a7a9493

Browse files
committed
fix flatpak installer build
1 parent 4661750 commit a7a9493

File tree

7 files changed

+56
-12
lines changed

7 files changed

+56
-12
lines changed

com.github.mgerhold.OOPetris.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ modules:
2121
config-opts:
2222
- -Dbuildtype=release
2323
- -Ddefault_library=shared
24-
- -Dflatpak_build=true
24+
- -Dbuild_installer=true
2525
- --libdir=lib
2626
- -Dtests=true
2727
builddir: true

meson.options

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
option(
2-
'flatpak_build',
2+
'build_installer',
33
type: 'boolean',
44
value: false,
5-
description: 'enable flatpak build features',
5+
description: 'build the installer, this is either a flatpak or windows exe installer or similar',
66
)
77

88
option(

src/helper/graphic_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ std::vector<std::string> utils::supported_features() {
6767
if (!resource_path) {
6868
throw std::runtime_error{ "Failed in getting the Pref Path: " + std::string{ SDL_GetError() } };
6969
}
70-
// if you build in BUILD_INSTALLER mode, you have to assure that the data is there eg. music + fonts!
70+
// if you build in BUILD_INSTALLER mode, you have to assure that the data is there e.g. music + fonts!
7171
#endif
7272
return std::filesystem::path{ std::string{ resource_path } } / "assets";
7373
#else

src/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,8 @@ liboopetris_graphics_dep = declare_dependency(
124124
dependencies: graphics_lib.get('deps'),
125125
version: meson.project_version(),
126126
)
127+
128+
# setting this to strings, so += {...} gets detected as an error, if it is done after that
129+
core_lib = 'undefined'
130+
recordings_lib = 'undefined'
131+
graphics_lib = 'undefined'

tools/dependencies/meson.build

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,52 @@ utf8cpp_dep = dependency(
262262
)
263263
core_lib += {'deps': [core_lib.get('deps'), utf8cpp_dep]}
264264

265-
is_flatpak_build = get_option('flatpak_build')
265+
266+
build_installer = get_option('build_installer')
267+
268+
is_flatpak_build = false
269+
270+
# some sanity checks for the installer
271+
if build_installer
272+
if get_option('buildtype') != 'release'
273+
error(
274+
'buildtype needs to be \'release\', when building the installer, but was: ' +
275+
get_option('buildtype'),
276+
)
277+
endif
278+
279+
if host_machine.system() == 'linux'
280+
if get_option('prefix') == '/app'
281+
is_flatpak_build = true
282+
else
283+
error(
284+
'only support flatpak builds, when building the installer for linux',
285+
)
286+
endif
287+
elif host_machine.system() == 'windows'
288+
error('windows installer is still WIP')
289+
else
290+
error(
291+
'unsuported system for building the installer: ' + host_machine.system(),
292+
)
293+
294+
endif
295+
296+
endif
297+
298+
299+
300+
if is_flatpak_build
301+
app_name = 'com.github.mgerhold.OOPetris'
302+
core_lib += {
303+
'compile_args': [
304+
core_lib.get('compile_args'),
305+
'-DFLATPAK_BUILD',
306+
'-DBUILD_INSTALLER',
307+
],
308+
}
309+
endif
310+
266311

267312
have_file_dialogs = false
268313
have_discord_sdk = false

tools/install/meson.build

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ install_subdir(
1111
app_name = 'oopetris'
1212
if is_flatpak_build
1313
app_name = 'com.github.mgerhold.OOPetris'
14-
core_lib += {
15-
'compile_args': [
16-
core_lib.get('compile_args'),
17-
'-DFLATPAK_BUILD',
18-
'-DBUILD_INSTALLER',
19-
],
20-
}
2114
endif
2215

2316
conf = configuration_data()

tools/options/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ if (
6464
get_option('buildtype') == 'debug'
6565
or get_option('buildtype') == 'debugoptimized'
6666
)
67+
#TODO: replace with ! NDEBUG in cpp files and remove this
6768
core_lib += {
6869
'compile_args': [core_lib.get('compile_args'), '-DDEBUG_BUILD'],
6970
}

0 commit comments

Comments
 (0)