summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-12-07 19:30:07 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-12-14 23:44:30 +0000
commite80bf655e922e9864f8843b5e7bbb47019a6d95a (patch)
tree7ffae51f5170a58b38f883ff30547e2f9d55843d /mkspecs
parenta227ea5bd5af50ac6f874ecf764858a43c53cada (diff)
configure: verify header presence against sources
in addition to the actual library resolution, also resolve the headers belonging to the library, to validate the include path, and possibly ensure that the right version of the library is present. the "include" entries were moved out of the "test" objects, and renamed to "headers". this cleanly permits libraries without compile tests. the headers were not put into the sources, because the variance among the includes is generally orthogonal to the variance among the libraries. note that this - like the library resolution - provides no support for darwin frameworks. consequently, the opengl libraries are excluded from the conversion on darwin. similarly, wasm is excluded (centrally), because emcc is magic and would need advanced wizardry to be dealt with. Change-Id: Ib390c75371efa2badcfec9b74274047ce67c3e5a Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/qt_configure.prf58
1 files changed, 51 insertions, 7 deletions
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index e2e341770e..3483ddc5dc 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -582,7 +582,33 @@ defineTest(qtConfResolvePathLibs) {
return($$ret)
}
-# includes-var, includes
+defineReplace(qtConfGetTestIncludes) {
+ defined($${1}._KEYS_, var) {
+ 1st = $$first($${1}._KEYS_)
+ equals(1st, 0) {
+ # array; recurse for every element
+ ret =
+ for (k, $${1}._KEYS_): \
+ ret += $$qtConfGetTestIncludes($${1}.$$k)
+ return($$ret)
+ }
+ # object; try condition and recurse
+ !defined($${1}.headers, var):!defined($${1}.headers._KEYS_, var): \ # just plain broken without it
+ error("headers object '$$1' has no nested headers entry")
+ cond = $$eval($${1}.condition)
+ isEmpty(cond): \ # would be pointless otherwise
+ error("headers object '$$1' has no condition")
+ !$$qtConfEvaluate($$cond) {
+ qtLog("header entry '$$1' failed condition '$$cond'.")
+ return()
+ }
+ qtLog("header entry '$$1' passed condition.")
+ return($$qtConfGetTestIncludes($${1}.headers))
+ }
+ return($$eval($$1)) # plain string - or nothing (can happen for top-level call only)
+}
+
+# includes-var, in-paths, test-object-var
defineTest(qtConfResolvePathIncs) {
ret = true
for (incdir, 2) {
@@ -594,6 +620,21 @@ defineTest(qtConfResolvePathIncs) {
2 -= $$QMAKE_DEFAULT_INCDIRS
$$1 = $$2
export($$1)
+ wasm {
+ # FIXME: emcc downloads pre-built libraries and adds their include
+ # path to the clang call dynamically. it would be possible to parse
+ # the emcc -s USE_xyz=1 --cflags output to populate xzy_INCDIR and
+ # thus make the code below work.
+ return($$ret)
+ }
+ hdrs = $$qtConfGetTestIncludes($${3}.headers)
+ for (hdr, hdrs) {
+ h = $$qtConfFindInPathList($$hdr, $$2 $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS)
+ isEmpty(h) {
+ qtLog("$$hdr not found in [$$val_escape(2)] and global paths.")
+ ret = false
+ }
+ }
return($$ret)
}
@@ -662,7 +703,7 @@ defineTest(qtConfLibrary_inline) {
!qtConfResolveAllLibs($$1): \
return(false)
- !qtConfResolvePathIncs($${1}.includedir, $$includes): \
+ !qtConfResolvePathIncs($${1}.includedir, $$includes, $$2): \
return(false)
return(true)
@@ -678,7 +719,7 @@ defineTest(qtConfLibrary_makeSpec) {
!qtConfResolvePathLibs($${1}.libs, $$eval(QMAKE_LIBDIR_$$spec), $$eval(QMAKE_LIBS_$$spec)): \
return(false)
- !qtConfResolvePathIncs($${1}.includedir, $$eval(QMAKE_INCDIR_$$spec)): \
+ !qtConfResolvePathIncs($${1}.includedir, $$eval(QMAKE_INCDIR_$$spec), $$2): \
return(false)
# note that the object is re-exported, because we resolve the libraries.
@@ -741,7 +782,7 @@ defineTest(qtConfLibrary_pkgConfig) {
}
!isEmpty(ignored): \
qtLog("Note: Dropped compiler flags '$$ignored'.")
- !qtConfResolvePathIncs($${1}.includedir, $$includes): \
+ !qtConfResolvePathIncs($${1}.includedir, $$includes, $$2): \
return(false)
$${1}.defines = $$defines
@@ -1054,7 +1095,7 @@ defineTest(qtConfTestPrepare_compile) {
}
defineTest(qtConfPrepareCompileTestSource) {
- test_dir = $$2
+ test_dir = $$3
test_lang = $$eval($${1}.lang)
isEmpty(test_lang): test_lang = "c++"
@@ -1071,7 +1112,10 @@ defineTest(qtConfPrepareCompileTestSource) {
for (ent, $$qtConfScalarOrList($${1}.head)): \
contents += $$ent
# Includes
- for (ent, $$qtConfScalarOrList($${1}.include)): \
+ hdrs = $$qtConfGetTestIncludes($${1}.include)
+ isEmpty(hdrs): \
+ hdrs = $$qtConfGetTestIncludes($$2)
+ for (ent, hdrs): \
contents += "$${LITERAL_HASH}include <$$ent>"
# Custom code after includes
for (ent, $$qtConfScalarOrList($${1}.tail)): \
@@ -1107,7 +1151,7 @@ defineTest(qtConfTest_compile) {
isEmpty(test) {
test_dir = $$test_base_out_dir/$$section(1, ".", -1)
test_out_dir = $$test_dir
- qtConfPrepareCompileTestSource($${1}.test, $$test_dir)
+ qtConfPrepareCompileTestSource($${1}.test, $${1}.headers, $$test_dir)
} else {
test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test
test_out_dir = $$test_base_out_dir/$$test