Skip to content

Commit

Permalink
rework include path construction in the module system
Browse files Browse the repository at this point in the history
the main objective was to fix the bootstrap modules in framework builds.
bootstrapped modules which "borrow" headers from "proper" modules can
specify this in a clean way now.
a side effect of this is that the bootstrap-dbus module now has its own
syncqt call.

most includepath-related setup from qt_module_pris.prf was moved to
qt_module_headers.prf.

Change-Id: Ie0d8192cfac1a8cdae0ddd0bc0cd8c3092b1e85b
Reviewed-by: Joerg Bornemann <[email protected]>
Reviewed-by: Oswald Buddenhagen <[email protected]>
  • Loading branch information
ossilator committed Jan 12, 2016
1 parent 81858bf commit 20c7ab4
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 60 deletions.
4 changes: 2 additions & 2 deletions mkspecs/features/qt_module.prf
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ CONFIG += qmake_cache target_qt

QMAKE_DOCS_TARGETDIR = qt$${MODULE}

load(qt_module_pris)
load(qt_common)

!no_module_headers: load(qt_module_headers)
load(qt_module_pris)

INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.includes)

# If Qt was configured with -debug-and-release then build the module the same way
Expand Down
62 changes: 60 additions & 2 deletions mkspecs/features/qt_module_headers.prf
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ load(qt_build_paths)
} else {
contains(QT_CONFIG, private_tests): \ # -developer-build
QMAKE_SYNCQT += -check-includes
QMAKE_SYNCQT += -module $$MODULE_INCNAME -version $$VERSION
}
for(mod, MODULE_INCNAME): \
QMAKE_SYNCQT += -module $$mod
QMAKE_SYNCQT += \
-outdir $$system_quote($$MODULE_BASE_OUTDIR) $$MODULE_SYNCQT_DIR
-version $$VERSION -outdir $$system_quote($$MODULE_BASE_OUTDIR) $$MODULE_SYNCQT_DIR
!silent: message($$QMAKE_SYNCQT)
system($$QMAKE_SYNCQT)|error("Failed to run: $$QMAKE_SYNCQT")

Expand All @@ -33,6 +34,63 @@ load(qt_build_paths)
}
}

# Pre-generated headers in the source tree (tar-ball) and
# - shadow build or
# - non-shadow non-prefix build of a module which is not qtbase
# (because the build-time generated headers all end up in qtbase).
!git_build: \
if(!equals(_PRO_FILE_PWD_, $$OUT_PWD) \
|if(!prefix_build:!equals(MODULE_BASE_INDIR, $$[QT_HOST_PREFIX]))): \
CONFIG += split_incpath

# To avoid stuffing the code with repetetive conditionals,
# we parametrize the names of the variables we assign to.

# Internal modules have no private part - they *are* private.
!internal_module: \
prv = _PRIVATE

# When doing a framework build with a prefix, the module needs to point
# into the frameworks' Headers dirs directly, as no shared include/ dir
# is installed.
# However, during the build, it needs to point into the shared include/
# dir, as the framework doesn't even exist yet. For bootstrapped modules
# which borrow headers from "proper" modules, this situation persists
# even beyond the module's own build. The implication of this is that
# qmake might never use a framework's headers in a non-prefix build,
# as there is no separate set of .pri files for users outside Qt.
prefix_build:lib_bundle: \
fwd = _FWD
# When using a split include path during the build, the installed module's
# include path is also structurally different from that in the build dir.
prefix_build:split_incpath: \
sfwd = _FWD

ibase = \$\$QT_MODULE_INCLUDE_BASE
MODULE$${fwd}_INCLUDES = $$ibase
split_incpath {
bibase = $$val_escape(MODULE_BASE_OUTDIR)/include
MODULE$${sfwd}_INCLUDES += $$bibase
}
for(mod, MODULE_INCNAME) {
mibase = $$ibase/$$mod
MODULE$${fwd}_INCLUDES += $$mibase
MODULE$${fwd}$${prv}_INCLUDES += $$mibase/$$VERSION $$mibase/$$VERSION/$$mod
split_incpath {
mbibase = $$bibase/$$mod
MODULE$${sfwd}_INCLUDES += $$mbibase
generated_privates: \
MODULE$${sfwd}$${prv}_INCLUDES += $$mbibase/$$VERSION $$mbibase/$$VERSION/$$mod
}
prefix_build:lib_bundle {
mfbase = \$\$QT_MODULE_LIB_BASE/$${mod}.framework/Headers
MODULE_INCLUDES += $$mfbase
MODULE$${prv}_INCLUDES += $$mfbase/$$VERSION $$mfbase/$$VERSION/$$mod
}
}
MODULE_INCLUDES += $$MODULE_AUX_INCLUDES
MODULE_PRIVATE_INCLUDES += $$MODULE_PRIVATE_AUX_INCLUDES

