summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/qt_configure.prf
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs/features/qt_configure.prf')
-rw-r--r--mkspecs/features/qt_configure.prf52
1 files changed, 47 insertions, 5 deletions
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index 4b2ba560fb..c3ea334dd8 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -733,7 +733,7 @@ defineTest(qtConfHandleLibrary) {
}
# if the library defines a test, use it to verify the source.
- !isEmpty($${lpfx}.test) {
+ !isEmpty($${lpfx}.test)|!isEmpty($${lpfx}.test._KEYS_) {
$${lpfx}.literal_args = $$qtConfLibraryArgs($$spfx) $$use_args
$${lpfx}.host = $$eval($${spfx}.host)
!qtConfTest_compile($$lpfx) {
@@ -855,16 +855,58 @@ defineTest(qtConfTestPrepare_compile) {
return(true)
}
+defineTest(qtConfPrepareCompileTestSource) {
+ test_dir = $$2
+
+ # Create source code
+ contents = "/* Generated by configure */"
+ # Custom code before includes
+ for (ent, $$qtConfScalarOrList($${1}.head)): \
+ contents += $$ent
+ # Includes
+ for (ent, $$qtConfScalarOrList($${1}.include)): \
+ contents += "$${LITERAL_HASH}include <$$ent>"
+ # Custom code after includes
+ for (ent, $$qtConfScalarOrList($${1}.tail)): \
+ contents += $$ent
+ # And finally the custom code inside main()
+ contents += \
+ "int main(int argc, char **argv)" \
+ "{" \
+ " (void)argc; (void)argv;" \
+ " /* BEGIN TEST: */"
+ for (ent, $$qtConfScalarOrList($${1}.main)): \
+ contents += " $$ent"
+ contents += \
+ " /* END TEST */" \
+ " return 0;" \
+ "}"
+ write_file($$test_dir/main.cpp, contents)|error()
+
+ # Create stub .pro file
+ contents = "SOURCES = main.cpp"
+ # Custom project code
+ for (ent, $$qtConfScalarOrList($${1}.qmake)): \
+ contents += $$ent
+ write_file($$test_dir/$$basename(test_dir).pro, contents)|error()
+}
+
defineTest(qtConfTest_compile) {
test = $$eval($${1}.test)
host = $$eval($${1}.host)
isEmpty(host): host = false
- test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test
test_base_out_dir = $$OUT_PWD/$$basename(QMAKE_CONFIG_TESTS_DIR)
- test_out_dir = $$test_base_out_dir/$$test
- !isEmpty($${1}.pro): \
- test_dir = $$test_dir/$$eval($${1}.pro)
+ isEmpty(test) {
+ test_dir = $$test_base_out_dir/$$section(1, ".", -1)
+ test_out_dir = $$test_dir
+ qtConfPrepareCompileTestSource($${1}.test, $$test_dir)
+ } else {
+ test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test
+ test_out_dir = $$test_base_out_dir/$$test
+ !isEmpty($${1}.pro): \
+ test_dir = $$test_dir/$$eval($${1}.pro)
+ }
test_cmd_base = "$$QMAKE_CD $$system_quote($$system_path($$test_out_dir)) &&"
qmake_args = $$qtConfPkgConfigEnv()$$system_quote($$system_path($$QMAKE_QMAKE))