Added capability to compile sources files with moc, too.

pull/15/head
Jussi Pakkanen 11 years ago
parent 4084e7213e
commit ac81594952
  1. 5
      backends.py
  2. 9
      dependencies.py
  3. 2
      environment.py
  4. 5
      ninjabackend.py
  5. 18
      test cases/frameworks/4 qt5/meson.build
  6. 12
      test cases/frameworks/4 qt5/mocinclude.cpp
  7. 9
      test cases/frameworks/4 qt5/moctest.cpp

@ -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):

@ -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.

@ -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'

@ -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):

@ -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)

@ -0,0 +1,12 @@
#include<QObject>
class MocClass : public QObject {
Q_OBJECT
};
int mocfunc() {
MocClass m;
return 0;
}
#include"mocmocinclude.moc"

@ -0,0 +1,9 @@
#include<QCoreApplication>
int mocfunc();
int main(int argc, char **argv) {
QCoreApplication app(argc, argv);
return mocfunc();
}
Loading…
Cancel
Save