From 5cdec4e0c7b0d292c4d099189dd27c19eb314f2d Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Mon, 23 Aug 2021 18:26:06 +1000 Subject: Update quick examples to new QML CMake API This is a pre-requisite to being able to make qt6_qml_type_registration() an internal rather than public command. Not all examples have been updated, only those that were using the qt6_qml_type_registration() command. Task-number: QTBUG-95093 Change-Id: I3f1814a29af608461daa90477eca0aa2304eb9d1 Reviewed-by: Alexandru Croitor (cherry picked from commit a86fd709dd4d315cfe4fea77ea0bc730131fe840) Reviewed-by: Qt Cherry-pick Bot --- .../scenegraph/customgeometry/.prev_CMakeLists.txt | 60 ---------------------- .../quick/scenegraph/customgeometry/CMakeLists.txt | 24 +++------ 2 files changed, 6 insertions(+), 78 deletions(-) delete mode 100644 examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt (limited to 'examples/quick/scenegraph/customgeometry') diff --git a/examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt b/examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt deleted file mode 100644 index 28613e67a3..0000000000 --- a/examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Generated from customgeometry.pro. - -cmake_minimum_required(VERSION 3.14) -project(customgeometry LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/customgeometry") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Quick) - -qt_add_executable(customgeometry - beziercurve.cpp beziercurve.h - main.cpp -) -set_target_properties(customgeometry PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(customgeometry PUBLIC - Qt::Core - Qt::Gui - Qt::Quick -) - - -# Resources: -set(customgeometry_resource_files - "main.qml" -) - -qt6_add_resources(customgeometry "customgeometry" - PREFIX - "/scenegraph/customgeometry" - FILES - ${customgeometry_resource_files} -) - -install(TARGETS customgeometry - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) - -set_target_properties(customgeometry PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI CustomGeometry -) - -qt6_qml_type_registration(customgeometry) diff --git a/examples/quick/scenegraph/customgeometry/CMakeLists.txt b/examples/quick/scenegraph/customgeometry/CMakeLists.txt index c853f9a543..4e3d13d08a 100644 --- a/examples/quick/scenegraph/customgeometry/CMakeLists.txt +++ b/examples/quick/scenegraph/customgeometry/CMakeLists.txt @@ -33,17 +33,12 @@ target_link_libraries(customgeometry_declarative PUBLIC # special case Qt::Quick ) - -# Resources: -set(customgeometry_resource_files - "main.qml" -) - -qt6_add_resources(customgeometry_declarative "customgeometry" # special case - PREFIX - "/scenegraph/customgeometry" - FILES - ${customgeometry_resource_files} +qt_add_qml_module(customgeometry_declarative + URI CustomGeometry + VERSION 1.0 + QML_FILES main.qml + RESOURCE_PREFIX /scenegraph/customgeometry + NO_RESOURCE_TARGET_PATH ) install(TARGETS customgeometry_declarative # special case @@ -51,10 +46,3 @@ install(TARGETS customgeometry_declarative # special case BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(customgeometry_declarative PROPERTIES # special case - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI CustomGeometry -) - -qt6_qml_type_registration(customgeometry_declarative) # special case -- cgit v1.2.3