Skip to content

Commit

Permalink
Implement SUBDIR-= conversion in pro2cmake tool
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nierob authored and alcroito committed Aug 1, 2019
1 parent a920c16 commit b26b145
Show file tree
Hide file tree
Showing 28 changed files with 566 additions and 29 deletions.
37 changes: 32 additions & 5 deletions tests/auto/corelib/kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qdeadlinetimer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qelapsedtimer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qeventdispatcher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
30 changes: 30 additions & 0 deletions tests/auto/corelib/kernel/qeventloop/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# 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
)
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qmath/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qmetaenum/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qmetamethod/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
22 changes: 21 additions & 1 deletion tests/auto/corelib/kernel/qmetaobject/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"

## Scopes:
#####################################################################

#### Keys ignored in scope 2:.:.:qmetaobject.pro:qtConfig(c++14):
# CONFIG = "c++14"
16 changes: 15 additions & 1 deletion tests/auto/corelib/kernel/qmetaobjectbuilder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qmetaproperty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
41 changes: 41 additions & 0 deletions tests/auto/corelib/kernel/qmetatype/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# 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
)
14 changes: 13 additions & 1 deletion tests/auto/corelib/kernel/qmimedata/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"
29 changes: 29 additions & 0 deletions tests/auto/corelib/kernel/qobject/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# 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()
14 changes: 14 additions & 0 deletions tests/auto/corelib/kernel/qobject/signalbug/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# _LOADED = "qt_test_helper"
21 changes: 21 additions & 0 deletions tests/auto/corelib/kernel/qpointer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"

## Scopes:
#####################################################################

extend_target(tst_qpointer CONDITION TARGET Qt::Widgets
PUBLIC_LIBRARIES
Qt::Widgets
)
30 changes: 30 additions & 0 deletions tests/auto/corelib/kernel/qsharedmemory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# CONFIG = "testcase"

## Scopes:
#####################################################################

extend_target(tst_qsharedmemory CONDITION LINUX
PUBLIC_LIBRARIES
rt
)

if(NOT WINRT)
add_subdirectory(producerconsumer)
endif()
endif()
Original file line number Diff line number Diff line change
@@ -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:<TRUE>:
# _LOADED = "qt_test_helper"
Loading

0 comments on commit b26b145

Please sign in to comment.