From c8c6be89630242f220263f3a0633dd493dec0ce6 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Thu, 18 Jul 2013 19:56:26 +0200 Subject: 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 --- build/qmake/mkspecs/features/functions.prf | 13 ++++++++ build/qmake/mkspecs/features/gyp_generator.prf | 44 ++++++++++++++++++++------ 2 files changed, 47 insertions(+), 10 deletions(-) (limited to 'build') 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 = -- cgit v1.2.3