Organized build process

This commit is contained in:
2025-05-02 15:41:09 +02:00
parent 2e723672e2
commit 51ead7bc35
4 changed files with 36 additions and 10 deletions

View File

@ -1,12 +1,5 @@
games = $games
foreach game : games
executable(
game,
lunch_src + windows.compile_resources(files(join_paths(game, 'resource.rc'))),
include_directories: includes,
d_import_dirs: [game],
link_with: [lua, luad, toml]
)
subdir(game)
endforeach

7
config/template.build Normal file
View File

@ -0,0 +1,7 @@
exec = executable(
'$name',
lunch_src + windows.compile_resources(files('resource.rc')),
include_directories: includes,
d_import_dirs: ['.'],
link_with: [lua, luad, toml]
)

19
postbuild.py Normal file
View File

@ -0,0 +1,19 @@
import os
import shutil
if os.path.exists("launchers"):
shutil.rmtree("launchers")
os.mkdir("launchers")
open("launchers/.gitignore", "w").write("*")
for game in os.listdir("build/games"):
path = os.path.join("build/games", game)
if not os.path.isdir(path):
continue
shutil.copyfile(
os.path.join(path, game+".exe"),
os.path.join("launchers", game+".exe"),
)

View File

@ -13,7 +13,10 @@ def read(filename: str) -> str:
# Prepare `lunch` config template
template = string.Template(read("template.toml"))
config_template = string.Template(read("template.toml"))
# Prepare `lunch` config template
meson_template = string.Template(read("config/template.build"))
# Prepare games directory
@ -86,7 +89,7 @@ for dirent in os.listdir("config"):
# Generate `lunch` config
with open(pjoin(opath, "config.toml"), "w") as file:
file.write(template.substitute(dict(flat_config)))
file.write(config_template.substitute(dict(flat_config)))
# Generate icon
icon_png = pjoin(path, "icon.png")
@ -105,6 +108,10 @@ for dirent in os.listdir("config"):
"ICON\tICON\t\"icon.ico\""
])
# Generate meson file
with open(pjoin(opath, "meson.build"), "w") as file:
file.write(meson_template.substitute(dict(flat_config)))
# Prepare meson configuration
mesontemplate = string.Template(read("config/meson.build"))