Organized build process
This commit is contained in:
@ -1,12 +1,5 @@
|
|||||||
games = $games
|
games = $games
|
||||||
|
|
||||||
|
|
||||||
foreach game : games
|
foreach game : games
|
||||||
executable(
|
subdir(game)
|
||||||
game,
|
|
||||||
lunch_src + windows.compile_resources(files(join_paths(game, 'resource.rc'))),
|
|
||||||
include_directories: includes,
|
|
||||||
d_import_dirs: [game],
|
|
||||||
link_with: [lua, luad, toml]
|
|
||||||
)
|
|
||||||
endforeach
|
endforeach
|
||||||
7
config/template.build
Normal file
7
config/template.build
Normal 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
19
postbuild.py
Normal 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"),
|
||||||
|
)
|
||||||
11
prebuild.py
11
prebuild.py
@ -13,7 +13,10 @@ def read(filename: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
# Prepare `lunch` config template
|
# 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
|
# Prepare games directory
|
||||||
@ -86,7 +89,7 @@ for dirent in os.listdir("config"):
|
|||||||
|
|
||||||
# Generate `lunch` config
|
# Generate `lunch` config
|
||||||
with open(pjoin(opath, "config.toml"), "w") as file:
|
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
|
# Generate icon
|
||||||
icon_png = pjoin(path, "icon.png")
|
icon_png = pjoin(path, "icon.png")
|
||||||
@ -105,6 +108,10 @@ for dirent in os.listdir("config"):
|
|||||||
"ICON\tICON\t\"icon.ico\""
|
"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
|
# Prepare meson configuration
|
||||||
mesontemplate = string.Template(read("config/meson.build"))
|
mesontemplate = string.Template(read("config/meson.build"))
|
||||||
|
|||||||
Reference in New Issue
Block a user