summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-06-19 14:54:59 +0200
committerJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-06-19 15:00:05 +0200
commitde48295467098599ab1d80cb04a2de5236599b31 (patch)
tree11f106d2f54dc6acc3897054fd2062b8a07853f4 /build
parent943a8bd88695c3fbb9ed9d298469f1b77270c49e (diff)
Use Q_PRIVATE_SLOT for QWebContentsViewPrivate.
Fix the gyp generator to allow including the moc file directly in qwebcontentsview.cpp to be able to use Q_PRIVATE_SLOT instead of having the private object deriving from QObject. This also removes the use of MOCABLE_SOURCES whose entries were added to 'sources' without moc being run on them first.
Diffstat (limited to 'build')
-rw-r--r--build/qmake/mkspecs/features/functions.prf7
-rw-r--r--build/qmake/mkspecs/features/gyp_generator.prf17
-rwxr-xr-xbuild/scripts/find-included-moc-files13
3 files changed, 33 insertions, 4 deletions
diff --git a/build/qmake/mkspecs/features/functions.prf b/build/qmake/mkspecs/features/functions.prf
index 40a125f14..48c23a7f4 100644
--- a/build/qmake/mkspecs/features/functions.prf
+++ b/build/qmake/mkspecs/features/functions.prf
@@ -27,6 +27,13 @@ defineReplace(findMocables) {
return($$mocables)
}
+defineReplace(findIncludedMocFiles) {
+ input = $$1
+ for (file, input): \
+ infiles += $$absolute_path($$file, $$_PRO_FILE_PWD_)
+ return($$system("$$QTWEBENGINE_ROOT/build/scripts/find-included-moc-files $$infiles"))
+}
+
defineReplace(mocOutput) {
out = $$1
# The order is important, since the output of the second replace would end up accidentaly transformed by the first one
diff --git a/build/qmake/mkspecs/features/gyp_generator.prf b/build/qmake/mkspecs/features/gyp_generator.prf
index 2cb652331..b01a9bb6c 100644
--- a/build/qmake/mkspecs/features/gyp_generator.prf
+++ b/build/qmake/mkspecs/features/gyp_generator.prf
@@ -34,7 +34,7 @@ GYPI_FILE = $$replace(_PRO_FILE_, .pro$, .gyp)
TARGET_TYPE = $$toGypTargetType()
MOCABLE_HEADERS = $$findMocables($$HEADERS)
-MOCABLE_SOURCES = $$findMocables($$SOURCES)
+INCLUDED_MOC_FILES = $$findIncludedMocFiles($$SOURCES)
GYPI_CONTENTS = "{" \
" 'targets': [" \
@@ -74,20 +74,29 @@ GYPI_CONTENTS += " ],"
" }," \
" },"
}
+
+# Source files to compile
GYPI_CONTENTS += " 'sources': ["
for (sourcefile, SOURCES): GYPI_CONTENTS += " '$$sourcefile',"
for (headerfile, HEADERS): GYPI_CONTENTS += " '$$headerfile',"
+
+# Add moc output files to compile that aren't included at the end of any other source
MOC_OUT_PATH = $$absolute_path($$MOC_DIR, $$OUT_PWD)$${QMAKE_DIR_SEP}
-for (mocable_header, MOCABLE_HEADERS): GYPI_CONTENTS += " '$$MOC_OUT_PATH$$mocOutput($$mocable_header)',"
-for (mocable_source, MOCABLE_SOURCES): GYPI_CONTENTS += " '$$MOC_OUT_PATH$$mocOutput($$mocable_source)',"
+for (mocable_header, MOCABLE_HEADERS) {
+ !contains(INCLUDED_MOC_FILES, $$mocOutput($$mocable_header)) {
+ GYPI_CONTENTS += " '$$MOC_OUT_PATH$$mocOutput($$mocable_header)',"
+ }
+}
+
GYPI_CONTENTS += " ],"
!isEmpty(INCLUDEPATH) {
GYPI_CONTENTS += " 'include_dirs': ["
for (path, INCLUDEPATH): GYPI_CONTENTS += " '$$path',"
GYPI_CONTENTS += " ],"
}
+
# Generate the actions for moc
-!isEmpty(MOCABLE_HEADERS)|!isEmpty(MOCABLE_SOURCES) {
+!isEmpty(MOCABLE_HEADERS) {
GYPI_CONTENTS += " 'actions': ["
for(header, MOCABLE_HEADERS): GYPI_CONTENTS += $$mocAction($$header)
GYPI_CONTENTS += " ],"
diff --git a/build/scripts/find-included-moc-files b/build/scripts/find-included-moc-files
new file mode 100755
index 000000000..e55f3824c
--- /dev/null
+++ b/build/scripts/find-included-moc-files
@@ -0,0 +1,13 @@
+#!/usr/bin/env python
+
+import re, sys, os
+
+includedMocs = set()
+for f in filter(os.path.isfile, sys.argv[1:]):
+ inBlockComment = False
+ for line in open(f).readlines():
+ m = re.search('#include "(moc_\w+.cpp)"', line)
+ if m:
+ includedMocs.add(m.group(1))
+for moc in includedMocs:
+ print moc