C

Qt Quick Ultralite perspective_transforms Example

# Copyright (C) 2026 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial
cmake_minimum_required(VERSION 3.21.1)

project(perspective_transforms VERSION 0.0.1 LANGUAGES C CXX ASM)

find_package(QulApp)

# Boards with no room for the on-screen controls leave them out entirely;
# most others use a reduced set. Each choice swaps in one QML override.
set(PT_CONFIGURATION_QML Configuration.qml)
set(PT_CONSTANTS_QML Constants.qml)
if(QUL_PLATFORM MATCHES "^tviic2d" OR QUL_PLATFORM MATCHES "^rh850")
    set(PT_CONFIGURATION_QML +no_controls/Configuration.qml)
elseif(NOT QUL_PLATFORM MATCHES "^stm32f769i" AND NOT QUL_PLATFORM MATCHES "^mimxrt1170-evkb")
    set(PT_CONSTANTS_QML +small_controls/Constants.qml)
endif()

add_subdirectory(Constants)
add_subdirectory(PerspectiveTransformsConfiguration)

if(QUL_PLATFORM MATCHES "autosar")
    qul_add_library(perspective_transforms)
else()
    qul_add_executable(perspective_transforms)
endif()

# CoverFlow.qml builds the source dynamically ("cover" + index + ".jpg"), so the
# covers are referred to by bare filename. Use the QUL_RESOURCE_ALIAS property
# to set the qrc resource alias for the cover images.
foreach(idx RANGE 0 9)
    list(APPEND PT_COVERS resources/cover${idx}.jpg)
    set_source_files_properties(resources/cover${idx}.jpg
      PROPERTIES
          QUL_RESOURCE_OPTIMIZE_FOR_ROTATION ON
          QUL_RESOURCE_ALIAS cover${idx}.jpg
    )
endforeach()

qul_add_qml_module(perspective_transforms
    URI PerspectiveTransformsApp
    QML_FILES
        perspective_transforms.qml
        CoverFlow.qml
        CoverFlowState.qml
        Cover.qml
        IdleTimer.qml
        controls/CheckBox.qml
        controls/RadioButton.qml
        controls/Slider.qml
    RESOURCES ${PT_COVERS}
    NO_SBOM
)

target_link_libraries(perspective_transforms PRIVATE
    Qul::Controls
    perspective_transforms_constants_module
    perspective_transforms_configuration_module
)

app_target_setup_os(perspective_transforms)
app_target_default_entrypoint(perspective_transforms perspective_transforms MODULE PerspectiveTransformsApp)