summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2009-04-09 03:50:38 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2009-04-13 23:51:53 (GMT)
commit6e5774d84e7e3b68736f95fae09a084bd5b9ac7a (patch)
tree7b068f308da318dc83ade9eb6f97c2f336b04bef
parent5c36257e21d00106e36f5b68eea78507efc3f39c (diff)
downloadQt-6e5774d84e7e3b68736f95fae09a084bd5b9ac7a.zip
Qt-6e5774d84e7e3b68736f95fae09a084bd5b9ac7a.tar.gz
Qt-6e5774d84e7e3b68736f95fae09a084bd5b9ac7a.tar.bz2
Fixes compile of WebKit with MinGW when using any `-j' option to build
in parallel. On Windows, when a project has a lot of INCLUDEPATHs, some extra logic takes place to work around an issue of large command lines. Instead of passing all the paths directly to moc.exe, the paths are written to mocinclude.tmp which is then read from by moc.exe. Prior to this change, every moc rule tries to write to mocinclude.tmp. When running make with -j, this will happen in parallel, causing this error message: "The process cannot access the file because it is being used by another process" Change the logic so mocinclude.tmp is generated by its own rule. Reviewed-by: Lincoln Ramsay
-rw-r--r--mkspecs/features/moc.prf62
1 files changed, 39 insertions, 23 deletions
diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf
index f18d462..975867e 100644
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -8,31 +8,45 @@ isEmpty(MOC_DIR):MOC_DIR = .
isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_
isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc
-# This function on Windows puts the includes into a .inc file which moc will read, if the project
-# has more than 30 includes. We do this to overcome a command-line limit on Win < XP
-# Otherwise the function simply returns the normal command-line for moc
-defineReplace(mocCmd) {
- win32:count($$list($$INCPATH), 40, >) {
- EOC = $$escape_expand(\n\t)
+# On Windows, put the includes into a .inc file which moc will read, if the project
+# has too many includes. We do this to overcome a command-line limit on Win < XP
+INCLUDETEMP=
+win32:count($$list($$INCPATH), 40, >) {
+ INCLUDETEMP = mocinclude.tmp
+
+ # Remove any existing mocinclude.tmp when qmake runs
+ WIN_OUT_PWD=$$OUT_PWD
+ WIN_OUT_PWD~=s,/,\,g
+ system($$QMAKE_DEL_FILE $$WIN_OUT_PWD\\$$INCLUDETEMP > NUL 2>&1)
+
+ EOC = $$escape_expand(\n\t)
+
+ if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) {
+ # the VCPROJ generator will replace the \r\h with the coded \r\n: &#x0d;&#x0a;
+ # No other generator understands the \h
+ if(win32-msvc.net|win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\r\h)
+ else: EOC = $$escape_expand(\\)$$escape_expand(\n\t)
+ }
- if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) {
- # the VCPROJ generator will replace the \r\h with the coded \r\n: &#x0d;&#x0a;
- # No other generator understands the \h
- if(win32-msvc.net|win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\r\h)
- else: EOC = $$escape_expand(\\)$$escape_expand(\n\t)
- }
+ unset(INCFILELIST)
+ RET =
+ for(incfile, $$list($$INCPATH)) {
+ INCFILELIST = -I$$incfile
+ isEmpty(RET): RET += @echo $$INCFILELIST> $$INCLUDETEMP $$EOC
+ else: RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC
+ }
+ !isEmpty(INCFILELIST):RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC
- INCLUDETEMP = mocinclude.tmp
- unset(INCFILELIST)
- RET =
- for(incfile, $$list($$INCPATH)) {
- INCFILELIST = -I$$incfile
- isEmpty(RET): RET += @echo $$INCFILELIST> $$INCLUDETEMP $$EOC
- else: RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC
- }
- !isEmpty(INCFILELIST):RET += @echo $$INCFILELIST>> $$INCLUDETEMP $$EOC
- RET += $$QMAKE_MOC $(DEFINES) @$$INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2
- return($$RET)
+ build_pass|isEmpty(BUILDS) {
+ mocinclude.target = $$INCLUDETEMP
+ mocinclude.commands = $$RET
+ QMAKE_EXTRA_TARGETS += mocinclude
+ }
+}
+
+defineReplace(mocCmd) {
+ !isEmpty(INCLUDETEMP) {
+ return($$QMAKE_MOC $(DEFINES) @$$INCLUDETEMP $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2)
}
return($$QMAKE_MOC $(DEFINES) $(INCPATH) $$join(QMAKE_COMPILER_DEFINES, " -D", -D) $$1 -o $$2)
}
@@ -45,6 +59,7 @@ moc_header.output = $$MOC_DIR/$${QMAKE_H_MOD_MOC}${QMAKE_FILE_BASE}$${first(QMAK
moc_header.input = HEADERS
moc_header.variable_out = SOURCES
moc_header.name = MOC ${QMAKE_FILE_IN}
+!isEmpty(INCLUDETEMP):moc_header.depends += $$INCLUDETEMP
silent:moc_header.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_header.commands
QMAKE_EXTRA_COMPILERS += moc_header
INCREDIBUILD_XGE += moc_header
@@ -56,6 +71,7 @@ moc_source.commands = ${QMAKE_FUNC_mocCmd}
moc_source.output = $$MOC_DIR/$${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}$${QMAKE_EXT_CPP_MOC}
moc_source.input = SOURCES OBJECTIVE_SOURCES
moc_source.name = MOC ${QMAKE_FILE_IN}
+!isEmpty(INCLUDETEMP):moc_source.depends += $$INCLUDETEMP
silent:moc_source.commands = @echo moc ${QMAKE_FILE_IN} && $$moc_source.commands
QMAKE_EXTRA_COMPILERS += moc_source
INCREDIBUILD_XGE += moc_source