Skip to content

Commit

Permalink
Meson builds: Embed UAC manifest for dom_update_namespace
Browse files Browse the repository at this point in the history
...when a 32-bit Windows build is being carried out. Otherwise, if we
run the tests, this test program will fail to run as any 32-bit Windows
executable with 'update' in its filename will trigger an UAC prompt,
causing it to fail to run when 'ninja test' is invoked.
  • Loading branch information
fanc999-1 committed Sep 23, 2024
1 parent b3dac6d commit 6037c83
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
60 changes: 42 additions & 18 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -1,28 +1,49 @@
# examples

# Input: xmlxx_own_dep, build_examples
# Input: meson, xmlxx_own_dep, build_examples, generate_uac_manifest_py
# Output: -

# Generate the manifest file to embed for 32-bit builds for tests to run
# (on 32-bit Windows, execucatables that have 'update' in their filenames
# are considered to trigger UAC, which will get into our way)

dom_update_namespace_extra_objs = []
if host_machine.system() == 'windows' and host_machine.cpu_family() == 'x86'
uac_exe_pkg = 'libxml++'
uac_exe_name = 'dom_update_namespace'
dom_update_namespace_rc = custom_target(
'@[email protected]'.format(uac_exe_name),
output: '@[email protected]'.format(uac_exe_name),
command: [generate_uac_manifest_py,
'-p=@0@'.format(uac_exe_pkg),
'-n=@0@'.format(uac_exe_name),
'--pkg-version=@0@'.format(meson.project_version()),
'--output-dir=@OUTDIR@'],
)
dom_update_namespace_extra_objs += import('windows').compile_resources(dom_update_namespace_rc)
endif


example_programs = [
# [[dir-name], exe-name, [sources], [arguments]]
[['dom_build'], 'example', ['main.cc'], []],
[['dom_parse_entities'], 'example', ['main.cc'], []],
[['dom_parser'], 'example', ['main.cc'], []],
[['dom_parser_raw'], 'example', ['main.cc'], []],
# [[dir-name], exe-name, [sources], [arguments], [extra_objs]]
[['dom_build'], 'example', ['main.cc'], [], []],
[['dom_parse_entities'], 'example', ['main.cc'], [], []],
[['dom_parser'], 'example', ['main.cc'], [], []],
[['dom_parser_raw'], 'example', ['main.cc'], [], []],
[['dom_read_write'], 'example', ['main.cc'],
['example.xml', meson.current_build_dir() / 'dom_read_write_example_output.xml']],
[['dom_update_namespace'], 'example', ['main.cc'], []],
[['dom_xinclude'], 'example', ['main.cc'], []],
[['dom_xpath'], 'example', ['main.cc'], []],
[['dtdvalidation'], 'example', ['main.cc'], []],
[['import_node'], 'example', ['main.cc'], []],
[['sax_exception'], 'example', ['main.cc', 'myparser.cc'], []],
[['sax_parser'], 'example', ['main.cc', 'myparser.cc'], []],
['example.xml', meson.current_build_dir() / 'dom_read_write_example_output.xml'], []],
[['dom_update_namespace'], 'example', ['main.cc'], [], dom_update_namespace_extra_objs],
[['dom_xinclude'], 'example', ['main.cc'], [], []],
[['dom_xpath'], 'example', ['main.cc'], [], []],
[['dtdvalidation'], 'example', ['main.cc'], [], []],
[['import_node'], 'example', ['main.cc'], [], []],
[['sax_exception'], 'example', ['main.cc', 'myparser.cc'], [], []],
[['sax_parser'], 'example', ['main.cc', 'myparser.cc'], [], []],
[['sax_parser_build_dom'], 'example', ['main.cc', 'svgparser.cc',
'svgdocument.cc', 'svgelement.cc'], []],
[['sax_parser_entities'], 'example', ['main.cc', 'myparser.cc'], []],
[['schemavalidation'], 'example', ['main.cc'], []],
[['textreader'], 'example', ['main.cc'], []],
'svgdocument.cc', 'svgelement.cc'], [], []],
[['sax_parser_entities'], 'example', ['main.cc', 'myparser.cc'], [], []],
[['schemavalidation'], 'example', ['main.cc'], [], []],
[['textreader'], 'example', ['main.cc'], [], []],
]

foreach ex : example_programs
Expand All @@ -35,6 +56,9 @@ foreach ex : example_programs
foreach src : ex[2]
ex_sources += dir / src
endforeach
foreach obj : ex[4]
ex_sources += obj
endforeach

exe_file = executable(ex_name, ex_sources,
dependencies: xmlxx_own_dep,
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ dist_build_scripts_py = script_dir / 'dist-build-scripts.py'

# xmlxx's own script files.
xmlxx_script_dir = project_source_root / 'tools' / 'build_scripts'
generate_uac_manifest_py = xmlxx_script_dir / 'generate-uac-manifest.py'
tutorial_custom_cmd_py = xmlxx_script_dir / 'tutorial-custom-cmd.py'

if maintainer_mode
Expand Down

0 comments on commit 6037c83

Please sign in to comment.