| 1 |
# Copyright (C) 2022 The Qt Company Ltd. |
| 2 |
# SPDX-License-Identifier: BSD-3-Clause |
| 3 |
|
| 4 |
cmake_minimum_required(VERSION 3.16) |
| 5 |
project(advancedcustommaterial LANGUAGES CXX) |
| 6 |
|
| 7 |
set(CMAKE_AUTOMOC ON) |
| 8 |
|
| 9 |
find_package(Qt6 REQUIRED COMPONENTS 3DRender Core Gui Qml Quick) |
| 10 |
|
| 11 |
qt_add_executable(advancedcustommaterial |
| 12 |
main.cpp |
| 13 |
) |
| 14 |
|
| 15 |
set_target_properties(advancedcustommaterial PROPERTIES |
| 16 |
WIN32_EXECUTABLE TRUE |
| 17 |
MACOSX_BUNDLE TRUE |
| 18 |
) |
| 19 |
|
| 20 |
target_link_libraries(advancedcustommaterial PUBLIC |
| 21 |
Qt::3DRender |
| 22 |
Qt::Core |
| 23 |
Qt::Gui |
| 24 |
Qt::Qml |
| 25 |
Qt::Quick |
| 26 |
) |
| 27 |
|
| 28 |
# Resources: |
| 29 |
set(qml_resource_files |
| 30 |
"SceneRoot.qml" |
| 31 |
"Water.qml" |
| 32 |
"WaterMaterial.qml" |
| 33 |
"main.qml" |
| 34 |
) |
| 35 |
|
| 36 |
qt6_add_resources(advancedcustommaterial "qml" |
| 37 |
PREFIX |
| 38 |
"/" |
| 39 |
FILES |
| 40 |
${qml_resource_files} |
| 41 |
) |
| 42 |
|
| 43 |
target_sources(advancedcustommaterial PRIVATE ${qml_resource_files}) # just to show qml files in creator |
| 44 |
|
| 45 |
set(models_resource_files |
| 46 |
"models/waterPlane.obj" |
| 47 |
) |
| 48 |
|
| 49 |
qt6_add_resources(advancedcustommaterial "models" |
| 50 |
PREFIX |
| 51 |
"/" |
| 52 |
FILES |
| 53 |
${models_resource_files} |
| 54 |
) |
| 55 |
|
| 56 |
set(textures_resource_files |
| 57 |
"textures/WaterDiffuse.jpg" |
| 58 |
"textures/WaterNormal.jpg" |
| 59 |
"textures/WaterSpecular.jpg" |
| 60 |
"textures/Waterwave.jpg" |
| 61 |
"textures/foam.jpg" |
| 62 |
"textures/sky.jpg" |
| 63 |
) |
| 64 |
|
| 65 |
qt6_add_resources(advancedcustommaterial "textures" |
| 66 |
PREFIX |
| 67 |
"/" |
| 68 |
FILES |
| 69 |
${textures_resource_files} |
| 70 |
) |
| 71 |
|
| 72 |
set(shaders_resource_files |
| 73 |
"shaders/es2/water.frag" |
| 74 |
"shaders/es2/water.vert" |
| 75 |
"shaders/gl3/water.frag" |
| 76 |
"shaders/gl3/water.vert" |
| 77 |
"shaders/rhi/water.frag" |
| 78 |
"shaders/rhi/water.vert" |
| 79 |
) |
| 80 |
|
| 81 |
qt6_add_resources(advancedcustommaterial "shaders" |
| 82 |
PREFIX |
| 83 |
"/" |
| 84 |
FILES |
| 85 |
${shaders_resource_files} |
| 86 |
) |