| 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(qardboard LANGUAGES CXX) |
| 6 |
|
| 7 |
set(CMAKE_AUTOMOC ON) |
| 8 |
|
| 9 |
if(NOT DEFINED INSTALL_EXAMPLESDIR) |
| 10 |
set(INSTALL_EXAMPLESDIR "examples") |
| 11 |
endif() |
| 12 |
|
| 13 |
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}") |
| 14 |
|
| 15 |
find_package(Qt6 REQUIRED COMPONENTS 3DCore 3DExtras 3DInput 3DQuick 3DQuickExtras 3DRender Core Gui Qml Quick) |
| 16 |
|
| 17 |
qt_add_executable(qardboard |
| 18 |
abstractdeviceorientation.cpp abstractdeviceorientation.h |
| 19 |
dummydeviceorientation.cpp dummydeviceorientation.h |
| 20 |
main.cpp |
| 21 |
) |
| 22 |
|
| 23 |
set_target_properties(qardboard PROPERTIES |
| 24 |
WIN32_EXECUTABLE TRUE |
| 25 |
MACOSX_BUNDLE TRUE |
| 26 |
) |
| 27 |
|
| 28 |
target_link_libraries(qardboard PUBLIC |
| 29 |
Qt::3DCore |
| 30 |
Qt::3DExtras |
| 31 |
Qt::3DInput |
| 32 |
Qt::3DQuick |
| 33 |
Qt::3DQuickExtras |
| 34 |
Qt::3DRender |
| 35 |
Qt::Core |
| 36 |
Qt::Gui |
| 37 |
Qt::Qml |
| 38 |
Qt::Quick |
| 39 |
) |
| 40 |
|
| 41 |
# Resources: |
| 42 |
set(resources_resource_files |
| 43 |
"PlacedEntity.qml" |
| 44 |
"QardboardCamera.qml" |
| 45 |
"QardboardFrameGraph.qml" |
| 46 |
"QardboardRootEntity.qml" |
| 47 |
"QardboardScene3D.qml" |
| 48 |
"main.qml" |
| 49 |
) |
| 50 |
|
| 51 |
qt6_add_resources(qardboard "resources" |
| 52 |
PREFIX |
| 53 |
"/" |
| 54 |
FILES |
| 55 |
${resources_resource_files} |
| 56 |
) |
| 57 |
|
| 58 |
set(obj_resource_files |
| 59 |
"../exampleresources/assets/obj/ball.obj" |
| 60 |
"../exampleresources/assets/obj/material-sphere.obj" |
| 61 |
"../exampleresources/assets/obj/plane-10x10.obj" |
| 62 |
"../exampleresources/assets/obj/toyplane.obj" |
| 63 |
"../exampleresources/assets/obj/trefoil.obj" |
| 64 |
) |
| 65 |
|
| 66 |
qt6_add_resources(qardboard "obj" |
| 67 |
PREFIX |
| 68 |
"/" |
| 69 |
BASE |
| 70 |
"../exampleresources" |
| 71 |
FILES |
| 72 |
${obj_resource_files} |
| 73 |
) |
| 74 |
|
| 75 |
if(IOS) |
| 76 |
target_sources(qardboard PUBLIC |
| 77 |
iosdeviceorientation.h iosdeviceorientation.mm iosdeviceorientation_p.h iosdeviceorientation_p.mm |
| 78 |
) |
| 79 |
|
| 80 |
target_link_libraries(qardboard PUBLIC |
| 81 |
Qt::Sensors |
| 82 |
Qt::SensorsPrivate |
| 83 |
) |
| 84 |
endif() |
| 85 |
|
| 86 |
install(TARGETS qardboard |
| 87 |
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" |
| 88 |
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" |
| 89 |
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" |
| 90 |
) |