aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-11-28 03:04:39 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-12-02 02:07:19 +0530
commit62ba5ca1ec1b9423b2fe6676dd163e2a06a7b0a5 (patch)
tree129bbe84d8360da562aca8cd300fa088d5d9527c /mesonbuild/backend/ninjabackend.py
parente1bdc098ca48990322b058e2a2a9fce16c3e7674 (diff)
downloadmeson-62ba5ca1ec1b9423b2fe6676dd163e2a06a7b0a5.zip
meson-62ba5ca1ec1b9423b2fe6676dd163e2a06a7b0a5.tar.gz
meson-62ba5ca1ec1b9423b2fe6676dd163e2a06a7b0a5.tar.bz2
custom target: Consider all build depends while serializing
Currently, we only consider the build depends of the Executable being run when serializing custom targets. However, this is not always sufficient, for example if the executable loads modules at runtime or if the executable is actually a python script that loads a built module. For these cases, we need to set PATH on Windows correctly or the custom target will fail to run at build time complaining about missing DLLs.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index bcda603..e35a391 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -504,22 +504,30 @@ int dummy;
# Add a dependency on all the outputs of this target
for output in d.get_outputs():
elem.add_dep(os.path.join(self.get_target_dir(d), output))
+ serialize = False
+ extra_paths = []
# If the target requires capturing stdout, then use the serialized
# executable wrapper to capture that output and save it to a file.
- #
+ if target.capture:
+ serialize = True
# If the command line requires a newline, also use the wrapper, as
# ninja does not support them in its build rule syntax.
- #
+ if any('\n' in c for c in cmd):
+ serialize = True
# Windows doesn't have -rpath, so for EXEs that need DLLs built within
# the project, we need to set PATH so the DLLs are found. We use
# a serialized executable wrapper for that and check if the
# CustomTarget command needs extra paths first.
- if (target.capture or any('\n' in c for c in cmd) or
- ((mesonlib.is_windows() or mesonlib.is_cygwin()) and
- self.determine_windows_extra_paths(target.command[0]))):
+ if mesonlib.is_windows() or mesonlib.is_cygwin():
+ extra_bdeps = target.get_transitive_build_target_deps()
+ extra_paths = self.determine_windows_extra_paths(target.command[0], extra_bdeps)
+ if extra_paths:
+ serialize = True
+ if serialize:
exe_data = self.serialize_executable(target.command[0], cmd[1:],
# All targets are built from the build dir
self.environment.get_build_dir(),
+ extra_paths=extra_paths,
capture=ofilenames[0] if target.capture else None)
cmd = self.environment.get_build_command() + ['--internal', 'exe', exe_data]
cmd_type = 'meson_exe.py custom'