From b26b1455d75709a53f50e1d3d41c384f8e90b576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Wed, 3 Jul 2019 14:39:03 +0200 Subject: [PATCH] Implement SUBDIR-= conversion in pro2cmake tool CMake doesn't support removing subdirectories therefore one need to convert all removal to conditional adds. The resulting code doesn't win a beauty contest. That is because handle_subdir works on already processed strings which means it doesn't have access to the boolean operations. As such it can not minimize the expressions, but it works and in the most simple cases it is pretty good. The patch re-generates CMakeLists.txt under tests/auto/corelib/kernel excluding qcoreapplication, qmetatype, qmimedata, qobject, qtimer, which are suffering from unrelated problems, like for example Gui, pthread linkage issues. Change-Id: I18a02f6eda7a3b41b1313211c8bc9ce277bb67be Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor --- tests/auto/corelib/kernel/CMakeLists.txt | 37 ++++++++++++-- .../kernel/qdeadlinetimer/CMakeLists.txt | 14 ++++- .../kernel/qelapsedtimer/CMakeLists.txt | 14 ++++- .../kernel/qeventdispatcher/CMakeLists.txt | 14 ++++- .../corelib/kernel/qeventloop/CMakeLists.txt | 30 +++++++++++ .../auto/corelib/kernel/qmath/CMakeLists.txt | 14 ++++- .../corelib/kernel/qmetaenum/CMakeLists.txt | 14 ++++- .../corelib/kernel/qmetamethod/CMakeLists.txt | 14 ++++- .../corelib/kernel/qmetaobject/CMakeLists.txt | 22 +++++++- .../kernel/qmetaobjectbuilder/CMakeLists.txt | 16 +++++- .../kernel/qmetaproperty/CMakeLists.txt | 14 ++++- .../corelib/kernel/qmetatype/CMakeLists.txt | 41 +++++++++++++++ .../corelib/kernel/qmimedata/CMakeLists.txt | 14 ++++- .../corelib/kernel/qobject/CMakeLists.txt | 29 +++++++++++ .../kernel/qobject/signalbug/CMakeLists.txt | 14 +++++ .../corelib/kernel/qpointer/CMakeLists.txt | 21 ++++++++ .../kernel/qsharedmemory/CMakeLists.txt | 30 +++++++++++ .../producerconsumer/CMakeLists.txt | 16 ++++++ .../kernel/qsignalblocker/CMakeLists.txt | 13 +++++ .../kernel/qsignalmapper/CMakeLists.txt | 14 ++++- .../kernel/qsocketnotifier/CMakeLists.gen.txt | 9 ++++ .../kernel/qsystemsemaphore/CMakeLists.txt | 20 ++++++++ .../acquirerelease/CMakeLists.txt | 16 ++++++ .../auto/corelib/kernel/qtimer/CMakeLists.txt | 21 ++++++++ .../corelib/kernel/qtranslator/CMakeLists.txt | 33 ++++++++++++ .../corelib/kernel/qvariant/CMakeLists.txt | 34 +++++++++++++ .../kernel/qwineventnotifier/CMakeLists.txt | 16 +++++- util/cmake/pro2cmake.py | 51 ++++++++++++++----- 28 files changed, 566 insertions(+), 29 deletions(-) create mode 100644 tests/auto/corelib/kernel/qeventloop/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qmetatype/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qobject/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qpointer/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.gen.txt create mode 100644 tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qtimer/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qtranslator/CMakeLists.txt create mode 100644 tests/auto/corelib/kernel/qvariant/CMakeLists.txt diff --git a/tests/auto/corelib/kernel/CMakeLists.txt b/tests/auto/corelib/kernel/CMakeLists.txt index 208cd89ca73..4abddd700f0 100644 --- a/tests/auto/corelib/kernel/CMakeLists.txt +++ b/tests/auto/corelib/kernel/CMakeLists.txt @@ -1,13 +1,40 @@ +# Generated from kernel.pro. + +# add_subdirectory(qcoreapplication) add_subdirectory(qdeadlinetimer) add_subdirectory(qelapsedtimer) add_subdirectory(qeventdispatcher) +if(NOT ((NOT TARGET Qt::Network))) + add_subdirectory(qeventloop) +endif() add_subdirectory(qmath) -add_subdirectory(qmetaenum) -add_subdirectory(qmetamethod) add_subdirectory(qmetaobject) add_subdirectory(qmetaobjectbuilder) +add_subdirectory(qmetamethod) add_subdirectory(qmetaproperty) -# add_subdirectory(qmimedata) +# add_subdirectory(qmetatype) +add_subdirectory(qmetaenum) +if(NOT ((NOT TARGET Qt::Gui))) + # add_subdirectory(qmimedata) +endif() +if(NOT ((ANDROID OR APPLE_UIKIT) OR (NOT TARGET Qt::Network))) + # add_subdirectory(qobject) +endif() +add_subdirectory(qpointer) +if(NOT ((ANDROID OR APPLE_UIKIT) OR (NOT QT_FEATURE_private_tests))) + add_subdirectory(qsharedmemory) +endif() +add_subdirectory(qsignalblocker) add_subdirectory(qsignalmapper) -# add_subdirectory(qwineventnotifier) - +if(NOT ((NOT QT_FEATURE_private_tests) OR (NOT TARGET Qt::Network))) + add_subdirectory(qsocketnotifier) +endif() +if(NOT ((ANDROID OR APPLE_UIKIT) OR (NOT QT_FEATURE_systemsemaphore))) + add_subdirectory(qsystemsemaphore) +endif() +# add_subdirectory(qtimer) +add_subdirectory(qtranslator) +add_subdirectory(qvariant) +if(NOT ((NOT win32_x_ OR WINRT))) + add_subdirectory(qwineventnotifier) +endif() diff --git a/tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt b/tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt index 0bf39130c2c..de1901e9e46 100644 --- a/tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qdeadlinetimer SOURCES tst_qdeadlinetimer.cpp) +# Generated from qdeadlinetimer.pro. + +##################################################################### +## tst_qdeadlinetimer Test: +##################################################################### + +add_qt_test(tst_qdeadlinetimer + SOURCES + tst_qdeadlinetimer.cpp +) + +#### Keys ignored in scope 1:.:.:qdeadlinetimer.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt b/tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt index 7a937730ab7..9355b18cc51 100644 --- a/tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qelapsedtimer SOURCES tst_qelapsedtimer.cpp) +# Generated from qelapsedtimer.pro. + +##################################################################### +## tst_qelapsedtimer Test: +##################################################################### + +add_qt_test(tst_qelapsedtimer + SOURCES + tst_qelapsedtimer.cpp +) + +#### Keys ignored in scope 1:.:.:qelapsedtimer.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt b/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt index 832bbd4079c..3e9bd56cc46 100644 --- a/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qeventdispatcher SOURCES tst_qeventdispatcher.cpp) +# Generated from qeventdispatcher.pro. + +##################################################################### +## tst_qeventdispatcher Test: +##################################################################### + +add_qt_test(tst_qeventdispatcher + SOURCES + tst_qeventdispatcher.cpp +) + +#### Keys ignored in scope 1:.:.:qeventdispatcher.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt b/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt new file mode 100644 index 00000000000..4f5abffddd9 --- /dev/null +++ b/tests/auto/corelib/kernel/qeventloop/CMakeLists.txt @@ -0,0 +1,30 @@ +# Generated from qeventloop.pro. + +##################################################################### +## tst_qeventloop Test: +##################################################################### + +add_qt_test(tst_qeventloop + SOURCES + tst_qeventloop.cpp + LIBRARIES + Qt::CorePrivate + PUBLIC_LIBRARIES + Qt::Network +) + +#### Keys ignored in scope 1:.:.:qeventloop.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qeventloop CONDITION WIN32 AND NOT WINRT + PUBLIC_LIBRARIES + user32 +) + +extend_target(tst_qeventloop CONDITION QT_FEATURE_glib + DEFINES + HAVE_GLIB +) diff --git a/tests/auto/corelib/kernel/qmath/CMakeLists.txt b/tests/auto/corelib/kernel/qmath/CMakeLists.txt index 3edebc07762..0b5fc995083 100644 --- a/tests/auto/corelib/kernel/qmath/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmath/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qmath SOURCES tst_qmath.cpp) +# Generated from qmath.pro. + +##################################################################### +## tst_qmath Test: +##################################################################### + +add_qt_test(tst_qmath + SOURCES + tst_qmath.cpp +) + +#### Keys ignored in scope 1:.:.:qmath.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt index 2db56b9f3c2..c52b326044f 100644 --- a/tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qmetaenum SOURCES tst_qmetaenum.cpp) +# Generated from qmetaenum.pro. + +##################################################################### +## tst_qmetaenum Test: +##################################################################### + +add_qt_test(tst_qmetaenum + SOURCES + tst_qmetaenum.cpp +) + +#### Keys ignored in scope 1:.:.:qmetaenum.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt b/tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt index ca41b0d676a..9175343044e 100644 --- a/tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qmetamethod SOURCES tst_qmetamethod.cpp) +# Generated from qmetamethod.pro. + +##################################################################### +## tst_qmetamethod Test: +##################################################################### + +add_qt_test(tst_qmetamethod + SOURCES + tst_qmetamethod.cpp +) + +#### Keys ignored in scope 1:.:.:qmetamethod.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt index 61b64ef36d2..3b9fb44a0dc 100644 --- a/tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt @@ -1 +1,21 @@ -add_qt_test(tst_qmetaobject SOURCES tst_qmetaobject.cpp LIBRARIES Qt::CorePrivate) +# Generated from qmetaobject.pro. + +##################################################################### +## tst_qmetaobject Test: +##################################################################### + +add_qt_test(tst_qmetaobject + SOURCES + tst_qmetaobject.cpp + LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qmetaobject.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +#### Keys ignored in scope 2:.:.:qmetaobject.pro:qtConfig(c++14): +# CONFIG = "c++14" diff --git a/tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt index bc86eb1e1ef..cd301b145c3 100644 --- a/tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt @@ -1 +1,15 @@ -add_qt_test(tst_qmetaobjectbuilder SOURCES tst_qmetaobjectbuilder.cpp LIBRARIES Qt::CorePrivate) +# Generated from qmetaobjectbuilder.pro. + +##################################################################### +## tst_qmetaobjectbuilder Test: +##################################################################### + +add_qt_test(tst_qmetaobjectbuilder + SOURCES + tst_qmetaobjectbuilder.cpp + LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qmetaobjectbuilder.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt b/tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt index 46635feb3a6..9543735ee41 100644 --- a/tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qmetaproperty SOURCES tst_qmetaproperty.cpp) +# Generated from qmetaproperty.pro. + +##################################################################### +## tst_qmetaproperty Test: +##################################################################### + +add_qt_test(tst_qmetaproperty + SOURCES + tst_qmetaproperty.cpp +) + +#### Keys ignored in scope 1:.:.:qmetaproperty.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt new file mode 100644 index 00000000000..7a498cecfd2 --- /dev/null +++ b/tests/auto/corelib/kernel/qmetatype/CMakeLists.txt @@ -0,0 +1,41 @@ +# Generated from qmetatype.pro. + +##################################################################### +## tst_qmetatype Test: +##################################################################### + +add_qt_test(tst_qmetatype + SOURCES + tst_qmetatype.cpp + DEFINES + QT_DISABLE_DEPRECATED_BEFORE=0 + INCLUDE_DIRECTORIES + ../../../other/qvariant_common + LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qmetatype.pro:: +# CONFIG = "testcase" +# TESTDATA = "./typeFlags.bin" + +## Scopes: +##################################################################### + +extend_target(tst_qmetatype CONDITION MSVC OR WINRT + COMPILE_OPTIONS + /bigobj +) + +#### Keys ignored in scope 3:.:.:qmetatype.pro:WINRT: +# QMAKE_CFLAGS_RELEASE = "--O2" +# QMAKE_CXXFLAGS_RELEASE = "--O2" + +#### Keys ignored in scope 4:.:.:qmetatype.pro:CLANG: +# QMAKE_CFLAGS_RELEASE = "--O2" "--g" +# QMAKE_CXXFLAGS_RELEASE = "--O2" "--g" + +extend_target(tst_qmetatype CONDITION CLANG AND (TEST_architecture_arch STREQUAL "arm") + DEFINES + TST_QMETATYPE_BROKEN_COMPILER +) diff --git a/tests/auto/corelib/kernel/qmimedata/CMakeLists.txt b/tests/auto/corelib/kernel/qmimedata/CMakeLists.txt index 78d0a69d681..dd1e049209b 100644 --- a/tests/auto/corelib/kernel/qmimedata/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qmimedata/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qmimedata SOURCES tst_qmimedata.cpp) +# Generated from qmimedata.pro. + +##################################################################### +## tst_qmimedata Test: +##################################################################### + +add_qt_test(tst_qmimedata + SOURCES + tst_qmimedata.cpp +) + +#### Keys ignored in scope 1:.:.:qmimedata.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qobject/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/CMakeLists.txt new file mode 100644 index 00000000000..3be3287532f --- /dev/null +++ b/tests/auto/corelib/kernel/qobject/CMakeLists.txt @@ -0,0 +1,29 @@ +# Generated from qobject.pro. + +##################################################################### +## tst_qobject Test: +##################################################################### + +add_qt_test(tst_qobject + SOURCES + tst_qobject.cpp + DEFINES + QT_DISABLE_DEPRECATED_BEFORE=0 + LIBRARIES + Qt::CorePrivate + PUBLIC_LIBRARIES + Qt::Network +) + +#### Keys ignored in scope 3:.:.:test.pro:: +# CONFIG = "testcase" "console" + +## Scopes: +##################################################################### + +#### Keys ignored in scope 4:.:.:test.pro:QT_CONFIG___contains___c++1z: +# CONFIG = "c++1z" + +if(NOT WINRT) + add_subdirectory(signalbug) +endif() diff --git a/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt b/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt new file mode 100644 index 00000000000..b08752030d9 --- /dev/null +++ b/tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt @@ -0,0 +1,14 @@ +# Generated from signalbug.pro. + +##################################################################### +## signalbug Binary: +##################################################################### + +add_qt_executable(signalbug + GUI + SOURCES + signalbug.cpp signalbug.h +) + +#### Keys ignored in scope 1:.:.:signalbug.pro:: +# _LOADED = "qt_test_helper" diff --git a/tests/auto/corelib/kernel/qpointer/CMakeLists.txt b/tests/auto/corelib/kernel/qpointer/CMakeLists.txt new file mode 100644 index 00000000000..c7683d5a24d --- /dev/null +++ b/tests/auto/corelib/kernel/qpointer/CMakeLists.txt @@ -0,0 +1,21 @@ +# Generated from qpointer.pro. + +##################################################################### +## tst_qpointer Test: +##################################################################### + +add_qt_test(tst_qpointer + SOURCES + tst_qpointer.cpp +) + +#### Keys ignored in scope 1:.:.:qpointer.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qpointer CONDITION TARGET Qt::Widgets + PUBLIC_LIBRARIES + Qt::Widgets +) diff --git a/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt new file mode 100644 index 00000000000..366e76d0341 --- /dev/null +++ b/tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt @@ -0,0 +1,30 @@ +# Generated from qsharedmemory.pro. + + +if(QT_FEATURE_sharedmemory) + ##################################################################### + ## tst_qsharedmemory Test: + ##################################################################### + + add_qt_test(tst_qsharedmemory + SOURCES + tst_qsharedmemory.cpp + LIBRARIES + Qt::CorePrivate + ) + +#### Keys ignored in scope 4:.:.:test.pro:: + # CONFIG = "testcase" + + ## Scopes: + ##################################################################### + + extend_target(tst_qsharedmemory CONDITION LINUX + PUBLIC_LIBRARIES + rt + ) + + if(NOT WINRT) + add_subdirectory(producerconsumer) + endif() +endif() diff --git a/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt new file mode 100644 index 00000000000..4b8ff798570 --- /dev/null +++ b/tests/auto/corelib/kernel/qsharedmemory/producerconsumer/CMakeLists.txt @@ -0,0 +1,16 @@ +# Generated from producerconsumer.pro. + +##################################################################### +## producerconsumer Binary: +##################################################################### + +add_qt_executable(producerconsumer + GUI + SOURCES + main.cpp + PUBLIC_LIBRARIES + Qt::Test +) + +#### Keys ignored in scope 1:.:.:producerconsumer.pro:: +# _LOADED = "qt_test_helper" diff --git a/tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt b/tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt new file mode 100644 index 00000000000..f27761f8efd --- /dev/null +++ b/tests/auto/corelib/kernel/qsignalblocker/CMakeLists.txt @@ -0,0 +1,13 @@ +# Generated from qsignalblocker.pro. + +##################################################################### +## tst_qsignalblocker Test: +##################################################################### + +add_qt_test(tst_qsignalblocker + SOURCES + tst_qsignalblocker.cpp +) + +#### Keys ignored in scope 1:.:.:qsignalblocker.pro:: +# CONFIG = "testcase" "console" diff --git a/tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt b/tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt index 1a6416fabb2..4a4b5084fec 100644 --- a/tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qsignalmapper/CMakeLists.txt @@ -1 +1,13 @@ -add_qt_test(tst_qsignalmapper SOURCES tst_qsignalmapper.cpp) +# Generated from qsignalmapper.pro. + +##################################################################### +## tst_qsignalmapper Test: +##################################################################### + +add_qt_test(tst_qsignalmapper + SOURCES + tst_qsignalmapper.cpp +) + +#### Keys ignored in scope 1:.:.:qsignalmapper.pro:: +# CONFIG = "testcase" diff --git a/tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.gen.txt b/tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.gen.txt new file mode 100644 index 00000000000..45c64694dbb --- /dev/null +++ b/tests/auto/corelib/kernel/qsocketnotifier/CMakeLists.gen.txt @@ -0,0 +1,9 @@ +# Generated from qsocketnotifier.pro. + +##################################################################### +## tst_qsocketnotifier Test: +##################################################################### + +add_qt_test(tst_qsocketnotifier + SOURCES + tst_qsocketnotifier.cpp diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt b/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt new file mode 100644 index 00000000000..1e6889eec09 --- /dev/null +++ b/tests/auto/corelib/kernel/qsystemsemaphore/CMakeLists.txt @@ -0,0 +1,20 @@ +# Generated from qsystemsemaphore.pro. + +add_subdirectory(acquirerelease) +##################################################################### +## tst_qsystemsemaphore Test: +##################################################################### + +add_qt_test(tst_qsystemsemaphore + SOURCES + tst_qsystemsemaphore.cpp +) + +#### Keys ignored in scope 2:.:.:test.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +#### Keys ignored in scope 3:.:.:test.pro:WIN32: +# CONFIG = "console" diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt new file mode 100644 index 00000000000..113cc02365c --- /dev/null +++ b/tests/auto/corelib/kernel/qsystemsemaphore/acquirerelease/CMakeLists.txt @@ -0,0 +1,16 @@ +# Generated from acquirerelease.pro. + +##################################################################### +## acquirerelease Binary: +##################################################################### + +add_qt_executable(acquirerelease + GUI + SOURCES + main.cpp + PUBLIC_LIBRARIES + Qt::Test +) + +#### Keys ignored in scope 1:.:.:acquirerelease.pro:: +# _LOADED = "qt_test_helper" diff --git a/tests/auto/corelib/kernel/qtimer/CMakeLists.txt b/tests/auto/corelib/kernel/qtimer/CMakeLists.txt new file mode 100644 index 00000000000..5632875361d --- /dev/null +++ b/tests/auto/corelib/kernel/qtimer/CMakeLists.txt @@ -0,0 +1,21 @@ +# Generated from qtimer.pro. + +##################################################################### +## tst_qtimer Test: +##################################################################### + +add_qt_test(tst_qtimer + SOURCES + tst_qtimer.cpp + LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qtimer.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +#### Keys ignored in scope 2:.:.:qtimer.pro:QT_CONFIG___contains___c++1z: +# CONFIG = "c++1z" diff --git a/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt b/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt new file mode 100644 index 00000000000..fc0b1ccdac1 --- /dev/null +++ b/tests/auto/corelib/kernel/qtranslator/CMakeLists.txt @@ -0,0 +1,33 @@ +# Generated from qtranslator.pro. + +##################################################################### +## tst_qtranslator Test: +##################################################################### + +add_qt_test(tst_qtranslator + SOURCES + tst_qtranslator.cpp +) + +# Resources: +add_qt_resource(tst_qtranslator "qtranslator" PREFIX "/tst_qtranslator" FILES + hellotr_empty.qm + hellotr_la.qm) + + +#### Keys ignored in scope 1:.:.:qtranslator.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +# Resources: +add_qt_resource(tst_qtranslator "android_testdata" PREFIX "/android_testdata" FILES + dependencies_la.qm + hellotr_empty.qm + hellotr_la.qm + msgfmt_from_po.qm) + + +#### Keys ignored in scope 3:.:.:qtranslator.pro:else: +# TESTDATA = "dependencies_la.qm" "hellotr_empty.qm" "hellotr_la.qm" "msgfmt_from_po.qm" diff --git a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt new file mode 100644 index 00000000000..2273dafd79c --- /dev/null +++ b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt @@ -0,0 +1,34 @@ +# Generated from qvariant.pro. + +##################################################################### +## tst_qvariant Test: +##################################################################### + +add_qt_test(tst_qvariant + SOURCES + tst_qvariant.cpp + DEFINES + QT_DISABLE_DEPRECATED_BEFORE=0 + INCLUDE_DIRECTORIES + ../../../other/qvariant_common + LIBRARIES + Qt::CorePrivate +) + +# Resources: +add_qt_resource(tst_qvariant "qvariant" FILES + stream/qt4.9/ + stream/qt5.0/) + + +#### Keys ignored in scope 1:.:.:qvariant.pro:: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +#### Keys ignored in scope 2:.:.:qvariant.pro:qtConfig(c++14): +# CONFIG = "c++14" + +#### Keys ignored in scope 3:.:.:qvariant.pro:qtConfig(c++1z): +# CONFIG = "c++1z" diff --git a/tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt b/tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt index db888dcda0c..f4a1f9bc621 100644 --- a/tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qwineventnotifier/CMakeLists.txt @@ -1 +1,15 @@ -add_qt_test(tst_qwineventnotifier SOURCES tst_qwineventnotifier.cpp LIBRARIES Qt::CorePrivate) +# Generated from qwineventnotifier.pro. + +##################################################################### +## tst_qwineventnotifier Test: +##################################################################### + +add_qt_test(tst_qwineventnotifier + SOURCES + tst_qwineventnotifier.cpp + LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qwineventnotifier.pro:: +# CONFIG = "testcase" diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py index 80e033caf8c..8dab147d54c 100755 --- a/util/cmake/pro2cmake.py +++ b/util/cmake/pro2cmake.py @@ -1026,9 +1026,35 @@ def map_condition(condition: str) -> str: def handle_subdir(scope: Scope, cm_fh: typing.IO[str], *, indent: int = 0, is_example: bool=False) -> None: ind = ' ' * indent + + def find_all_remove_subdir(scope: Scope, + current_conditions: typing.FrozenSet[str]=None, + rm_subdir_conditions: typing.Dict[str, typing.Set[typing.FrozenSet[str]]]=None) -> typing.Dict[str, typing.Set[typing.FrozenSet[str]]]: + rm_subdir_conditions = rm_subdir_conditions if rm_subdir_conditions is not None else dict() + for sd in scope.get_files('SUBDIRS'): + if sd.startswith('-') and current_conditions is not None: + conditions = rm_subdir_conditions.get(sd[1:], set()) + conditions.add(current_conditions) + rm_subdir_conditions[sd[1:]] = conditions + current_conditions = current_conditions if current_conditions is not None else frozenset() + for child_scope in scope.children: + assert child_scope.condition + find_all_remove_subdir(child_scope, frozenset((*current_conditions, child_scope.condition)), rm_subdir_conditions) + return rm_subdir_conditions + + rm_subdir_conditions = find_all_remove_subdir(scope) + for sd in scope.get_files('SUBDIRS'): if os.path.isdir(sd): - cm_fh.write('{}add_subdirectory({})\n'.format(ind, sd)) + conditions = rm_subdir_conditions.get(sd) + cond_ind = ind + if conditions: + conditions_str = " OR ".join(sorted("(" + " AND ".join(condition) + ")" for condition in conditions)) + cm_fh.write(f'{ind}if(NOT ({conditions_str}))\n') + cond_ind += " " + cm_fh.write(f'{cond_ind}add_subdirectory({sd})\n') + if conditions: + cm_fh.write(f'{ind}endif()\n') elif os.path.isfile(sd): subdir_result = parseProFile(sd, debug=False) subdir_scope \ @@ -1039,22 +1065,23 @@ def handle_subdir(scope: Scope, cm_fh: typing.IO[str], *, do_include(subdir_scope) cmakeify_scope(subdir_scope, cm_fh, indent=indent, is_example=is_example) elif sd.startswith('-'): - cm_fh.write('{}### remove_subdirectory' - '("{}")\n'.format(ind, sd[1:])) + pass else: print(' XXXX: SUBDIR {} in {}: Not found.'.format(sd, scope)) for c in scope.children: cond = c.condition - if cond == 'else': - cm_fh.write('\n{}else()\n'.format(ind)) - elif cond: - cm_fh.write('\n{}if({})\n'.format(ind, cond)) - - handle_subdir(c, cm_fh, indent=indent + 1, is_example=is_example) - - if cond: - cm_fh.write('{}endif()\n'.format(ind)) + temp_buf = io.StringIO('') # we do not want to print empty conditions + handle_subdir(c, temp_buf, indent=indent + 1, is_example=is_example) + sub_call_str = temp_buf.getvalue() + if sub_call_str: + if cond == 'else': + cm_fh.write('\n{}else()\n'.format(ind)) + elif cond: + cm_fh.write('\n{}if({})\n'.format(ind, cond)) + cm_fh.write(sub_call_str) + if cond: + cm_fh.write('{}endif()\n'.format(ind)) def sort_sources(sources: typing.List[str]) -> typing.List[str]: