summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZeno Albisser <zeno.albisser@digia.com>2013-07-18 19:56:26 +0200
committerZeno Albisser <zeno.albisser@digia.com>2013-07-19 17:12:35 +0200
commitc8c6be89630242f220263f3a0633dd493dec0ce6 (patch)
tree5baece511991882baf39a973158aee0937661403
parenta95c6266282e17aa17642c6a03e234b067eb5599 (diff)
Fixing Qt Resource System Integration.
Add logic to functions.prf and gyp_generator.prf to invoke rcc from ninja as well. Since we are building the whole library with ninja, this is the only feasible way to get the dependencies right. Changine the TEMPLATE of resources.pro from subdirs to aux, since it is not building a library and not processing subdirectories either. Change-Id: I23dff04e488d839bb54e343588da98e5e9059b23 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r--build/qmake/mkspecs/features/functions.prf13
-rw-r--r--build/qmake/mkspecs/features/gyp_generator.prf44
-rw-r--r--resources/resources.pro2
3 files changed, 48 insertions, 11 deletions
diff --git a/build/qmake/mkspecs/features/functions.prf b/build/qmake/mkspecs/features/functions.prf
index 4890c19be..72a225916 100644
--- a/build/qmake/mkspecs/features/functions.prf
+++ b/build/qmake/mkspecs/features/functions.prf
@@ -42,6 +42,19 @@ defineReplace(mocOutput) {
return($$out)
}
+defineReplace(rccOutput) {
+ out = $$1
+ out = $$replace(out, .qrc, .cpp)
+ out = $$join(out, qrc_, qrc_)
+ return($$out)
+}
+
+defineReplace(rccExternFunc) {
+ out = $$1
+ out = $$replace(out, .qrc, )
+ return($$out)
+}
+
defineReplace(which) {
out = $$1
# FIXME: figure out what to do about windows...
diff --git a/build/qmake/mkspecs/features/gyp_generator.prf b/build/qmake/mkspecs/features/gyp_generator.prf
index d40ee3c34..85dbd838c 100644
--- a/build/qmake/mkspecs/features/gyp_generator.prf
+++ b/build/qmake/mkspecs/features/gyp_generator.prf
@@ -4,6 +4,7 @@
load(functions)
load(moc)
+load(resources)
defineReplace(mocAction) {
INPUT_FILE = $$1
@@ -20,7 +21,7 @@ defineReplace(mocAction) {
" 'inputs': ['$$INPUT_FILE',]," \
" 'outputs': ['$$OUTPUT_FILE',]," \
" 'action': ["
-for(token, MOC_COMMAND): contents += " '$$token',"
+ for(token, MOC_COMMAND): contents += " '$$token',"
contents += " '$$INPUT_FILE'," \
" '-o'," \
" '$$OUTPUT_FILE'," \
@@ -30,6 +31,29 @@ for(token, MOC_COMMAND): contents += " '$$token',"
return($$contents)
}
+defineReplace(rccAction) {
+ INPUT_FILE = $$1
+ OUTPUT_NAME = $$rccOutput($$INPUT_FILE)
+ EXTERN_FUNC = $$rccExternFunc($$INPUT_FILE)
+ OUTPUT_FILE = $$absolute_path($$RCC_DIR, $$OUT_PWD)$${QMAKE_DIR_SEP}$${OUTPUT_NAME}
+ contents = " {" \
+ " 'action_name':'$$OUTPUT_NAME'," \
+ " 'inputs': ['$$INPUT_FILE',]," \
+ " 'outputs': ['$$OUTPUT_FILE',]," \
+ " 'action': [" \
+ " '$$QMAKE_RCC',"
+ for(resource_flag, $$QMAKE_RESOURCE_FLAGS): contents += " '$$resource_flag',"
+ contents += " '-name'," \
+ " '$$EXTERN_FUNC'," \
+ " '$$INPUT_FILE'," \
+ " '-o'," \
+ " '$$OUTPUT_FILE',"
+ contents += " ]," \
+ " },"
+
+ return($$contents)
+}
+
GYPI_FILE = $$replace(_PRO_FILE_, .pro$, .gyp)
TARGET_TYPE = $$toGypTargetType()
@@ -117,14 +141,15 @@ for (headerfile, HEADERS): GYP_CONTENTS += " '$$headerfile',"
for (resourcefile, RESOURCES) {
RCC_CPP = $$replace(resourcefile, .qrc, .cpp)
RCC_CPP = $$join(RCC_CPP, "qrc_", qrc_)
- GYP_CONTENTS += " '$$RCC_DIR/$$RCC_CPP',"
+ RCC_CPP = $$absolute_path($$RCC_DIR, $$OUT_PWD)$${QMAKE_DIR_SEP}$${RCC_CPP}
+ GYP_CONTENTS += " '$$RCC_CPP',"
}
# 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) {
!contains(INCLUDED_MOC_FILES, $$mocOutput($$mocable_header)) {
- GYP_CONTENTS += " '$$MOC_OUT_PATH$$mocOutput($$mocable_header)',"
+ GYP_CONTENTS += " '$$MOC_OUT_PATH$$mocOutput($$mocable_header)',"
}
}
@@ -136,13 +161,11 @@ GYP_CONTENTS += " ],"
}
# Generate the actions for moc
-!isEmpty(MOCABLE_HEADERS) {
- GYP_CONTENTS += " 'actions': ["
- for(header, MOCABLE_HEADERS): GYP_CONTENTS += $$mocAction($$header)
- GYP_CONTENTS += " ],"
-}
-
-GYP_CONTENTS += " }," \
+GYP_CONTENTS += " 'actions': ["
+for(resourcefile, RESOURCES): GYP_CONTENTS += $$rccAction($$resourcefile)
+for(header, MOCABLE_HEADERS): GYP_CONTENTS += $$mocAction($$header)
+GYP_CONTENTS += " ]," \
+ " }," \
" ]," \
"}"
@@ -155,3 +178,4 @@ unix: phony_variable_name_for_qmake_to_be_happy=$$system("touch $$QTWEBENGINE_RO
TEMPLATE = aux
SOURCES =
HEADERS =
+RESOURCES =
diff --git a/resources/resources.pro b/resources/resources.pro
index 77d5077c2..a9404f3ec 100644
--- a/resources/resources.pro
+++ b/resources/resources.pro
@@ -1,6 +1,6 @@
# This is a dummy .pro file used to prepare chromium .pak resource files.
# These files will then be bundled using the Qt Resource System.
-TEMPLATE = subdirs
+TEMPLATE = aux
system(python ../build/scripts/build_resources.py)