aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends.py5
-rw-r--r--dependencies.py9
-rw-r--r--environment.py2
-rw-r--r--ninjabackend.py5
-rw-r--r--test cases/frameworks/4 qt5/meson.build18
-rw-r--r--test cases/frameworks/4 qt5/mocinclude.cpp12
-rw-r--r--test cases/frameworks/4 qt5/moctest.cpp9
7 files changed, 49 insertions, 11 deletions
diff --git a/backends.py b/backends.py
index ff083ee..563557d 100644
--- a/backends.py
+++ b/backends.py
@@ -13,11 +13,8 @@
# limitations under the License.
import mparser
-import os, sys, re, pickle, uuid
-import environment, mlog
-from build import InvalidArguments
+import os, sys, re, pickle
import build
-import shutil
from coredata import MesonException
def do_replacement(regex, line, confdata):
diff --git a/dependencies.py b/dependencies.py
index 3813fba..b670d14 100644
--- a/dependencies.py
+++ b/dependencies.py
@@ -516,15 +516,18 @@ class Qt5Dependency(Dependency):
def get_generate_rules(self):
moc_rule = CustomRule([self.moc.get_command(), '@INFILE@', '-o', '@OUTFILE@'],
- 'moc_@BASENAME@.cpp', 'moc_headers', 'moc_compile',
- 'Compiling @INFILE@ with the moc preprocessor')
+ 'moc_@BASENAME@.cpp', 'moc_headers', 'moc_hdr_compile',
+ 'Compiling header @INFILE@ with the moc preprocessor')
+ mocsrc_rule = CustomRule([self.moc.get_command(), '@INFILE@', '-o', '@OUTFILE@'],
+ 'moc@BASENAME@.moc', 'moc_sources', 'moc_src_compile',
+ 'Compiling source @INFILE@ with the moc preprocessor')
ui_rule = CustomRule([self.uic.get_command(), '@INFILE@', '-o', '@OUTFILE@'],
'ui_@BASENAME@.h', 'ui_files', 'ui_compile',
'Compiling @INFILE@ with the ui compiler')
rrc_rule = CustomRule([self.rcc.get_command(), '@INFILE@', '-o', '@OUTFILE@'],
'@BASENAME@.cpp', 'qresources', 'rc_compile',
'Compiling @INFILE@ with the rrc compiler')
- return [moc_rule, ui_rule, rrc_rule]
+ return [moc_rule, mocsrc_rule, ui_rule, rrc_rule]
def get_exe_flags(self):
# Qt5 seems to require this always.
diff --git a/environment.py b/environment.py
index 7ff9930..a3317ca 100644
--- a/environment.py
+++ b/environment.py
@@ -72,7 +72,7 @@ class CCompiler():
return self.id
def get_dependency_gen_flags(self, outtarget, outfile):
- return ['-MMD', '-MT', outtarget, '-MF', outfile]
+ return ['-MMD', '-MQ', outtarget, '-MF', outfile]
def get_depfile_suffix(self):
return 'd'
diff --git a/ninjabackend.py b/ninjabackend.py
index 02120b9..d29ddb4 100644
--- a/ninjabackend.py
+++ b/ninjabackend.py
@@ -15,7 +15,10 @@
import backends
import environment
import build
+import mlog
from meson_install import InstallData
+from build import InvalidArguments
+from coredata import MesonException
import os, sys, shutil, pickle
if environment.is_windows():
@@ -811,6 +814,8 @@ class NinjaBackend(backends.Backend):
src_deps.append(outfilename)
else:
other_deps.append(outfilename)
+ if rule.name == 'moc_src_compile': #HACK
+ src_deps.append(infilename)
return (src_deps, other_deps)
def generate_cppcheck_target(self, outfile):
diff --git a/test cases/frameworks/4 qt5/meson.build b/test cases/frameworks/4 qt5/meson.build
index 7d65167..dc0a2d3 100644
--- a/test cases/frameworks/4 qt5/meson.build
+++ b/test cases/frameworks/4 qt5/meson.build
@@ -12,7 +12,19 @@ deps : qt5dep)
# We need a console test application because some test environments
# do not have an X server.
-q5core = executable('q5core', 'q5core.cpp',
-deps : dependency('qt5', modules : 'Core'))
+qt5core = dependency('qt5', modules : 'Core')
+
+qt5coreapp = executable('q5core', 'q5core.cpp',
+deps : qt5core)
+
+test('qt5test', qt5coreapp)
+
+# Tests for source file compilation with moc.
+
+q5moc = executable('q5moc',
+sources : 'moctest.cpp',
+moc_sources : 'mocinclude.cpp',
+deps : qt5core)
+
+test('q5moc', q5moc)
-test('qt5test', q5core)
diff --git a/test cases/frameworks/4 qt5/mocinclude.cpp b/test cases/frameworks/4 qt5/mocinclude.cpp
new file mode 100644
index 0000000..7c18867
--- /dev/null
+++ b/test cases/frameworks/4 qt5/mocinclude.cpp
@@ -0,0 +1,12 @@
+#include<QObject>
+
+class MocClass : public QObject {
+ Q_OBJECT
+};
+
+int mocfunc() {
+ MocClass m;
+ return 0;
+}
+
+#include"mocmocinclude.moc"
diff --git a/test cases/frameworks/4 qt5/moctest.cpp b/test cases/frameworks/4 qt5/moctest.cpp
new file mode 100644
index 0000000..e0748f0
--- /dev/null
+++ b/test cases/frameworks/4 qt5/moctest.cpp
@@ -0,0 +1,9 @@
+#include<QCoreApplication>
+
+int mocfunc();
+
+int main(int argc, char **argv) {
+ QCoreApplication app(argc, argv);
+
+ return mocfunc();
+}