diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-04-05 17:28:49 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-04-08 21:08:06 +0300 |
commit | af820b77d88be0865169aa7f2f66a60f41675825 (patch) | |
tree | 30b2e379b4230e1e614b895b7de42a905da59d6e | |
parent | c80ca384b22547147ad1515cc6527dacc4c72fe0 (diff) | |
download | meson-af820b77d88be0865169aa7f2f66a60f41675825.zip meson-af820b77d88be0865169aa7f2f66a60f41675825.tar.gz meson-af820b77d88be0865169aa7f2f66a60f41675825.tar.bz2 |
Allow specifying windres binary in cross files
When cross compiling with mingw it's problematic to assume that there is
a binary called windres, and having to set it via an environment
variable seems wrong when there is a handy cross-file for just such a
situation.
This patch allows setting windres in the [binaries] section of the cross
file. If the build is a cross build, then the windows module will check
for windres being set in the cross file before checking the WINDRES
environment variable or looking for a windres binary.
-rw-r--r-- | mesonbuild/modules/windows.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index c233d90..3fb0107 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -51,9 +51,17 @@ class WindowsModule(ExtensionModule): for arg in extra_args: if ' ' in arg: mlog.warning(m.format(arg)) - # Pick-up env var WINDRES if set. This is often used for specifying - # an arch-specific windres. - rescomp_name = os.environ.get('WINDRES', 'windres') + rescomp_name = None + # FIXME: Does not handle `native: true` executables, see + # https://github.com/mesonbuild/meson/issues/1531 + if state.environment.is_cross_build(): + # If cross compiling see if windres has been specified in the + # cross file before trying to find it another way. + rescomp_name = state.environment.cross_info.config['binaries'].get('windres') + if rescomp_name is None: + # Pick-up env var WINDRES if set. This is often used for + # specifying an arch-specific windres. + rescomp_name = os.environ.get('WINDRES', 'windres') rescomp = dependencies.ExternalProgram(rescomp_name, silent=True) res_args = extra_args + ['@INPUT@', '@OUTPUT@'] suffix = 'o' |