C

Qt Quick Ultralite swipe_game Demo

cmake_minimum_required (VERSION 3.21.1)

project(swipe_game VERSION 0.0.1 LANGUAGES C CXX ASM)

if (NOT TARGET Qul::Core)
    find_package(Qul)
endif()

qul_add_target(swipe_game
    Globals.cpp
    HighscoreModel.cpp)

qul_target_generate_interfaces(swipe_game
    Globals.h
    HighscoreModel.h)

qul_target_qml_sources(swipe_game
    BaseView.qml
    Button.qml
    CircularSwipeArea.qml
    ConfigContainer.qml
    ConfigView.qml
    DirectionalSwipeArea.qml
    GameContainer.qml
    GameOverView.qml
    GameRunningView.qml
    GameStartView.qml
    HighscoreView.qml
    LabeledSwitch.qml
    NumberView.qml
    ScrollIndicator.qml
    StartView.qml
    SwipeGame.qml
    TimeView.qml)

set(STYLE_MODULE_QML_FILES
    style_module/Style.qml)

qul_add_qml_module(style_module
    URI StyleModule
    QML_FILES
        ${STYLE_MODULE_QML_FILES}
    OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/style_module)

qul_add_qml_module(swipe_module
    URI SwipeModule
    QML_FILES
        Swipe.qml
    OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/swipe_module)

set_target_properties(swipe_game PROPERTIES QUL_GLYPH_RESOURCE_CACHE_POLICY "NoCaching")

set(QUL_DEFAULT_RESOURCE_OPTIMIZE_FOR_ROTATION ON)
set(QUL_DEFAULT_RESOURCE_OPTIMIZE_FOR_SCALE ON)
set_source_files_properties(images/mask_circle.svg PROPERTIES QUL_RESOURCE_OPTIMIZE_FOR_ROTATION OFF)
set_source_files_properties(images/mask_circle_highlight.svg PROPERTIES QUL_RESOURCE_OPTIMIZE_FOR_ROTATION OFF)

file(GLOB image_assets "images/*.svg")
qul_add_resource(swipe_game FILES
    ${image_assets} BASE images)

target_link_libraries(swipe_game PRIVATE style_module swipe_module)
app_target_setup_os(swipe_game)
app_target_default_entrypoint(swipe_game SwipeGame)

if (QUL_BUILD_QMLPROJECT_DEMOS)
    qul_add_target(swipe_game_qmlproject
        Globals.cpp
        HighscoreModel.cpp
        QML_PROJECT
        mcu_swipe_game.qmlproject
    )
    app_target_setup_os(swipe_game_qmlproject)
    app_target_default_entrypoint(swipe_game_qmlproject SwipeGame)
endif()