meson: apply manifest on windows

This commit is contained in:
Ryan 2021-01-30 12:02:34 -05:00
parent 36b75b827d
commit 248785d7ad
2 changed files with 18 additions and 0 deletions

View file

@ -258,3 +258,13 @@ aegisub = executable('aegisub', aegisub_src, version_h, acconf,
install_dir: bindir,
dependencies: deps,
win_subsystem: 'windows')
if host_machine.system() == 'windows'
mt_exe = find_program('mt.exe')
apply_manifest = find_program(meson.project_source_root() / 'tools/apply-manifest.py')
custom_target('apply-manifest',
input: aegisub,
output: 'applied_manifest',
command: [apply_manifest, mt_exe, '@INPUT@'],
build_by_default: true)
endif

8
tools/apply-manifest.py Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env python3
import sys, subprocess, pathlib, os
mt_exe, executable = sys.argv[1:]
subprocess.run([mt_exe, '-manifest', executable + '.manifest', '-outputresource:' + executable + ';1'])
pathlib.Path(os.path.join(os.path.dirname(executable), 'applied_manifest')).touch()