minimal_syncqt: return()

#load up the headers info
Expand Down
42 changes: 11 additions & 31 deletions mkspecs/features/qt_module_pris.prf
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@
#

load(qt_build_paths)
# Pre-generated headers in the source tree and
# - shadow build or
# - non-shadow non-prefix build of a module which is not qtbase (because the build-time
# generated headers all end up in qtbase).
!git_build:if(!equals(_PRO_FILE_PWD_, $$OUT_PWD) \
|if(!prefix_build:!equals(MODULE_BASE_INDIR, $$[QT_HOST_PREFIX]))): \
CONFIG += split_incpath
force_independent|split_incpath: \
force_independent|!isEmpty(MODULE_FWD_INCLUDES): \
CONFIG += need_fwd_pri
mod_work_pfx = $$MODULE_QMAKE_OUTDIR/mkspecs/modules
need_fwd_pri: \
Expand Down Expand Up @@ -77,27 +70,6 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
module_master = "QT.$${MODULE_ID}.master_header = $$MODULE_MASTER_HEADER"
else: \
module_master =
!no_module_headers:!minimal_syncqt {
MODULE_INCLUDES = \$\$QT_MODULE_INCLUDE_BASE \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME
MODULE_PRIVATE_INCLUDES = \$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION \
\$\$QT_MODULE_INCLUDE_BASE/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME
}
split_incpath {
MODULE_SHADOW_INCLUDES = $$replace(MODULE_INCLUDES, ^\\\$\\\$QT_MODULE_INCLUDE_BASE, \
$$MODULE_BASE_OUTDIR/include)
generated_privates: \
MODULE_SHADOW_PRIVATE_INCLUDES = $$replace(MODULE_PRIVATE_INCLUDES, ^\\\$\\\$QT_MODULE_INCLUDE_BASE, \
$$MODULE_BASE_OUTDIR/include)
}
MODULE_INCLUDES += $$MODULE_AUX_INCLUDES
MODULE_PRIVATE_INCLUDES += $$MODULE_PRIVATE_AUX_INCLUDES
internal_module: \
MODULE_INCLUDES += $$MODULE_PRIVATE_INCLUDES
split_incpath {
MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE_ID}.includes += $$val_escape(MODULE_SHADOW_INCLUDES)"
generated_privates: \
MODULE_FWD_PRI_CONT_SUFFIX += "QT.$${MODULE}_private.includes += $$val_escape(MODULE_SHADOW_PRIVATE_INCLUDES)"
}
MODULE_PRI_CONT = \
"QT.$${MODULE_ID}.VERSION = $${VERSION}" \
"QT.$${MODULE_ID}.MAJOR_VERSION = $$section(VERSION, ., 0, 0)" \
Expand Down Expand Up @@ -143,7 +115,7 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri

