diff options
author | Liang Qi <liang.qi@qt.io> | 2020-01-09 13:15:44 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2020-01-09 16:07:44 +0000 |
commit | 4a00c5bf112ab0d2fd04bd5284ec46c664ac9df5 (patch) | |
tree | 682e2689cc3341fdb2fc9272bb3f28732af5c92c | |
parent | 7fd4b9f58c829a984d9ce37baff0642f512a8b89 (diff) |
Port to CMakewip/cmake
Only tested on macOS.
Fixes: QTBUG-78169
Change-Id: Ic3c19ff8ef56d104c9d1a41acb5efe9dac6c162d
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
-rw-r--r-- | CMakeLists.txt | 19 | ||||
-rw-r--r-- | coin/module_config.yaml | 26 | ||||
-rw-r--r-- | examples/CMakeLists.txt | 9 | ||||
-rw-r--r-- | examples/macextras/CMakeLists.txt | 8 | ||||
-rw-r--r-- | examples/macextras/embeddedqwindow/CMakeLists.txt | 41 | ||||
-rw-r--r-- | examples/macextras/macfunctions/CMakeLists.txt | 50 | ||||
-rw-r--r-- | examples/macextras/macpasteboardmime/CMakeLists.txt | 33 | ||||
-rw-r--r-- | examples/macextras/mactoolbar/CMakeLists.txt | 46 | ||||
-rw-r--r-- | examples/macextras/mactoolbar/rasterwindow.h | 7 | ||||
-rw-r--r-- | src/CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/macextras/CMakeLists.txt | 57 | ||||
-rw-r--r-- | src/macextras/doc/snippets/code/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/auto/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/auto/macfunctions/CMakeLists.txt | 22 | ||||
-rw-r--r-- | tests/manual/mactoolbar/CMakeLists.txt | 29 |
16 files changed, 380 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f98ce3e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,19 @@ +# Generated from qtmacextras.pro. + +cmake_minimum_required(VERSION 3.15.0) + +project(QtMacExtras + VERSION 6.0.0 + DESCRIPTION "Qt MacExtras Libraries" + HOMEPAGE_URL "https://qt.io/" + LANGUAGES CXX C +) + +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Gui) # special case +find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Widgets) # special case + +if(NOT TARGET Qt::Gui) + message(NOTICE "Skipping the build as the condition \"TARGET Qt::Gui\" is not met.") + return() +endif() +qt_build_repo() diff --git a/coin/module_config.yaml b/coin/module_config.yaml new file mode 100644 index 0000000..87735d6 --- /dev/null +++ b/coin/module_config.yaml @@ -0,0 +1,26 @@ +version: 1 +accept_configuration: + condition: property + property: host.os + equals_property: target.os + +build_instructions: + - !include "{{qt/qtbase}}/prepare_building_env.yaml" + - !include "{{qt/qtbase}}/cmake_module_build_instructions.yaml" + - !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml" + +test_instructions: + - type: Group + instructions: + - !include "{{qt/qtbase}}/cmake_regular_test_instructions.yaml" + enable_if: + condition: property + property: host.os + equals_value: MacOS + - type: EnvironmentVariable + variableName: Dummy + variableValue: dummy + disable_if: + condition: property + property: host.os + equals_value: MacOS diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..6f0415d --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,9 @@ +# Generated from examples.pro. + +qt_examples_build_begin() + +if(APPLE) + add_subdirectory(macextras) +endif() + +qt_examples_build_end() diff --git a/examples/macextras/CMakeLists.txt b/examples/macextras/CMakeLists.txt new file mode 100644 index 0000000..03f6bd5 --- /dev/null +++ b/examples/macextras/CMakeLists.txt @@ -0,0 +1,8 @@ +# Generated from macextras.pro. + +add_subdirectory(macfunctions) +if(APPLE_OSX) + add_subdirectory(embeddedqwindow) + # TODO: add_subdirectory(macpasteboardmime) # special case + add_subdirectory(mactoolbar) +endif() diff --git a/examples/macextras/embeddedqwindow/CMakeLists.txt b/examples/macextras/embeddedqwindow/CMakeLists.txt new file mode 100644 index 0000000..fda9f68 --- /dev/null +++ b/examples/macextras/embeddedqwindow/CMakeLists.txt @@ -0,0 +1,41 @@ +# Generated from embeddedqwindow.pro. + +cmake_minimum_required(VERSION 3.14) +project(embeddedqwindow LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/macextras/embeddedqwindow") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Widgets) +find_package(Qt6 COMPONENTS MacExtras) + +add_qt_gui_executable(embeddedqwindow + main.mm + window.cpp window.h +) +target_link_libraries(embeddedqwindow PRIVATE + Qt::CorePrivate + Qt::GuiPrivate + Qt::WidgetsPrivate +) + +target_link_libraries(embeddedqwindow PUBLIC + "-framework Cocoa" + Qt::Core + Qt::Gui + Qt::MacExtras + Qt::Widgets +) + +install(TARGETS embeddedqwindow + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/macextras/macfunctions/CMakeLists.txt b/examples/macextras/macfunctions/CMakeLists.txt new file mode 100644 index 0000000..d3d6e28 --- /dev/null +++ b/examples/macextras/macfunctions/CMakeLists.txt @@ -0,0 +1,50 @@ +# Generated from macfunctions.pro. + +cmake_minimum_required(VERSION 3.14) +project(macfunctions LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/macextras/macfunctions") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Widgets) +find_package(Qt6 COMPONENTS MacExtras) + +add_qt_gui_executable(macfunctions + main.cpp +) +target_include_directories(macfunctions PUBLIC + . +) + +target_link_libraries(macfunctions PUBLIC + Qt::Core + Qt::Gui + Qt::MacExtras + Qt::Widgets +) + + +# Resources: +set(macfunctions_resource_files + "qtlogo.png" +) + +qt6_add_resources(macfunctions "macfunctions" + PREFIX + "/" + FILES + ${macfunctions_resource_files} +) + +install(TARGETS macfunctions + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/macextras/macpasteboardmime/CMakeLists.txt b/examples/macextras/macpasteboardmime/CMakeLists.txt new file mode 100644 index 0000000..424cb80 --- /dev/null +++ b/examples/macextras/macpasteboardmime/CMakeLists.txt @@ -0,0 +1,33 @@ +# Generated from macpasteboardmime.pro. + +cmake_minimum_required(VERSION 3.14) +project(macpasteboardmime LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/macextras/macpasteboardmime") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS MacExtras) +find_package(Qt6 COMPONENTS Widgets) + +add_qt_gui_executable(macpasteboardmime + main.cpp +) +target_link_libraries(macpasteboardmime PUBLIC + Qt::Core + Qt::Gui + Qt::MacExtras + Qt::Widgets +) + +install(TARGETS macpasteboardmime + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/macextras/mactoolbar/CMakeLists.txt b/examples/macextras/mactoolbar/CMakeLists.txt new file mode 100644 index 0000000..9054940 --- /dev/null +++ b/examples/macextras/mactoolbar/CMakeLists.txt @@ -0,0 +1,46 @@ +# Generated from mactoolbar.pro. + +cmake_minimum_required(VERSION 3.14) +project(mactoolbar LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/macextras/mactoolbar") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS MacExtras) + +add_qt_gui_executable(mactoolbar + main.cpp + rasterwindow.cpp rasterwindow.h + toolbarcontrollerwindow.cpp toolbarcontrollerwindow.h +) +target_link_libraries(mactoolbar PUBLIC + Qt::Core + Qt::Gui + Qt::MacExtras +) + + +# Resources: +set(mactoolbar_resource_files + "qtlogo.png" +) + +qt6_add_resources(mactoolbar "mactoolbar" + PREFIX + "/" + FILES + ${mactoolbar_resource_files} +) + +install(TARGETS mactoolbar + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/macextras/mactoolbar/rasterwindow.h b/examples/macextras/mactoolbar/rasterwindow.h index 5465344..c65a2b2 100644 --- a/examples/macextras/mactoolbar/rasterwindow.h +++ b/examples/macextras/mactoolbar/rasterwindow.h @@ -48,6 +48,9 @@ ** ****************************************************************************/ +#ifndef RASTERWINDOW_H +#define RASTERWINDOW_H + #include <QtGui> class RasterWindow : public QWindow @@ -66,4 +69,6 @@ protected: private: QBackingStore *m_backingStore; QString m_text; -};
\ No newline at end of file +}; + +#endif // RASTERWINDOW_H diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..96f7e85 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from src.pro. + +# special case skip regeneration +# special case begin +# mac +if (APPLE) + add_subdirectory(macextras) +else() + # TODO: "aux" + # fake project for creating the documentation +endif() +# special case end diff --git a/src/macextras/CMakeLists.txt b/src/macextras/CMakeLists.txt new file mode 100644 index 0000000..a1d38d9 --- /dev/null +++ b/src/macextras/CMakeLists.txt @@ -0,0 +1,57 @@ +# Generated from macextras.pro. + +##################################################################### +## MacExtras Module: +##################################################################### + +qt_add_module(MacExtras + SOURCES + qmacfunctions.h qmacfunctions.mm qmacfunctions_p.h + INCLUDE_DIRECTORIES + ${CMAKE_CURRENT_SOURCE_DIR} + LIBRARIES + ${FWFoundation} + Qt::CorePrivate + Qt::GuiPrivate + PUBLIC_LIBRARIES + Qt::Core + Qt::Gui +) + +## Scopes: +##################################################################### + +qt_extend_target(MacExtras CONDITION APPLE_UIKIT AND NOT APPLE_WATCHOS + SOURCES + qmacfunctions_ios.mm + LIBRARIES + ${FWUIKit} +) + +qt_extend_target(MacExtras CONDITION APPLE_OSX + SOURCES + qmacfunctions_mac.mm + qmactoolbar.mm + qmactoolbardelegate.mm + qmactoolbaritem.mm + qnstoolbar.mm + LIBRARIES + ${FWAppKit} + Qt::Widgets +) + +#### Keys ignored in scope 4:.:.:macextras-lib.pri:APPLE_OSX: +# PRIVATE_HEADERS = "$$PWD/qmactoolbar_p.h" "$$PWD/qmactoolbardelegate_p.h" "$$PWD/qnstoolbar_p.h" +# PUBLIC_HEADERS = "$$PWD/qmactoolbar.h" "$$PWD/qmactoolbaritem.h" + +qt_extend_target(MacExtras CONDITION (APPLE_OSX) AND ((QT_MAJOR_VERSION GREATER 4)) + SOURCES + qmacpasteboardmime.mm +) + +#### Keys ignored in scope 5:.:.:macextras-lib.pri:(QT_MAJOR_VERSION GREATER 4): +# PUBLIC_HEADERS = "$$PWD/qmacpasteboardmime.h" +qt_add_docs(MacExtras + doc/qtmacextras.qdocconf +) + diff --git a/src/macextras/doc/snippets/code/CMakeLists.txt b/src/macextras/doc/snippets/code/CMakeLists.txt new file mode 100644 index 0000000..02591c3 --- /dev/null +++ b/src/macextras/doc/snippets/code/CMakeLists.txt @@ -0,0 +1,12 @@ +# Generated from use-qtmacextras.pro. + +##################################################################### +## use-qtmacextras Binary: +##################################################################### + +qt_add_executable(use-qtmacextras + GUI + PUBLIC_LIBRARIES + Qt::Gui + Qt::MacExtras +) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..2214137 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,7 @@ +# Generated from tests.pro. + +if(QT_BUILD_STANDALONE_TESTS) + # Add qt_find_package calls for extra dependencies that need to be found when building + # the standalone tests here. +endif() +qt_build_tests() diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 0000000..5e6e68a --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,3 @@ +# Generated from auto.pro. + +add_subdirectory(macfunctions) diff --git a/tests/auto/macfunctions/CMakeLists.txt b/tests/auto/macfunctions/CMakeLists.txt new file mode 100644 index 0000000..ee3e560 --- /dev/null +++ b/tests/auto/macfunctions/CMakeLists.txt @@ -0,0 +1,22 @@ +# Generated from macfunctions.pro. + +##################################################################### +## tst_qmacfunctions Test: +##################################################################### + +qt_add_test(tst_qmacfunctions + SOURCES + tst_qmacfunctions.mm + PUBLIC_LIBRARIES + Qt::Gui + Qt::MacExtras + Qt::Widgets +) + +## Scopes: +##################################################################### + +qt_extend_target(tst_qmacfunctions CONDITION APPLE_OSX + PUBLIC_LIBRARIES + ${FWAppKit} +) diff --git a/tests/manual/mactoolbar/CMakeLists.txt b/tests/manual/mactoolbar/CMakeLists.txt new file mode 100644 index 0000000..73c7778 --- /dev/null +++ b/tests/manual/mactoolbar/CMakeLists.txt @@ -0,0 +1,29 @@ +# Generated from mactoolbar.pro. + +##################################################################### +## mactoolbar Binary: +##################################################################### + +qt_add_manual_test(mactoolbar + GUI + SOURCES + main.cpp + toolbarcontrollerwidget.cpp toolbarcontrollerwidget.h + PUBLIC_LIBRARIES + Qt::Gui + Qt::MacExtras + Qt::Widgets +) + +# Resources: +set(mactoolbar_resource_files + "qtlogo.png" +) + +qt_add_resource(mactoolbar "mactoolbar" + PREFIX + "/" + FILES + ${mactoolbar_resource_files} +) + |