summaryrefslogtreecommitdiff
path: root/mkspecs
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2017-06-21 13:14:34 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2017-07-17 11:19:17 +0000
commit6eb0036cf56f63b3f80ca35a34fb0e173f2ed54d (patch)
tree6ee631e2a61ae22f5ed1f57f72aa4fb8312fd36d /mkspecs
parent3205b6e8f57273096ae60d8f6fcdbe597c350393 (diff)
downloadqtivi-6eb0036cf56f63b3f80ca35a34fb0e173f2ed54d.tar.gz
Handle building modules properly
Extra steps are needed for syncqt to find the headers. After the generation of the frontend files, the headers are copied in the src folder in qtbase. When building a module, rather than using CONFIG += ivigenerator, simply define the required qface and module related variables and load(ivigenerator_qt_module) This also handles the QFACE_MODULE_NAME variable: the generator has a --module option which optionaly indicates the name of the Qt Module that is generated by the project. This is needed by the backend templates to know which include paths to use to find the frontend base interface class. This also changes the generated files so that the generated .pri has the same base name (in lower case) as the input qface file. And updates the generator version to 2.0 Change-Id: I9d2716255affcb5c6f319a6f23202ae3bb6c115c Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/ivigenerator.prf22
-rw-r--r--mkspecs/features/ivigenerator_qt_module.prf29
2 files changed, 47 insertions, 4 deletions
diff --git a/mkspecs/features/ivigenerator.prf b/mkspecs/features/ivigenerator.prf
index fcd2177..7652375 100644
--- a/mkspecs/features/ivigenerator.prf
+++ b/mkspecs/features/ivigenerator.prf
@@ -1,5 +1,7 @@
# Custom compiler for qface:
#
+# If building a module, use load(ivigenerator_qt_module) instead
+#
# Example input:
# QFACE_SOURCES += my.foo.qface [required]
# QFACE_MODULE_NAME = my_module_name
@@ -25,7 +27,6 @@ QFACE_ABS_PWD = $$absolute_path($$QFACE_PWD, $$_PRO_FILE_PWD_)
QFACE_FILE = $$basename(QFACE_SOURCES)
QFACE_BASE_NAME = $$replace(QFACE_FILE, .qface, )
QFACE_YAML = $$QFACE_ABS_PWD/$${QFACE_BASE_NAME}.yaml
-isEmpty(QFACE_MODULE_NAME): QFACE_MODULE_NAME = $$QFACE_BASE_NAME
# Detect whether we are using the feature inside the qtivi repository
VIRTUALENV_PATH = $$[QT_HOST_BINS]/ivigenerator/qtivi_qface_virtualenv
@@ -54,11 +55,12 @@ else: ENV = LC_ALL="en_US.UTF-8"
# Although this could be extra_compiler it is a normal EXTRA_TARGET for a reason.
# In the debug_and_release configuration, we want to have the generator executed
# during the run of the meta Makefile to only generate the code once.
-PRI_NAME = $$replace(QFACE_MODULE_NAME, "\." , "-")
-PRI = $$QFACE_OUTPUT_DIR/$${PRI_NAME}.pri
+PRI = $$QFACE_OUTPUT_DIR/$$lower($${QFACE_BASE_NAME}).pri
+IVI_GENERATOR_OPTIONS = --format=$$QFACE_FORMAT
+!isEmpty(QFACE_MODULE_NAME): IVI_GENERATOR_OPTIONS += --module=$$QFACE_MODULE
qface_sources.target = $$relative_path($$PRI, $$OUT_PWD)
-qface_sources.commands = $$ENV $$shell_path($$IVI_GENERATOR) -f $$QFACE_FORMAT $$shell_path($$QFACE_ABS_PWD/$${QFACE_FILE}) $$shell_path($$QFACE_OUTPUT_DIR)
+qface_sources.commands = $$ENV $$shell_path($$IVI_GENERATOR) $$IVI_GENERATOR_OPTIONS $$shell_path($$QFACE_ABS_PWD/$${QFACE_FILE}) $$shell_path($$QFACE_OUTPUT_DIR)
qface_sources.depends = $$IVI_GENERATOR_PATH/generate.py
# Add all templates of the generator format as dependency
@@ -73,6 +75,13 @@ exists($$QFACE_YAML) {
OTHER_FILES += $$QFACE_YAML
}
+!isEmpty(QFACE_HEADERS_OUTPUT_DIR) {
+ QFACE_HEADERS_OUTPUT_TARGET = $${QFACE_HEADERS_OUTPUT_DIR}/$$lower($${QFACE_MODULE_NAME})module.h
+ qface_headers.target = $$relative_path($$QFACE_HEADERS_OUTPUT_TARGET, $$OUT_PWD)
+ qface_headers.commands = $${QMAKE_COPY_FILE} $${QFACE_OUTPUT_DIR}/*.h $${QFACE_HEADERS_OUTPUT_DIR}
+ qface_headers.depends = $$relative_path($$PRI, $$OUT_PWD) $$IVI_GENERATOR_PATH/generate.py
+}
+
# Reevaluate the Makefile after the generation has finished
Makefile.target = Makefile
# The relative_path is needed here as qmake will use a relative_path for the output files
@@ -89,6 +98,11 @@ Makefile.depends = $$relative_path($$PRI, $$OUT_PWD)
Makefile.depends = $$shadowed($$IVI_GENERATOR_PATH)/forceRebuild
}
+!isEmpty(QFACE_HEADERS_OUTPUT_TARGET) {
+ Makefile.depends += $$relative_path($$QFACE_HEADERS_OUTPUT_TARGET, $$OUT_PWD)
+ QMAKE_EXTRA_TARGETS += qface_headers
+}
+
# After the generation, this should exists and qmake can create the correct build tree
exists($$PRI) {
# save the state and reset for SOURCES, HEADERS and OTHER_FILES
diff --git a/mkspecs/features/ivigenerator_qt_module.prf b/mkspecs/features/ivigenerator_qt_module.prf
new file mode 100644
index 0000000..bceff89
--- /dev/null
+++ b/mkspecs/features/ivigenerator_qt_module.prf
@@ -0,0 +1,29 @@
+# Custom compiler for qface base modules
+#
+# If not building a module, use CONFIG += ivigenerator instead
+#
+# Example input:
+# QFACE_SOURCES += my.foo.qface [required]
+# QFACE_MODULE_NAME = my_module_name
+# QFACE_FORMAT = frontend (or backend, simulator... -- defaults to "frontend")
+# QFACE_OUTPUT_DIR = my_output_dir (defaults to current build dir)
+#
+
+!contains(QFACE_SOURCES, .+\\.qface$) {
+ error("Invalid qface file provided: The file needs to end with .qface")
+}
+
+QFACE_PWD = $$dirname(QFACE_SOURCES)
+QFACE_ABS_PWD = $$absolute_path($$QFACE_PWD, $$_PRO_FILE_PWD_)
+
+load(qt_build_paths)
+!force_independent {
+ QFACE_HEADERS_REL_DIR = $$relative_path($$QFACE_ABS_PWD, $$QTIVI_ROOT)
+ QFACE_HEADERS_OUTPUT_DIR = $${MODULE_BASE_OUTDIR}/$${QFACE_HEADERS_REL_DIR}
+ !exists(QFACE_HEADERS_OUTPUT_DIR) {
+ mkpath($${QFACE_HEADERS_OUTPUT_DIR})
+ }
+}
+
+load(qt_module)
+load(ivigenerator)