need_fwd_pri {

split_incpath: \
!git_build: \
MODULE_BASE_INCDIR = $$MODULE_BASE_INDIR
else: \
MODULE_BASE_INCDIR = $$MODULE_BASE_OUTDIR
Expand All @@ -163,7 +135,15 @@ MODULE_FWD_PRI = $$mod_work_pfx/qt_lib_$${MODULE_ID}.pri
!internal_module:!no_private_module: MODULE_FWD_PRI_CONT += \
"include($$val_escape(MODULE_PRIVATE_PRI))" \
"QT.$${MODULE}_private.priority = 1"
MODULE_FWD_PRI_CONT += $$MODULE_FWD_PRI_CONT_SUFFIX
!isEmpty(MODULE_FWD_INCLUDES) {
!lib_bundle: \
pls = +
MODULE_FWD_PRI_CONT += \
"QT.$${MODULE_ID}.includes $$pls= $$MODULE_FWD_INCLUDES"
!internal_module: \
MODULE_FWD_PRI_CONT += \
"QT.$${MODULE}_private.includes $$pls= $$MODULE_FWD_PRIVATE_INCLUDES"
}
write_file($$MODULE_FWD_PRI, MODULE_FWD_PRI_CONT)|error("Aborting.")
touch($$MODULE_FWD_PRI, $$MODULE_PRI)
MODULE_PRI_FILES += $$MODULE_FWD_PRI
Expand Down
3 changes: 2 additions & 1 deletion src/angle/angle.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ SUBDIRS += src
# 2) If we made a 'QtANGLE' module, the include directory would be flattened which won't work since
# we need to support "#include <GLES2/gl2.h>"
CONFIG += minimal_syncqt
QMAKE_SYNCQT_OPTIONS = -module QtANGLE/KHR -module QtANGLE/EGL -module QtANGLE/GLES2 -module QtANGLE/GLES3 -version none
MODULE_INCNAME = QtANGLE/KHR QtANGLE/EGL QtANGLE/GLES2 QtANGLE/GLES3
VERSION = none
load(qt_module_headers)
4 changes: 2 additions & 2 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ src_xml.depends = src_corelib
src_dbus.subdir = $$PWD/dbus
src_dbus.target = sub-dbus
src_dbus.depends = src_corelib
force_bootstrap: src_dbus.depends += src_tools_bootstrap_dbus # avoid syncqt race

src_concurrent.subdir = $$PWD/concurrent
src_concurrent.target = sub-concurrent
Expand Down Expand Up @@ -139,9 +140,8 @@ TOOLS = src_tools_moc src_tools_rcc src_tools_qlalr
win32:SUBDIRS += src_winmain
SUBDIRS += src_network src_sql src_xml src_testlib
contains(QT_CONFIG, dbus) {
SUBDIRS += src_dbus
force_bootstrap: SUBDIRS += src_tools_bootstrap_dbus
SUBDIRS += src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
SUBDIRS += src_dbus src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
TOOLS += src_tools_qdbusxml2cpp src_tools_qdbuscpp2xml
contains(QT_CONFIG, accessibility-atspi-bridge): \
src_platformsupport.depends += src_dbus src_tools_qdbusxml2cpp
Expand Down
8 changes: 2 additions & 6 deletions src/tools/bootstrap-dbus/bootstrap-dbus.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ option(host_build)

MODULE = bootstrap_dbus
TARGET = QtBootstrapDBus
CONFIG += no_module_headers internal_module force_bootstrap
CONFIG += minimal_syncqt internal_module force_bootstrap

DEFINES += \
QT_NO_CAST_FROM_ASCII

MODULE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtDBus
MODULE_PRIVATE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtDBus/$$QT_VERSION \
\$\$QT_MODULE_INCLUDE_BASE/QtDBus/$$QT_VERSION/QtDBus
MODULE_INCNAME = QtDBus

load(qt_module)

Expand Down
18 changes: 2 additions & 16 deletions src/tools/bootstrap/bootstrap.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ option(host_build)

TARGET = QtBootstrap
QT =
CONFIG += internal_module force_bootstrap
CONFIG += minimal_syncqt internal_module force_bootstrap

MODULE_INCNAME = QtCore QtXml
MODULE_DEFINES = \
QT_BOOTSTRAPPED \
QT_LITE_UNICODE \
Expand All @@ -26,21 +27,6 @@ DEFINES += \

DEFINES -= QT_EVAL

MODULE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE \
\$\$QT_MODULE_INCLUDE_BASE/QtCore \
\$\$QT_MODULE_INCLUDE_BASE/QtXml
MODULE_PRIVATE_INCLUDES = \
\$\$QT_MODULE_INCLUDE_BASE/QtCore/$$QT_VERSION \
\$\$QT_MODULE_INCLUDE_BASE/QtCore/$$QT_VERSION/QtCore \
\$\$QT_MODULE_INCLUDE_BASE/QtXml/$$QT_VERSION \
\$\$QT_MODULE_INCLUDE_BASE/QtXml/$$QT_VERSION/QtXml

# We need the forwarding headers before their respective modules are built,
# so do a minimal syncqt run.
CONFIG += minimal_syncqt
QMAKE_SYNCQT_OPTIONS = -module QtCore -module QtDBus -module QtXml -version $$QT_VERSION

load(qt_module)

# otherwise mingw headers do not declare common functions like putenv
Expand Down

0 comments on commit 20c7ab4

Please sign in to comment.