diff --git a/src/meson.build b/src/meson.build index d8228f486..e5f59b991 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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 diff --git a/tools/apply-manifest.py b/tools/apply-manifest.py new file mode 100644 index 000000000..3ea84624d --- /dev/null +++ b/tools/apply-manifest.py @@ -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()