aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Jeandet <alexis.jeandet@member.fsf.org>2018-03-30 01:07:43 +0200
committerAlexis Jeandet <alexis.jeandet@member.fsf.org>2018-03-30 01:07:43 +0200
commitfd245ce5cf4b0d1a6841fc6dccbf98acbd8fe401 (patch)
treed19b26c0d5f424a1a14a3063f8e9735042088aad
parent0407fac59eaa371198ebc3caa46123da2420d74c (diff)
downloadmeson-fd245ce5cf4b0d1a6841fc6dccbf98acbd8fe401.zip
meson-fd245ce5cf4b0d1a6841fc6dccbf98acbd8fe401.tar.gz
meson-fd245ce5cf4b0d1a6841fc6dccbf98acbd8fe401.tar.bz2
[Qt module] add some logic to detect if resources are in build dir
In order to handle generated resources embedded in qrc file, we need to be able to detect if files pointed from qrc are in build directory or not. Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
-rw-r--r--mesonbuild/modules/qt.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
index 11f10b3..77b1bb4 100644
--- a/mesonbuild/modules/qt.py
+++ b/mesonbuild/modules/qt.py
@@ -88,7 +88,27 @@ class QtBaseModule:
mlog.warning("malformed rcc file: ", os.path.join(state.subdir, rcc_file))
break
else:
- result.append(os.path.join(relative_part, child.text))
+ resource_path = child.text
+ # We need to guess if the pointed resource is:
+ # a) in build directory -> implies a generated file
+ # b) in source directory
+ # c) somewhere else external dependency file to bundle
+ if os.path.isabs(resource_path):
+ # a)
+ if resource_path.startswith(os.path.abspath(state.environment.build_dir)):
+ resource_relpath = os.path.relpath(resource_path, state.environment.build_dir)
+ result.append(File(is_built=True, subdir=state.subdir, fname=resource_relpath))
+ # either b) or c)
+ else:
+ result.append(File(is_built=False, subdir=state.subdir, fname=resource_path))
+ else:
+ # a)
+ if os.path.exists(state.environment.build_dir+resource_path):
+ result.append(File(is_built=True, subdir=state.subdir, fname=resource_path))
+ # b)
+ else:
+ result.append(File(is_built=False, subdir=state.subdir,
+ fname=os.path.join(relative_part, resource_path)))
return result
except Exception:
return []