aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-08-23 18:26:06 +1000
committerCraig Scott <craig.scott@qt.io>2021-08-25 10:44:41 +1000
commit5cdec4e0c7b0d292c4d099189dd27c19eb314f2d (patch)
treec80c25cb9b5c40fbb39fe4aea88636085987108f /examples
parent58127aa35945dc76bd71b69b25d141025267f4c8 (diff)
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 <alexandru.croitor@qt.io> (cherry picked from commit a86fd709dd4d315cfe4fea77ea0bc730131fe840) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/customitems/maskedmousearea/CMakeLists.txt32
-rw-r--r--examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt25
-rw-r--r--examples/quick/quickwidgets/quickwidget/CMakeLists.txt29
-rw-r--r--examples/quick/scenegraph/.prev_CMakeLists.txt22
-rw-r--r--examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt60
-rw-r--r--examples/quick/scenegraph/customgeometry/CMakeLists.txt24
-rw-r--r--examples/quick/scenegraph/custommaterial/.prev_CMakeLists.txt64
-rw-r--r--examples/quick/scenegraph/custommaterial/CMakeLists.txt30
-rw-r--r--examples/quick/scenegraph/d3d11underqml/CMakeLists.txt30
-rw-r--r--examples/quick/scenegraph/fboitem/CMakeLists.txt26
-rw-r--r--examples/quick/scenegraph/graph/CMakeLists.txt37
-rw-r--r--examples/quick/scenegraph/metaltextureimport/CMakeLists.txt37
-rw-r--r--examples/quick/scenegraph/metalunderqml/CMakeLists.txt34
-rw-r--r--examples/quick/scenegraph/openglunderqml/CMakeLists.txt27
-rw-r--r--examples/quick/scenegraph/threadedanimation/CMakeLists.txt26
-rw-r--r--examples/quick/scenegraph/twotextureproviders/CMakeLists.txt32
-rw-r--r--examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt33
-rw-r--r--examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt33
-rw-r--r--examples/quick/tableview/gameoflife/CMakeLists.txt25
-rw-r--r--examples/quick/tableview/pixelator/CMakeLists.txt25
20 files changed, 166 insertions, 485 deletions
diff --git a/examples/quick/customitems/maskedmousearea/CMakeLists.txt b/examples/quick/customitems/maskedmousearea/CMakeLists.txt
index 531a9009fc..afe52f0a9d 100644
--- a/examples/quick/customitems/maskedmousearea/CMakeLists.txt
+++ b/examples/quick/customitems/maskedmousearea/CMakeLists.txt
@@ -35,20 +35,17 @@ target_link_libraries(maskedmousearea PUBLIC
Qt::Quick
)
-
-# Resources:
-set(maskedmousearea_resource_files
- "images/cloud_1.png"
- "images/cloud_2.png"
- "images/moon.png"
- "maskedmousearea.qml"
-)
-
-qt6_add_resources(maskedmousearea "maskedmousearea"
- PREFIX
- "/customitems/maskedmousearea"
- FILES
- ${maskedmousearea_resource_files}
+qt_add_qml_module(maskedmousearea
+ URI Example
+ VERSION 1.0
+ QML_FILES
+ maskedmousearea.qml
+ RESOURCES
+ images/cloud_1.png
+ images/cloud_2.png
+ images/moon.png
+ RESOURCE_PREFIX /customitems/maskedmousearea
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS maskedmousearea
@@ -56,10 +53,3 @@ install(TARGETS maskedmousearea
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(maskedmousearea PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI Example
-)
-
-qt6_qml_type_registration(maskedmousearea)
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt b/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt
index 3767c80e57..e0354cf56c 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt
+++ b/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt
@@ -39,28 +39,15 @@ target_link_libraries(qquickviewcomparison PUBLIC
Qt::Widgets
)
-
-# Resources:
-set(qquickviewcomparison_resource_files
- "test.qml"
-)
-
-qt6_add_resources(qquickviewcomparison "qquickviewcomparison"
- PREFIX
- "/qquickviewcomparison"
- FILES
- ${qquickviewcomparison_resource_files}
+qt_add_qml_module(qquickviewcomparison
+ URI fbitem
+ VERSION 1.0
+ QML_FILES test.qml
+ RESOURCE_PREFIX /qquickviewcomparison
+ NO_RESOURCE_TARGET_PATH
)
-
install(TARGETS qquickviewcomparison
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(qquickviewcomparison PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI fbitem
-)
-
-qt6_qml_type_registration(qquickviewcomparison)
diff --git a/examples/quick/quickwidgets/quickwidget/CMakeLists.txt b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt
index fabc141f3e..5aeeb70505 100644
--- a/examples/quick/quickwidgets/quickwidget/CMakeLists.txt
+++ b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt
@@ -37,19 +37,15 @@ target_link_libraries(quickwidget PUBLIC
Qt::Widgets
)
-
-# Resources:
-set(quickwidget_resource_files
- "customgl.qml"
- "rotatingsquare.qml"
- "rotatingsquaretab.qml"
-)
-
-qt6_add_resources(quickwidget "quickwidget"
- PREFIX
- "/quickwidget"
- FILES
- ${quickwidget_resource_files}
+qt_add_qml_module(quickwidget
+ URI QuickWidgetExample
+ VERSION 1.0
+ QML_FILES
+ customgl.qml
+ rotatingsquare.qml
+ rotatingsquaretab.qml
+ RESOURCE_PREFIX /quickwidget
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS quickwidget
@@ -57,10 +53,3 @@ install(TARGETS quickwidget
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(quickwidget PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI QuickWidgetExample
-)
-
-qt6_qml_type_registration(quickwidget)
diff --git a/examples/quick/scenegraph/.prev_CMakeLists.txt b/examples/quick/scenegraph/.prev_CMakeLists.txt
deleted file mode 100644
index a0619410b0..0000000000
--- a/examples/quick/scenegraph/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated from scenegraph.pro.
-
-add_subdirectory(customgeometry)
-add_subdirectory(custommaterial)
-add_subdirectory(graph)
-add_subdirectory(threadedanimation)
-add_subdirectory(twotextureproviders)
-if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3)
- add_subdirectory(fboitem)
- add_subdirectory(openglunderqml)
-endif()
-if(IOS OR MACOS)
- add_subdirectory(metalunderqml)
- add_subdirectory(metaltextureimport)
-endif()
-if(WIN32)
- add_subdirectory(d3d11underqml)
-endif()
-if(QT_FEATURE_vulkan)
- add_subdirectory(vulkanunderqml)
- add_subdirectory(vulkantextureimport)
-endif()
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
diff --git a/examples/quick/scenegraph/custommaterial/.prev_CMakeLists.txt b/examples/quick/scenegraph/custommaterial/.prev_CMakeLists.txt
deleted file mode 100644
index 6acf1a858b..0000000000
--- a/examples/quick/scenegraph/custommaterial/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-# Generated from custommaterial.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(custommaterial 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/custommaterial")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-
-qt_add_executable(custommaterial
- customitem.cpp customitem.h
- main.cpp
-)
-set_target_properties(custommaterial PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(custommaterial PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-
-# Resources:
-set(custommaterial_resource_files
- "main.qml"
- "shaders/mandelbrot.frag.qsb"
- "shaders/mandelbrot.vert.qsb"
-)
-
-qt6_add_resources(custommaterial "custommaterial"
- PREFIX
- "/scenegraph/custommaterial"
- FILES
- ${custommaterial_resource_files}
-)
-
-install(TARGETS custommaterial
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
-
-set_target_properties(custommaterial PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI ExampleCustomMaterial
-)
-
-qt6_qml_type_registration(custommaterial)
diff --git a/examples/quick/scenegraph/custommaterial/CMakeLists.txt b/examples/quick/scenegraph/custommaterial/CMakeLists.txt
index 06d9dd325f..d372b28bc9 100644
--- a/examples/quick/scenegraph/custommaterial/CMakeLists.txt
+++ b/examples/quick/scenegraph/custommaterial/CMakeLists.txt
@@ -35,19 +35,16 @@ target_link_libraries(custommaterial_declarative PUBLIC # special case
Qt::Quick
)
-
-# Resources:
-set(custommaterial_resource_files
- "main.qml"
- "shaders/mandelbrot.frag.qsb"
- "shaders/mandelbrot.vert.qsb"
-)
-
-qt6_add_resources(custommaterial_declarative "custommaterial" # special case
- PREFIX
- "/scenegraph/custommaterial"
- FILES
- ${custommaterial_resource_files}
+qt_add_qml_module(custommaterial_declarative
+ URI ExampleCustomMaterial
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ shaders/mandelbrot.frag.qsb
+ shaders/mandelbrot.vert.qsb
+ RESOURCE_PREFIX /scenegraph/custommaterial
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS custommaterial_declarative # special case
@@ -55,10 +52,3 @@ install(TARGETS custommaterial_declarative # special case
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(custommaterial_declarative PROPERTIES # special case
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI ExampleCustomMaterial
-)
-
-qt6_qml_type_registration(custommaterial_declarative) # special case
diff --git a/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt b/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt
index fd9e78a738..74e077a7a5 100644
--- a/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt
+++ b/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt
@@ -37,19 +37,16 @@ target_link_libraries(d3d11underqml PUBLIC
d3dcompiler
)
-
-# Resources:
-set(d3d11underqml_resource_files
- "main.qml"
- "squircle.frag"
- "squircle.vert"
-)
-
-qt6_add_resources(d3d11underqml "d3d11underqml"
- PREFIX
- "/scenegraph/d3d11underqml"
- FILES
- ${d3d11underqml_resource_files}
+qt_add_qml_module(d3d11underqml
+ URI D3D11UnderQML
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ squircle.frag
+ squircle.vert
+ RESOURCE_PREFIX /scenegraph/d3d11underqml
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS d3d11underqml
@@ -57,10 +54,3 @@ install(TARGETS d3d11underqml
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(d3d11underqml PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI D3D11UnderQML
-)
-
-qt6_qml_type_registration(d3d11underqml)
diff --git a/examples/quick/scenegraph/fboitem/CMakeLists.txt b/examples/quick/scenegraph/fboitem/CMakeLists.txt
index 88d75a4c8d..45c939b0d8 100644
--- a/examples/quick/scenegraph/fboitem/CMakeLists.txt
+++ b/examples/quick/scenegraph/fboitem/CMakeLists.txt
@@ -40,18 +40,13 @@ target_link_libraries(fboitem PUBLIC
Qt::Quick
)
-
-# Resources:
-set(fboitem_resource_files
- "main.qml"
- "shaders/checker.frag.qsb"
-)
-
-qt6_add_resources(fboitem "fboitem"
- PREFIX
- "/scenegraph/fboitem"
- FILES
- ${fboitem_resource_files}
+qt_add_qml_module(fboitem
+ URI SceneGraphRendering
+ VERSION 1.0
+ QML_FILES main.qml
+ RESOURCES shaders/checker.frag.qsb
+ RESOURCE_PREFIX /scenegraph/fboitem
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS fboitem
@@ -59,10 +54,3 @@ install(TARGETS fboitem
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(fboitem PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI SceneGraphRendering
-)
-
-qt6_qml_type_registration(fboitem)
diff --git a/examples/quick/scenegraph/graph/CMakeLists.txt b/examples/quick/scenegraph/graph/CMakeLists.txt
index ebabcd6622..93d0e6d61a 100644
--- a/examples/quick/scenegraph/graph/CMakeLists.txt
+++ b/examples/quick/scenegraph/graph/CMakeLists.txt
@@ -29,6 +29,9 @@ qt_add_executable(graph
set_target_properties(graph PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
+
+ # Prevent name clash with build subdirectory on case-insensitive file systems
+ OUTPUT_NAME graphapp
)
target_link_libraries(graph PUBLIC
Qt::Core
@@ -36,21 +39,18 @@ target_link_libraries(graph PUBLIC
Qt::Quick
)
-
-# Resources:
-set(graph_resource_files
- "main.qml"
- "shaders/line.frag.qsb"
- "shaders/line.vert.qsb"
- "shaders/noisy.frag.qsb"
- "shaders/noisy.vert.qsb"
-)
-
-qt6_add_resources(graph "graph"
- PREFIX
- "/scenegraph/graph"
- FILES
- ${graph_resource_files}
+qt_add_qml_module(graph
+ URI Graph
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ shaders/line.frag.qsb
+ shaders/line.vert.qsb
+ shaders/noisy.frag.qsb
+ shaders/noisy.vert.qsb
+ RESOURCE_PREFIX /scenegraph/graph
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS graph
@@ -58,10 +58,3 @@ install(TARGETS graph
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(graph PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI Graph
-)
-
-qt6_qml_type_registration(graph)
diff --git a/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt b/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt
index 6bcad68e6e..eb3740f6ef 100644
--- a/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt
+++ b/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt
@@ -27,6 +27,9 @@ qt_add_executable(metaltextureimport
set_target_properties(metaltextureimport PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
+
+ # Prevent name clash with build subdirectory on case-insensitive file systems
+ OUTPUT_NAME metaltextureimportapp
)
target_link_libraries(metaltextureimport PUBLIC
"-framework Metal"
@@ -36,36 +39,26 @@ target_link_libraries(metaltextureimport PUBLIC
Qt::Quick
)
-
-# Resources:
-set(metaltextureimport_resource_files
- "main.qml"
- "squircle.frag"
- "squircle.vert"
-)
-
-qt6_add_resources(metaltextureimport "metaltextureimport"
- PREFIX
- "/scenegraph/metaltextureimport"
- FILES
- ${metaltextureimport_resource_files}
-)
-
if(MACOS)
target_link_libraries(metaltextureimport PUBLIC
"-framework AppKit"
)
endif()
+qt_add_qml_module(metaltextureimport
+ URI MetalTextureImport
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ squircle.frag
+ squircle.vert
+ RESOURCE_PREFIX /scenegraph/metaltextureimport
+ NO_RESOURCE_TARGET_PATH
+)
+
install(TARGETS metaltextureimport
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(metaltextureimport PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI MetalTextureImport
-)
-
-qt6_qml_type_registration(metaltextureimport)
diff --git a/examples/quick/scenegraph/metalunderqml/CMakeLists.txt b/examples/quick/scenegraph/metalunderqml/CMakeLists.txt
index 6c605be0fe..752a5aa578 100644
--- a/examples/quick/scenegraph/metalunderqml/CMakeLists.txt
+++ b/examples/quick/scenegraph/metalunderqml/CMakeLists.txt
@@ -36,36 +36,26 @@ target_link_libraries(metalunderqml PUBLIC
Qt::Quick
)
-
-# Resources:
-set(metalunderqml_resource_files
- "main.qml"
- "squircle.frag"
- "squircle.vert"
-)
-
-qt6_add_resources(metalunderqml "metalunderqml"
- PREFIX
- "/scenegraph/metalunderqml"
- FILES
- ${metalunderqml_resource_files}
-)
-
if(MACOS)
target_link_libraries(metalunderqml PUBLIC
"-framework AppKit"
)
endif()
+qt_add_qml_module(metalunderqml
+ URI MetalUnderQML
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ squircle.frag
+ squircle.vert
+ RESOURCE_PREFIX /scenegraph/metalunderqml
+ NO_RESOURCE_TARGET_PATH
+ )
+
install(TARGETS metalunderqml
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(metalunderqml PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI MetalUnderQML
-)
-
-qt6_qml_type_registration(metalunderqml)
diff --git a/examples/quick/scenegraph/openglunderqml/CMakeLists.txt b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt
index cc228289d7..a99c5d84d1 100644
--- a/examples/quick/scenegraph/openglunderqml/CMakeLists.txt
+++ b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt
@@ -27,6 +27,9 @@ qt_add_executable(openglunderqml
set_target_properties(openglunderqml PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
+
+ # Prevent name clash with build subdirectory on case-insensitive file systems
+ OUTPUT_NAME openglunderqmlapp
)
target_link_libraries(openglunderqml PUBLIC
Qt::Core
@@ -35,17 +38,12 @@ target_link_libraries(openglunderqml PUBLIC
Qt::Quick
)
-
-# Resources:
-set(openglunderqml_resource_files
- "main.qml"
-)
-
-qt6_add_resources(openglunderqml "openglunderqml"
- PREFIX
- "/scenegraph/openglunderqml"
- FILES
- ${openglunderqml_resource_files}
+qt_add_qml_module(openglunderqml
+ URI OpenGLUnderQML
+ VERSION 1.0
+ QML_FILES main.qml
+ RESOURCE_PREFIX /scenegraph/openglunderqml
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS openglunderqml
@@ -53,10 +51,3 @@ install(TARGETS openglunderqml
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(openglunderqml PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI OpenGLUnderQML
-)
-
-qt6_qml_type_registration(openglunderqml)
diff --git a/examples/quick/scenegraph/threadedanimation/CMakeLists.txt b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt
index 73ab94384d..328b41bc9e 100644
--- a/examples/quick/scenegraph/threadedanimation/CMakeLists.txt
+++ b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt
@@ -35,18 +35,13 @@ target_link_libraries(threadedanimation PUBLIC
Qt::Quick
)
-
-# Resources:
-set(threadedanimation_resource_files
- "main.qml"
- "spinner.png"
-)
-
-qt6_add_resources(threadedanimation "threadedanimation"
- PREFIX
- "/scenegraph/threadedanimation"
- FILES
- ${threadedanimation_resource_files}
+qt_add_qml_module(threadedanimation
+ URI Spinner
+ VERSION 1.0
+ QML_FILES main.qml
+ RESOURCES spinner.png
+ RESOURCE_PREFIX /scenegraph/threadedanimation
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS threadedanimation
@@ -54,10 +49,3 @@ install(TARGETS threadedanimation
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(threadedanimation PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI Spinner
-)
-
-qt6_qml_type_registration(threadedanimation)
diff --git a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt
index d8d76f3e07..9520e29d8b 100644
--- a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt
+++ b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt
@@ -35,20 +35,17 @@ target_link_libraries(twotextureproviders PUBLIC
Qt::Quick
)
-
-# Resources:
-set(twotextureproviders_resource_files
- "main.qml"
- "shaders/checker.frag.qsb"
- "shaders/xorblender.frag.qsb"
- "shaders/xorblender.vert.qsb"
-)
-
-qt6_add_resources(twotextureproviders "twotextureproviders"
- PREFIX
- "/scenegraph/twotextureproviders"
- FILES
- ${twotextureproviders_resource_files}
+qt_add_qml_module(twotextureproviders
+ URI SceneGraphRendering
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ shaders/checker.frag.qsb
+ shaders/xorblender.frag.qsb
+ shaders/xorblender.vert.qsb
+ RESOURCE_PREFIX /scenegraph/twotextureproviders
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS twotextureproviders
@@ -56,10 +53,3 @@ install(TARGETS twotextureproviders
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(twotextureproviders PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI SceneGraphRendering
-)
-
-qt6_qml_type_registration(twotextureproviders)
diff --git a/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt b/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt
index 1b799bb1e8..5f58bd78c3 100644
--- a/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt
+++ b/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt
@@ -27,6 +27,9 @@ qt_add_executable(vulkantextureimport
set_target_properties(vulkantextureimport PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
+
+ # Prevent name clash with build subdirectory on case-insensitive file systems
+ OUTPUT_NAME vulkantextureimportapp
)
target_link_libraries(vulkantextureimport PUBLIC
Qt::Core
@@ -35,19 +38,16 @@ target_link_libraries(vulkantextureimport PUBLIC
Qt::Quick
)
-
-# Resources:
-set(vulkantextureimport_resource_files
- "main.qml"
- "squircle.frag.spv"
- "squircle.vert.spv"
-)
-
-qt6_add_resources(vulkantextureimport "vulkantextureimport"
- PREFIX
- "/scenegraph/vulkantextureimport"
- FILES
- ${vulkantextureimport_resource_files}
+qt_add_qml_module(vulkantextureimport
+ URI VulkanTextureImport
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ squircle.frag.spv
+ squircle.vert.spv
+ RESOURCE_PREFIX /scenegraph/vulkantextureimport
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS vulkantextureimport
@@ -55,10 +55,3 @@ install(TARGETS vulkantextureimport
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(vulkantextureimport PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI VulkanTextureImport
-)
-
-qt6_qml_type_registration(vulkantextureimport)
diff --git a/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt
index 24cf8dd6c3..6921427d1b 100644
--- a/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt
+++ b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt
@@ -27,6 +27,9 @@ qt_add_executable(vulkanunderqml
set_target_properties(vulkanunderqml PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
+
+ # Prevent name clash with build subdirectory on case-insensitive file systems
+ OUTPUT_NAME vulkanunderqmlapp
)
target_link_libraries(vulkanunderqml PUBLIC
Qt::Core
@@ -35,19 +38,16 @@ target_link_libraries(vulkanunderqml PUBLIC
Qt::Quick
)
-
-# Resources:
-set(vulkanunderqml_resource_files
- "main.qml"
- "squircle.frag.spv"
- "squircle.vert.spv"
-)
-
-qt6_add_resources(vulkanunderqml "vulkanunderqml"
- PREFIX
- "/scenegraph/vulkanunderqml"
- FILES
- ${vulkanunderqml_resource_files}
+qt_add_qml_module(vulkanunderqml
+ URI VulkanUnderQML
+ VERSION 1.0
+ QML_FILES
+ main.qml
+ RESOURCES
+ squircle.frag.spv
+ squircle.vert.spv
+ RESOURCE_PREFIX /scenegraph/vulkanunderqml
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS vulkanunderqml
@@ -55,10 +55,3 @@ install(TARGETS vulkanunderqml
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(vulkanunderqml PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI VulkanUnderQML
-)
-
-qt6_qml_type_registration(vulkanunderqml)
diff --git a/examples/quick/tableview/gameoflife/CMakeLists.txt b/examples/quick/tableview/gameoflife/CMakeLists.txt
index a5faa08470..f47c27a7ce 100644
--- a/examples/quick/tableview/gameoflife/CMakeLists.txt
+++ b/examples/quick/tableview/gameoflife/CMakeLists.txt
@@ -35,18 +35,12 @@ target_link_libraries(gameoflife PUBLIC
Qt::Quick
)
-
-# Resources:
-set(qmake_immediate_resource_files
- "gosperglidergun.cells"
- "main.qml"
-)
-
-qt6_add_resources(gameoflife "qmake_immediate"
- PREFIX
- "/"
- FILES
- ${qmake_immediate_resource_files}
+qt_add_qml_module(gameoflife
+ URI GameOfLifeModel
+ VERSION 1.0
+ QML_FILES main.qml
+ RESOURCES gosperglidergun.cells
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS gameoflife
@@ -54,10 +48,3 @@ install(TARGETS gameoflife
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(gameoflife PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI GameOfLifeModel
-)
-
-qt6_qml_type_registration(gameoflife)
diff --git a/examples/quick/tableview/pixelator/CMakeLists.txt b/examples/quick/tableview/pixelator/CMakeLists.txt
index fcd9784913..4db28964df 100644
--- a/examples/quick/tableview/pixelator/CMakeLists.txt
+++ b/examples/quick/tableview/pixelator/CMakeLists.txt
@@ -35,18 +35,12 @@ target_link_libraries(qml_pixelator PUBLIC
Qt::Quick
)
-
-# Resources:
-set(qmake_immediate_resource_files
- "main.qml"
- "qt.png"
-)
-
-qt6_add_resources(qml_pixelator "qmake_immediate"
- PREFIX
- "/"
- FILES
- ${qmake_immediate_resource_files}
+qt_add_qml_module(qml_pixelator
+ URI ImageModel
+ VERSION 1.0
+ QML_FILES main.qml
+ RESOURCES qt.png
+ NO_RESOURCE_TARGET_PATH
)
install(TARGETS qml_pixelator
@@ -54,10 +48,3 @@ install(TARGETS qml_pixelator
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
-
-set_target_properties(qml_pixelator PROPERTIES
- QT_QML_MODULE_VERSION 1.0
- QT_QML_MODULE_URI ImageModel
-)
-
-qt6_qml_type_registration(qml_pixelator)