aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/backends.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-04-20 15:17:51 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2022-05-06 23:04:11 +0300
commitf9200ca8f7429d614dcb8c4144269461c6a7d9d9 (patch)
tree192030b5e3d301e3a5be272ecfd2e4ca2ab1b267 /mesonbuild/backend/backends.py
parent1e4d4fce2250ab415964ad89c1d8b2c649b0b00d (diff)
downloadmeson-f9200ca8f7429d614dcb8c4144269461c6a7d9d9.zip
meson-f9200ca8f7429d614dcb8c4144269461c6a7d9d9.tar.gz
meson-f9200ca8f7429d614dcb8c4144269461c6a7d9d9.tar.bz2
devenv: Set WINEPATH when cross compiling for Windows
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r--mesonbuild/backend/backends.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index b5b8171..26402b7 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -1801,9 +1801,12 @@ class Backend:
env = build.EnvironmentVariables()
extra_paths = set()
library_paths = set()
+ host_machine = self.environment.machines[MachineChoice.HOST]
+ need_exe_wrapper = self.environment.need_exe_wrapper()
+ need_wine = need_exe_wrapper and host_machine.is_windows()
for t in self.build.get_targets().values():
cross_built = not self.environment.machines.matches_build_machine(t.for_machine)
- can_run = not cross_built or not self.environment.need_exe_wrapper()
+ can_run = not cross_built or not need_exe_wrapper or need_wine
in_default_dir = t.should_install() and not t.get_install_dir()[2]
if not can_run or not in_default_dir:
continue
@@ -1813,22 +1816,25 @@ class Backend:
# so they get used by default instead of searching on system when
# in developer environment.
extra_paths.add(tdir)
- if mesonlib.is_windows() or mesonlib.is_cygwin():
+ if host_machine.is_windows() or host_machine.is_cygwin():
# On windows we cannot rely on rpath to run executables from build
# directory. We have to add in PATH the location of every DLL needed.
- extra_paths.update(self.determine_windows_extra_paths(t, []))
+ library_paths.update(self.determine_windows_extra_paths(t, []))
elif isinstance(t, build.SharedLibrary):
# Add libraries that are going to be installed in libdir into
# LD_LIBRARY_PATH. This allows running system applications using
# that library.
library_paths.add(tdir)
if library_paths:
- if mesonlib.is_windows() or mesonlib.is_cygwin():
+ if host_machine.is_windows() or host_machine.is_cygwin():
extra_paths.update(library_paths)
- elif mesonlib.is_osx():
+ elif host_machine.is_darwin():
env.prepend('DYLD_LIBRARY_PATH', list(library_paths))
else:
env.prepend('LD_LIBRARY_PATH', list(library_paths))
if extra_paths:
- env.prepend('PATH', list(extra_paths))
+ if need_wine:
+ env.prepend('WINEPATH', list(extra_paths), separator=';')
+ else:
+ env.prepend('PATH', list(extra_paths))
return env