diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-08-23 14:39:09 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-08-24 13:51:52 +0200 |
commit | 266b93c9f8e7054ec572e47a8c48752381851231 (patch) | |
tree | df7a28aa6b8807253a509e3212fef2d39b2fa46a /examples/quick/scenegraph/custommaterial | |
parent | c7093e553c46bbd65a053a335bd27bec8ee5aca2 (diff) |
Use add_shaders with CMake in some examples
Take the most obvious candidates, to which users typically turn
when getting started with ShaderEffect or QSGMaterial:
shadereffects
scenegraph/custommaterial
scenegraph/twotextureproviders
As with the parent patch that ports and updates embeddedinwidgets and
quickwidget/qquickviewcomparison to use the proper CMake machinery, we
still need to keep the .qsb files for the sake of qmake. compile.bat and
similar scripts are however removed now. With CMake the .qsb files are
not needed and are autogenerated at build time. Once qmake support
disappears from the examples, the .qsb files can be removed as well.
Pick-to: 6.2
Change-Id: I879354eef2e2179dcd268c9ae9f1402e1eaef379
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/quick/scenegraph/custommaterial')
-rw-r--r-- | examples/quick/scenegraph/custommaterial/CMakeLists.txt | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/examples/quick/scenegraph/custommaterial/CMakeLists.txt b/examples/quick/scenegraph/custommaterial/CMakeLists.txt index d372b28bc9..21951727f9 100644 --- a/examples/quick/scenegraph/custommaterial/CMakeLists.txt +++ b/examples/quick/scenegraph/custommaterial/CMakeLists.txt @@ -19,6 +19,7 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Qml) find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS ShaderTools) qt_add_executable(custommaterial_declarative # special case customitem.cpp customitem.h @@ -40,13 +41,21 @@ qt_add_qml_module(custommaterial_declarative VERSION 1.0 QML_FILES main.qml - RESOURCES - shaders/mandelbrot.frag.qsb - shaders/mandelbrot.vert.qsb RESOURCE_PREFIX /scenegraph/custommaterial NO_RESOURCE_TARGET_PATH ) +qt6_add_shaders(custommaterial_declarative "shaders" + BATCHABLE + PRECOMPILE + OPTIMIZED + PREFIX + "/scenegraph/custommaterial/shaders" + FILES + "shaders/mandelbrot.vert" + "shaders/mandelbrot.frag" +) + install(TARGETS custommaterial_declarative # special case RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" |