From aa50b377a7d904e35cf3a26e4c8a054108011ffd Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 20 Mar 2019 13:41:37 +0100 Subject: CMake: Add widgets examples Change-Id: Ib6142b93df066e3658eb189b50ca74c455fe7e56 Reviewed-by: Alexandru Croitor --- examples/widgets/animation/CMakeLists.txt | 8 ++ .../widgets/animation/animatedtiles/CMakeLists.txt | 26 ++++ examples/widgets/animation/easing/CMakeLists.txt | 23 ++++ .../widgets/animation/moveblocks/CMakeLists.txt | 15 +++ examples/widgets/animation/states/CMakeLists.txt | 25 ++++ examples/widgets/animation/stickman/CMakeLists.txt | 29 +++++ .../widgets/animation/sub-attaq/CMakeLists.txt | 142 +++++++++++++++++++++ 7 files changed, 268 insertions(+) create mode 100644 examples/widgets/animation/CMakeLists.txt create mode 100644 examples/widgets/animation/animatedtiles/CMakeLists.txt create mode 100644 examples/widgets/animation/easing/CMakeLists.txt create mode 100644 examples/widgets/animation/moveblocks/CMakeLists.txt create mode 100644 examples/widgets/animation/states/CMakeLists.txt create mode 100644 examples/widgets/animation/stickman/CMakeLists.txt create mode 100644 examples/widgets/animation/sub-attaq/CMakeLists.txt (limited to 'examples/widgets/animation') diff --git a/examples/widgets/animation/CMakeLists.txt b/examples/widgets/animation/CMakeLists.txt new file mode 100644 index 0000000000..15f62728da --- /dev/null +++ b/examples/widgets/animation/CMakeLists.txt @@ -0,0 +1,8 @@ +# Generated from animation.pro. + +add_subdirectory(animatedtiles) +add_subdirectory(easing) +add_subdirectory(moveblocks) +add_subdirectory(states) +add_subdirectory(stickman) +add_subdirectory(sub-attaq) diff --git a/examples/widgets/animation/animatedtiles/CMakeLists.txt b/examples/widgets/animation/animatedtiles/CMakeLists.txt new file mode 100644 index 0000000000..0af95adcf8 --- /dev/null +++ b/examples/widgets/animation/animatedtiles/CMakeLists.txt @@ -0,0 +1,26 @@ +# Generated from animatedtiles.pro. + +##################################################################### +## animatedtiles Binary: +##################################################################### + +add_qt_executable(animatedtiles + GUI + OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/animatedtiles" + INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/animatedtiles" + SOURCES + main.cpp + LIBRARIES + Qt::Widgets +) + +# Resources: +add_qt_resource(animatedtiles "animatedtiles" FILES + images/Time-For-Lunch-2.jpg + images/centered.png + images/ellipse.png + images/figure8.png + images/kinetic.png + images/random.png + images/tile.png) + diff --git a/examples/widgets/animation/easing/CMakeLists.txt b/examples/widgets/animation/easing/CMakeLists.txt new file mode 100644 index 0000000000..ba391d082b --- /dev/null +++ b/examples/widgets/animation/easing/CMakeLists.txt @@ -0,0 +1,23 @@ +# Generated from easing.pro. + +##################################################################### +## easing Binary: +##################################################################### + +add_qt_executable(easing + GUI + OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/easing" + INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/easing" + SOURCES + animation.h + form.ui + main.cpp + window.cpp window.h + LIBRARIES + Qt::Widgets +) + +# Resources: +add_qt_resource(easing "easing" FILES + images/qt-logo.png) + diff --git a/examples/widgets/animation/moveblocks/CMakeLists.txt b/examples/widgets/animation/moveblocks/CMakeLists.txt new file mode 100644 index 0000000000..5cbb8f4936 --- /dev/null +++ b/examples/widgets/animation/moveblocks/CMakeLists.txt @@ -0,0 +1,15 @@ +# Generated from moveblocks.pro. + +##################################################################### +## moveblocks Binary: +##################################################################### + +add_qt_executable(moveblocks + GUI + OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/moveblocks" + INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/moveblocks" + SOURCES + main.cpp + LIBRARIES + Qt::Widgets +) diff --git a/examples/widgets/animation/states/CMakeLists.txt b/examples/widgets/animation/states/CMakeLists.txt new file mode 100644 index 0000000000..52a9357789 --- /dev/null +++ b/examples/widgets/animation/states/CMakeLists.txt @@ -0,0 +1,25 @@ +# Generated from states.pro. + +##################################################################### +## states Binary: +##################################################################### + +add_qt_executable(states + GUI + OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/states" + INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/states" + SOURCES + main.cpp + LIBRARIES + Qt::Widgets +) + +# Resources: +add_qt_resource(states "states" FILES + accessories-dictionary.png + akregator.png + digikam.png + help-browser.png + k3b.png + kchart.png) + diff --git a/examples/widgets/animation/stickman/CMakeLists.txt b/examples/widgets/animation/stickman/CMakeLists.txt new file mode 100644 index 0000000000..f604598232 --- /dev/null +++ b/examples/widgets/animation/stickman/CMakeLists.txt @@ -0,0 +1,29 @@ +# Generated from stickman.pro. + +##################################################################### +## stickman Binary: +##################################################################### + +add_qt_executable(stickman + GUI + OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/stickman" + INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/stickman" + SOURCES + animation.cpp animation.h + graphicsview.cpp graphicsview.h + lifecycle.cpp lifecycle.h + main.cpp + node.cpp node.h + rectbutton.cpp rectbutton.h + stickman.cpp stickman.h + LIBRARIES + Qt::Widgets +) + +# Resources: +add_qt_resource(stickman "stickman" FILES + animations/chilling.bin + animations/dancing.bin + animations/dead.bin + animations/jumping.bin) + diff --git a/examples/widgets/animation/sub-attaq/CMakeLists.txt b/examples/widgets/animation/sub-attaq/CMakeLists.txt new file mode 100644 index 0000000000..e7cb602e19 --- /dev/null +++ b/examples/widgets/animation/sub-attaq/CMakeLists.txt @@ -0,0 +1,142 @@ +# Generated from sub-attaq.pro. + +##################################################################### +## sub-attaq Binary: +##################################################################### + +add_qt_executable(sub-attaq + GUI + OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/sub-attaq" + INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/sub-attaq" + SOURCES + animationmanager.cpp animationmanager.h + boat.cpp boat.h boat_p.h + bomb.cpp bomb.h + graphicsscene.cpp graphicsscene.h + main.cpp + mainwindow.cpp mainwindow.h + pixmapitem.cpp pixmapitem.h + progressitem.cpp progressitem.h + qanimationstate.cpp qanimationstate.h + states.cpp states.h + submarine.cpp submarine.h submarine_p.h + textinformationitem.cpp textinformationitem.h + torpedo.cpp torpedo.h + LIBRARIES + Qt::Widgets +) + +# Resources: +set_source_files_properties("pics/big/background.png" + PROPERTIES alias "big/background") +set_source_files_properties("pics/big/boat.png" + PROPERTIES alias "big/boat") +set_source_files_properties("pics/big/bomb.png" + PROPERTIES alias "big/bomb") +set_source_files_properties("pics/big/explosion/boat/step1.png" + PROPERTIES alias "big/explosion/boat/step1") +set_source_files_properties("pics/big/explosion/boat/step2.png" + PROPERTIES alias "big/explosion/boat/step2") +set_source_files_properties("pics/big/explosion/boat/step3.png" + PROPERTIES alias "big/explosion/boat/step3") +set_source_files_properties("pics/big/explosion/boat/step4.png" + PROPERTIES alias "big/explosion/boat/step4") +set_source_files_properties("pics/big/explosion/submarine/step1.png" + PROPERTIES alias "big/explosion/submarine/step1") +set_source_files_properties("pics/big/explosion/submarine/step2.png" + PROPERTIES alias "big/explosion/submarine/step2") +set_source_files_properties("pics/big/explosion/submarine/step3.png" + PROPERTIES alias "big/explosion/submarine/step3") +set_source_files_properties("pics/big/explosion/submarine/step4.png" + PROPERTIES alias "big/explosion/submarine/step4") +set_source_files_properties("pics/big/submarine.png" + PROPERTIES alias "big/submarine") +set_source_files_properties("pics/big/surface.png" + PROPERTIES alias "big/surface") +set_source_files_properties("pics/big/torpedo.png" + PROPERTIES alias "big/torpedo") +set_source_files_properties("pics/scalable/boat.svg" + PROPERTIES alias "boat") +set_source_files_properties("pics/scalable/sub-attaq.svg" + PROPERTIES alias "all") +set_source_files_properties("pics/scalable/submarine.svg" + PROPERTIES alias "submarine") +set_source_files_properties("pics/scalable/torpedo.svg" + PROPERTIES alias "torpedo") +set_source_files_properties("pics/small/background.png" + PROPERTIES alias "small/background") +set_source_files_properties("pics/small/boat.png" + PROPERTIES alias "small/boat") +set_source_files_properties("pics/small/bomb.png" + PROPERTIES alias "small/bomb") +set_source_files_properties("pics/small/submarine.png" + PROPERTIES alias "small/submarine") +set_source_files_properties("pics/small/surface.png" + PROPERTIES alias "small/surface") +set_source_files_properties("pics/small/torpedo.png" + PROPERTIES alias "small/torpedo") +set_source_files_properties("pics/welcome/logo-a.png" + PROPERTIES alias "logo-a") +set_source_files_properties("pics/welcome/logo-a2.png" + PROPERTIES alias "logo-a2") +set_source_files_properties("pics/welcome/logo-b.png" + PROPERTIES alias "logo-b") +set_source_files_properties("pics/welcome/logo-dash.png" + PROPERTIES alias "logo-dash") +set_source_files_properties("pics/welcome/logo-excl.png" + PROPERTIES alias "logo-excl") +set_source_files_properties("pics/welcome/logo-q.png" + PROPERTIES alias "logo-q") +set_source_files_properties("pics/welcome/logo-s.png" + PROPERTIES alias "logo-s") +set_source_files_properties("pics/welcome/logo-t.png" + PROPERTIES alias "logo-t") +set_source_files_properties("pics/welcome/logo-t2.png" + PROPERTIES alias "logo-t2") +set_source_files_properties("pics/welcome/logo-u.png" + PROPERTIES alias "logo-u") +add_qt_resource(sub-attaq "subattaq" PREFIX "/" FILES + data.xml + pics/big/background.png + pics/big/boat.png + pics/big/bomb.png + pics/big/explosion/boat/step1.png + pics/big/explosion/boat/step2.png + pics/big/explosion/boat/step3.png + pics/big/explosion/boat/step4.png + pics/big/explosion/submarine/step1.png + pics/big/explosion/submarine/step2.png + pics/big/explosion/submarine/step3.png + pics/big/explosion/submarine/step4.png + pics/big/submarine.png + pics/big/surface.png + pics/big/torpedo.png + pics/scalable/boat.svg + pics/scalable/sub-attaq.svg + pics/scalable/submarine.svg + pics/scalable/torpedo.svg + pics/small/background.png + pics/small/boat.png + pics/small/bomb.png + pics/small/submarine.png + pics/small/surface.png + pics/small/torpedo.png + pics/welcome/logo-a.png + pics/welcome/logo-a2.png + pics/welcome/logo-b.png + pics/welcome/logo-dash.png + pics/welcome/logo-excl.png + pics/welcome/logo-q.png + pics/welcome/logo-s.png + pics/welcome/logo-t.png + pics/welcome/logo-t2.png + pics/welcome/logo-u.png) + + +## Scopes: +##################################################################### + +extend_target(sub-attaq CONDITION TARGET Qt::OpenGL + LIBRARIES + Qt::OpenGL +) -- cgit v1.2.3 From fa21d29b7506e21db8a433e117aebb9f3c724f03 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 22 May 2019 16:23:24 +0200 Subject: Rerun pro2cmake on projects that use .ui files Task-number: QTBUG-75875 Change-Id: I95109b07fc4a6e09fe7911a21fc5f27f2c895d77 Reviewed-by: Simon Hausmann Reviewed-by: Qt CMake Build Bot --- examples/widgets/animation/easing/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'examples/widgets/animation') diff --git a/examples/widgets/animation/easing/CMakeLists.txt b/examples/widgets/animation/easing/CMakeLists.txt index ba391d082b..b7444412a6 100644 --- a/examples/widgets/animation/easing/CMakeLists.txt +++ b/examples/widgets/animation/easing/CMakeLists.txt @@ -13,8 +13,10 @@ add_qt_executable(easing form.ui main.cpp window.cpp window.h - LIBRARIES + PUBLIC_LIBRARIES Qt::Widgets + ENABLE_AUTOGEN_TOOLS + uic ) # Resources: -- cgit v1.2.3 From 99539a289491a2a709c2a63cd91eac155a1699da Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 4 Jun 2019 17:08:47 +0200 Subject: Allow to build examples as standalone project Create CMake config files which can be used from the very same CMake project. These CMake config files simply do not create any targets, controlled via the QT_NO_CREATE_TARGETS. This patch also allows to build qtbase.git:examples as a standalone project, against an already-built Qt. Ran this: ag -s "QT " examples -l -0 | xargs -0 -n 1 .../util/cmake/pro2cmake.py --is-example Task-number: QTBUG-74713 Change-Id: I44cce5a4048618b30f890c5b789592c227a8b47d Reviewed-by: Alexandru Croitor --- .../widgets/animation/animatedtiles/CMakeLists.txt | 43 +++--- examples/widgets/animation/easing/CMakeLists.txt | 45 +++--- .../widgets/animation/moveblocks/CMakeLists.txt | 35 +++-- examples/widgets/animation/states/CMakeLists.txt | 42 ++--- examples/widgets/animation/stickman/CMakeLists.txt | 51 ++++--- .../widgets/animation/sub-attaq/CMakeLists.txt | 169 +++++---------------- 6 files changed, 154 insertions(+), 231 deletions(-) (limited to 'examples/widgets/animation') diff --git a/examples/widgets/animation/animatedtiles/CMakeLists.txt b/examples/widgets/animation/animatedtiles/CMakeLists.txt index 0af95adcf8..dacde5535c 100644 --- a/examples/widgets/animation/animatedtiles/CMakeLists.txt +++ b/examples/widgets/animation/animatedtiles/CMakeLists.txt @@ -1,26 +1,27 @@ # Generated from animatedtiles.pro. -##################################################################### -## animatedtiles Binary: -##################################################################### +cmake_minimum_required(VERSION 3.14) +project(animatedtiles LANGUAGES CXX) -add_qt_executable(animatedtiles - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/animatedtiles" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/animatedtiles" - SOURCES - main.cpp - LIBRARIES - Qt::Widgets -) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) -# Resources: -add_qt_resource(animatedtiles "animatedtiles" FILES - images/Time-For-Lunch-2.jpg - images/centered.png - images/ellipse.png - images/figure8.png - images/kinetic.png - images/random.png - images/tile.png) +set(INSTALL_EXAMPLEDIR "examples") +find_package(Qt5 COMPONENTS Widgets) + +add_executable(animatedtiles WIN32 MACOSX_BUNDLE + animatedtiles.qrc + main.cpp +) +target_link_libraries(animatedtiles PUBLIC + Qt::Widgets +) + +install(TARGETS animatedtiles + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/widgets/animation/easing/CMakeLists.txt b/examples/widgets/animation/easing/CMakeLists.txt index b7444412a6..1500b11f3b 100644 --- a/examples/widgets/animation/easing/CMakeLists.txt +++ b/examples/widgets/animation/easing/CMakeLists.txt @@ -1,25 +1,30 @@ # Generated from easing.pro. -##################################################################### -## easing Binary: -##################################################################### +cmake_minimum_required(VERSION 3.14) +project(easing LANGUAGES CXX) -add_qt_executable(easing - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/easing" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/easing" - SOURCES - animation.h - form.ui - main.cpp - window.cpp window.h - PUBLIC_LIBRARIES - Qt::Widgets - ENABLE_AUTOGEN_TOOLS - uic -) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) -# Resources: -add_qt_resource(easing "easing" FILES - images/qt-logo.png) +set(INSTALL_EXAMPLEDIR "examples") +find_package(Qt5 COMPONENTS Widgets) + +add_executable(easing WIN32 MACOSX_BUNDLE + animation.h + easing.qrc + form.ui + main.cpp + window.cpp window.h +) +target_link_libraries(easing PUBLIC + Qt::Widgets +) + +install(TARGETS easing + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/widgets/animation/moveblocks/CMakeLists.txt b/examples/widgets/animation/moveblocks/CMakeLists.txt index 5cbb8f4936..cc2b70af44 100644 --- a/examples/widgets/animation/moveblocks/CMakeLists.txt +++ b/examples/widgets/animation/moveblocks/CMakeLists.txt @@ -1,15 +1,26 @@ # Generated from moveblocks.pro. -##################################################################### -## moveblocks Binary: -##################################################################### - -add_qt_executable(moveblocks - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/moveblocks" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/moveblocks" - SOURCES - main.cpp - LIBRARIES - Qt::Widgets +cmake_minimum_required(VERSION 3.14) +project(moveblocks LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples") + +find_package(Qt5 COMPONENTS Widgets) + +add_executable(moveblocks WIN32 MACOSX_BUNDLE + main.cpp +) +target_link_libraries(moveblocks PUBLIC + Qt::Widgets +) + +install(TARGETS moveblocks + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" ) diff --git a/examples/widgets/animation/states/CMakeLists.txt b/examples/widgets/animation/states/CMakeLists.txt index 52a9357789..a28995db99 100644 --- a/examples/widgets/animation/states/CMakeLists.txt +++ b/examples/widgets/animation/states/CMakeLists.txt @@ -1,25 +1,27 @@ # Generated from states.pro. -##################################################################### -## states Binary: -##################################################################### +cmake_minimum_required(VERSION 3.14) +project(states LANGUAGES CXX) -add_qt_executable(states - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/states" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/states" - SOURCES - main.cpp - LIBRARIES - Qt::Widgets -) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) -# Resources: -add_qt_resource(states "states" FILES - accessories-dictionary.png - akregator.png - digikam.png - help-browser.png - k3b.png - kchart.png) +set(INSTALL_EXAMPLEDIR "examples") +find_package(Qt5 COMPONENTS Widgets) + +add_executable(states WIN32 MACOSX_BUNDLE + main.cpp + states.qrc +) +target_link_libraries(states PUBLIC + Qt::Widgets +) + +install(TARGETS states + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/widgets/animation/stickman/CMakeLists.txt b/examples/widgets/animation/stickman/CMakeLists.txt index f604598232..5cb2e86c48 100644 --- a/examples/widgets/animation/stickman/CMakeLists.txt +++ b/examples/widgets/animation/stickman/CMakeLists.txt @@ -1,29 +1,32 @@ # Generated from stickman.pro. -##################################################################### -## stickman Binary: -##################################################################### +cmake_minimum_required(VERSION 3.14) +project(stickman LANGUAGES CXX) -add_qt_executable(stickman - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/stickman" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/stickman" - SOURCES - animation.cpp animation.h - graphicsview.cpp graphicsview.h - lifecycle.cpp lifecycle.h - main.cpp - node.cpp node.h - rectbutton.cpp rectbutton.h - stickman.cpp stickman.h - LIBRARIES - Qt::Widgets -) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) -# Resources: -add_qt_resource(stickman "stickman" FILES - animations/chilling.bin - animations/dancing.bin - animations/dead.bin - animations/jumping.bin) +set(INSTALL_EXAMPLEDIR "examples") +find_package(Qt5 COMPONENTS Widgets) + +add_executable(stickman WIN32 MACOSX_BUNDLE + animation.cpp animation.h + graphicsview.cpp graphicsview.h + lifecycle.cpp lifecycle.h + main.cpp + node.cpp node.h + rectbutton.cpp rectbutton.h + stickman.cpp stickman.h stickman.qrc +) +target_link_libraries(stickman PUBLIC + Qt::Widgets +) + +install(TARGETS stickman + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/widgets/animation/sub-attaq/CMakeLists.txt b/examples/widgets/animation/sub-attaq/CMakeLists.txt index e7cb602e19..3260a5f75d 100644 --- a/examples/widgets/animation/sub-attaq/CMakeLists.txt +++ b/examples/widgets/animation/sub-attaq/CMakeLists.txt @@ -1,142 +1,43 @@ # Generated from sub-attaq.pro. -##################################################################### -## sub-attaq Binary: -##################################################################### +cmake_minimum_required(VERSION 3.14) +project(sub-attaq LANGUAGES CXX) -add_qt_executable(sub-attaq - GUI - OUTPUT_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/sub-attaq" - INSTALL_DIRECTORY "${INSTALL_EXAMPLESDIR}/widgets/animation/sub-attaq" - SOURCES - animationmanager.cpp animationmanager.h - boat.cpp boat.h boat_p.h - bomb.cpp bomb.h - graphicsscene.cpp graphicsscene.h - main.cpp - mainwindow.cpp mainwindow.h - pixmapitem.cpp pixmapitem.h - progressitem.cpp progressitem.h - qanimationstate.cpp qanimationstate.h - states.cpp states.h - submarine.cpp submarine.h submarine_p.h - textinformationitem.cpp textinformationitem.h - torpedo.cpp torpedo.h - LIBRARIES - Qt::Widgets -) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) -# Resources: -set_source_files_properties("pics/big/background.png" - PROPERTIES alias "big/background") -set_source_files_properties("pics/big/boat.png" - PROPERTIES alias "big/boat") -set_source_files_properties("pics/big/bomb.png" - PROPERTIES alias "big/bomb") -set_source_files_properties("pics/big/explosion/boat/step1.png" - PROPERTIES alias "big/explosion/boat/step1") -set_source_files_properties("pics/big/explosion/boat/step2.png" - PROPERTIES alias "big/explosion/boat/step2") -set_source_files_properties("pics/big/explosion/boat/step3.png" - PROPERTIES alias "big/explosion/boat/step3") -set_source_files_properties("pics/big/explosion/boat/step4.png" - PROPERTIES alias "big/explosion/boat/step4") -set_source_files_properties("pics/big/explosion/submarine/step1.png" - PROPERTIES alias "big/explosion/submarine/step1") -set_source_files_properties("pics/big/explosion/submarine/step2.png" - PROPERTIES alias "big/explosion/submarine/step2") -set_source_files_properties("pics/big/explosion/submarine/step3.png" - PROPERTIES alias "big/explosion/submarine/step3") -set_source_files_properties("pics/big/explosion/submarine/step4.png" - PROPERTIES alias "big/explosion/submarine/step4") -set_source_files_properties("pics/big/submarine.png" - PROPERTIES alias "big/submarine") -set_source_files_properties("pics/big/surface.png" - PROPERTIES alias "big/surface") -set_source_files_properties("pics/big/torpedo.png" - PROPERTIES alias "big/torpedo") -set_source_files_properties("pics/scalable/boat.svg" - PROPERTIES alias "boat") -set_source_files_properties("pics/scalable/sub-attaq.svg" - PROPERTIES alias "all") -set_source_files_properties("pics/scalable/submarine.svg" - PROPERTIES alias "submarine") -set_source_files_properties("pics/scalable/torpedo.svg" - PROPERTIES alias "torpedo") -set_source_files_properties("pics/small/background.png" - PROPERTIES alias "small/background") -set_source_files_properties("pics/small/boat.png" - PROPERTIES alias "small/boat") -set_source_files_properties("pics/small/bomb.png" - PROPERTIES alias "small/bomb") -set_source_files_properties("pics/small/submarine.png" - PROPERTIES alias "small/submarine") -set_source_files_properties("pics/small/surface.png" - PROPERTIES alias "small/surface") -set_source_files_properties("pics/small/torpedo.png" - PROPERTIES alias "small/torpedo") -set_source_files_properties("pics/welcome/logo-a.png" - PROPERTIES alias "logo-a") -set_source_files_properties("pics/welcome/logo-a2.png" - PROPERTIES alias "logo-a2") -set_source_files_properties("pics/welcome/logo-b.png" - PROPERTIES alias "logo-b") -set_source_files_properties("pics/welcome/logo-dash.png" - PROPERTIES alias "logo-dash") -set_source_files_properties("pics/welcome/logo-excl.png" - PROPERTIES alias "logo-excl") -set_source_files_properties("pics/welcome/logo-q.png" - PROPERTIES alias "logo-q") -set_source_files_properties("pics/welcome/logo-s.png" - PROPERTIES alias "logo-s") -set_source_files_properties("pics/welcome/logo-t.png" - PROPERTIES alias "logo-t") -set_source_files_properties("pics/welcome/logo-t2.png" - PROPERTIES alias "logo-t2") -set_source_files_properties("pics/welcome/logo-u.png" - PROPERTIES alias "logo-u") -add_qt_resource(sub-attaq "subattaq" PREFIX "/" FILES - data.xml - pics/big/background.png - pics/big/boat.png - pics/big/bomb.png - pics/big/explosion/boat/step1.png - pics/big/explosion/boat/step2.png - pics/big/explosion/boat/step3.png - pics/big/explosion/boat/step4.png - pics/big/explosion/submarine/step1.png - pics/big/explosion/submarine/step2.png - pics/big/explosion/submarine/step3.png - pics/big/explosion/submarine/step4.png - pics/big/submarine.png - pics/big/surface.png - pics/big/torpedo.png - pics/scalable/boat.svg - pics/scalable/sub-attaq.svg - pics/scalable/submarine.svg - pics/scalable/torpedo.svg - pics/small/background.png - pics/small/boat.png - pics/small/bomb.png - pics/small/submarine.png - pics/small/surface.png - pics/small/torpedo.png - pics/welcome/logo-a.png - pics/welcome/logo-a2.png - pics/welcome/logo-b.png - pics/welcome/logo-dash.png - pics/welcome/logo-excl.png - pics/welcome/logo-q.png - pics/welcome/logo-s.png - pics/welcome/logo-t.png - pics/welcome/logo-t2.png - pics/welcome/logo-u.png) +set(INSTALL_EXAMPLEDIR "examples") +find_package(Qt5 COMPONENTS Widgets) +find_package(Qt5 COMPONENTS OpenGL) # special case -## Scopes: -##################################################################### +add_executable(sub-attaq WIN32 MACOSX_BUNDLE + animationmanager.cpp animationmanager.h + boat.cpp boat.h boat_p.h + bomb.cpp bomb.h + graphicsscene.cpp graphicsscene.h + main.cpp + mainwindow.cpp mainwindow.h + pixmapitem.cpp pixmapitem.h + progressitem.cpp progressitem.h + qanimationstate.cpp qanimationstate.h + states.cpp states.h + subattaq.qrc + submarine.cpp submarine.h submarine_p.h + textinformationitem.cpp textinformationitem.h + torpedo.cpp torpedo.h +) +target_link_libraries(sub-attaq PUBLIC + Qt::Widgets +) +if (TARGET Qt::OpenGL) + target_link_libraries(sub-attaq PUBLIC Qt::OpenGL) +endif() -extend_target(sub-attaq CONDITION TARGET Qt::OpenGL - LIBRARIES - Qt::OpenGL +install(TARGETS sub-attaq + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" ) -- cgit v1.2.3 From 6732fa3a291e77acad3ab6ba829d1026462dc139 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 11 Jun 2019 15:46:31 +0200 Subject: Fix linking of examples Provide add_qt_gui_executable() as function in our public API that takes care of automaticWinMain linkage. We can use this in the future to encapsulate similarplatform-specific behavior and adjustments, such as module generation onAndroid. In order for the examples to see the function in Qt5CoreMacros, three more additional fixes were required: * Do the build_repo_end() call _before_ attempting to build the examples, as we need the build_repo_end() to include QtPostProcess and complete the creation of all the target config files. Otherwise the find_package() calls in the examples see something incomplete. * Add more QT_NO_CREATE_TARGET guards * Always call find_dependency on the dependencies, regardless of the target creation mode. This way a find_package(Qt5 COMPONENTS Widgets) will still load Qt5CoreMacros. Change-Id: I03ce856e2f4312a050fe8043b8331cbe8a6c93e6 Reviewed-by: Qt CMake Build Bot Reviewed-by: Leander Beernaert Reviewed-by: Alexandru Croitor --- examples/widgets/animation/animatedtiles/CMakeLists.txt | 2 +- examples/widgets/animation/easing/CMakeLists.txt | 2 +- examples/widgets/animation/moveblocks/CMakeLists.txt | 2 +- examples/widgets/animation/states/CMakeLists.txt | 2 +- examples/widgets/animation/stickman/CMakeLists.txt | 2 +- examples/widgets/animation/sub-attaq/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/widgets/animation') diff --git a/examples/widgets/animation/animatedtiles/CMakeLists.txt b/examples/widgets/animation/animatedtiles/CMakeLists.txt index dacde5535c..e3fa88aebb 100644 --- a/examples/widgets/animation/animatedtiles/CMakeLists.txt +++ b/examples/widgets/animation/animatedtiles/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(animatedtiles WIN32 MACOSX_BUNDLE +add_qt_gui_executable(animatedtiles WIN32 MACOSX_BUNDLE animatedtiles.qrc main.cpp ) diff --git a/examples/widgets/animation/easing/CMakeLists.txt b/examples/widgets/animation/easing/CMakeLists.txt index 1500b11f3b..441b27b0c4 100644 --- a/examples/widgets/animation/easing/CMakeLists.txt +++ b/examples/widgets/animation/easing/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(easing WIN32 MACOSX_BUNDLE +add_qt_gui_executable(easing WIN32 MACOSX_BUNDLE animation.h easing.qrc form.ui diff --git a/examples/widgets/animation/moveblocks/CMakeLists.txt b/examples/widgets/animation/moveblocks/CMakeLists.txt index cc2b70af44..971bf2e7e5 100644 --- a/examples/widgets/animation/moveblocks/CMakeLists.txt +++ b/examples/widgets/animation/moveblocks/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(moveblocks WIN32 MACOSX_BUNDLE +add_qt_gui_executable(moveblocks WIN32 MACOSX_BUNDLE main.cpp ) target_link_libraries(moveblocks PUBLIC diff --git a/examples/widgets/animation/states/CMakeLists.txt b/examples/widgets/animation/states/CMakeLists.txt index a28995db99..bd353422d2 100644 --- a/examples/widgets/animation/states/CMakeLists.txt +++ b/examples/widgets/animation/states/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(states WIN32 MACOSX_BUNDLE +add_qt_gui_executable(states WIN32 MACOSX_BUNDLE main.cpp states.qrc ) diff --git a/examples/widgets/animation/stickman/CMakeLists.txt b/examples/widgets/animation/stickman/CMakeLists.txt index 5cb2e86c48..90bc09e5d7 100644 --- a/examples/widgets/animation/stickman/CMakeLists.txt +++ b/examples/widgets/animation/stickman/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_executable(stickman WIN32 MACOSX_BUNDLE +add_qt_gui_executable(stickman WIN32 MACOSX_BUNDLE animation.cpp animation.h graphicsview.cpp graphicsview.h lifecycle.cpp lifecycle.h diff --git a/examples/widgets/animation/sub-attaq/CMakeLists.txt b/examples/widgets/animation/sub-attaq/CMakeLists.txt index 3260a5f75d..883c1cd0c5 100644 --- a/examples/widgets/animation/sub-attaq/CMakeLists.txt +++ b/examples/widgets/animation/sub-attaq/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) find_package(Qt5 COMPONENTS OpenGL) # special case -add_executable(sub-attaq WIN32 MACOSX_BUNDLE +add_qt_gui_executable(sub-attaq WIN32 MACOSX_BUNDLE animationmanager.cpp animationmanager.h boat.cpp boat.h boat_p.h bomb.cpp bomb.h -- cgit v1.2.3 From efa9998521cb061051fe8b75d0df3206d0b32ec5 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 12 Jun 2019 10:21:40 +0200 Subject: Fix compiling of examples on Android * Simplify add_qt_gui_executable() to not require WIN32/MACOSX_BUNDLE but provide it implicitly. It's redundant :) * When on Android, build a module (shared library), just like qmake. This requires an additional library destination in the install() call, but that's ignored on other platforms. * Fix typos in the android deployment generation settings function * Use the correct cache variable to determine whether we're inside a Qt build or not. Right now this only works inside Qt builds anyway as QtPlatformAndroid.cmake is not publically accessible. Change-Id: If1c763c31a7a83d0e0d854362ba7901657f63eb5 Reviewed-by: Alexandru Croitor Reviewed-by: Qt CMake Build Bot --- examples/widgets/animation/animatedtiles/CMakeLists.txt | 3 ++- examples/widgets/animation/easing/CMakeLists.txt | 3 ++- examples/widgets/animation/moveblocks/CMakeLists.txt | 3 ++- examples/widgets/animation/states/CMakeLists.txt | 3 ++- examples/widgets/animation/stickman/CMakeLists.txt | 3 ++- examples/widgets/animation/sub-attaq/CMakeLists.txt | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) (limited to 'examples/widgets/animation') diff --git a/examples/widgets/animation/animatedtiles/CMakeLists.txt b/examples/widgets/animation/animatedtiles/CMakeLists.txt index e3fa88aebb..ea48cf56a3 100644 --- a/examples/widgets/animation/animatedtiles/CMakeLists.txt +++ b/examples/widgets/animation/animatedtiles/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_qt_gui_executable(animatedtiles WIN32 MACOSX_BUNDLE +add_qt_gui_executable(animatedtiles animatedtiles.qrc main.cpp ) @@ -24,4 +24,5 @@ target_link_libraries(animatedtiles PUBLIC install(TARGETS animatedtiles RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) diff --git a/examples/widgets/animation/easing/CMakeLists.txt b/examples/widgets/animation/easing/CMakeLists.txt index 441b27b0c4..840e4e59ab 100644 --- a/examples/widgets/animation/easing/CMakeLists.txt +++ b/examples/widgets/animation/easing/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_qt_gui_executable(easing WIN32 MACOSX_BUNDLE +add_qt_gui_executable(easing animation.h easing.qrc form.ui @@ -27,4 +27,5 @@ target_link_libraries(easing PUBLIC install(TARGETS easing RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) diff --git a/examples/widgets/animation/moveblocks/CMakeLists.txt b/examples/widgets/animation/moveblocks/CMakeLists.txt index 971bf2e7e5..6f8aa9ceff 100644 --- a/examples/widgets/animation/moveblocks/CMakeLists.txt +++ b/examples/widgets/animation/moveblocks/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_qt_gui_executable(moveblocks WIN32 MACOSX_BUNDLE +add_qt_gui_executable(moveblocks main.cpp ) target_link_libraries(moveblocks PUBLIC @@ -23,4 +23,5 @@ target_link_libraries(moveblocks PUBLIC install(TARGETS moveblocks RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) diff --git a/examples/widgets/animation/states/CMakeLists.txt b/examples/widgets/animation/states/CMakeLists.txt index bd353422d2..5974f28de8 100644 --- a/examples/widgets/animation/states/CMakeLists.txt +++ b/examples/widgets/animation/states/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_qt_gui_executable(states WIN32 MACOSX_BUNDLE +add_qt_gui_executable(states main.cpp states.qrc ) @@ -24,4 +24,5 @@ target_link_libraries(states PUBLIC install(TARGETS states RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) diff --git a/examples/widgets/animation/stickman/CMakeLists.txt b/examples/widgets/animation/stickman/CMakeLists.txt index 90bc09e5d7..62a35ed796 100644 --- a/examples/widgets/animation/stickman/CMakeLists.txt +++ b/examples/widgets/animation/stickman/CMakeLists.txt @@ -13,7 +13,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) -add_qt_gui_executable(stickman WIN32 MACOSX_BUNDLE +add_qt_gui_executable(stickman animation.cpp animation.h graphicsview.cpp graphicsview.h lifecycle.cpp lifecycle.h @@ -29,4 +29,5 @@ target_link_libraries(stickman PUBLIC install(TARGETS stickman RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) diff --git a/examples/widgets/animation/sub-attaq/CMakeLists.txt b/examples/widgets/animation/sub-attaq/CMakeLists.txt index 883c1cd0c5..969a24c1da 100644 --- a/examples/widgets/animation/sub-attaq/CMakeLists.txt +++ b/examples/widgets/animation/sub-attaq/CMakeLists.txt @@ -14,7 +14,7 @@ set(INSTALL_EXAMPLEDIR "examples") find_package(Qt5 COMPONENTS Widgets) find_package(Qt5 COMPONENTS OpenGL) # special case -add_qt_gui_executable(sub-attaq WIN32 MACOSX_BUNDLE +add_qt_gui_executable(sub-attaq animationmanager.cpp animationmanager.h boat.cpp boat.h boat_p.h bomb.cpp bomb.h @@ -40,4 +40,5 @@ endif() install(TARGETS sub-attaq RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) -- cgit v1.2.3