C

Qt Quick Ultralite sprite_animations Example

cmake_minimum_required (VERSION 3.21.1)

project(sprite_animations VERSION 0.0.1 LANGUAGES C CXX ASM)
if (NOT TARGET Qul::Core)
    find_package(Qul)
endif()

if(CMAKE_CROSSCOMPILING AND QUL_PLATFORM MATCHES "^stm32[fh]7")
    # STM32F7/STM32H7 boards use JPEG decoder
    qul_add_target(sprite_animations
        QML_PROJECT mcu_sprite_animations_jpeg.qmlproject
        os/${QUL_OS_LOWERCASE}/main.cpp
    )

    if(QUL_PLATFORM MATCHES "^stm32f7")
        set(STM32XX "stm32f7")

        target_sources(sprite_animations PRIVATE
            ${QUL_BOARD_SDK_DIR}/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_jpeg.c
            ../imagedecoder/stm/${STM32XX}/stm32f7xx_hal_msp.c
        )
    elseif(QUL_PLATFORM MATCHES "^stm32h7")
        set(STM32XX "stm32h7")

        target_sources(sprite_animations PRIVATE
            ${QUL_BOARD_SDK_DIR}/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_jpeg.c
            ../imagedecoder/stm/${STM32XX}/stm32h7xx_hal_msp.c
        )
    endif()

    target_sources(sprite_animations PRIVATE
        ../imagedecoder/stm/${STM32XX}/board_config.cpp
        ../imagedecoder/stm/${STM32XX}/buffer_config.cpp
        ../imagedecoder/stm/stmimagedecoder.cpp
        ../imagedecoder/common/jpeg.cpp
        ../imagedecoder/3rdparty/stm/Utilities/JPEG/jpeg_utils.c
    )

    target_include_directories(sprite_animations PRIVATE
        ${QUL_BOARD_SDK_DIR}/Utilities/JPEG
        ../imagedecoder/stm/${STM32XX}
        ../imagedecoder/stm
        ../imagedecoder
    )

    target_compile_definitions(sprite_animations PRIVATE
        USE_JPEG_DECODER=1
        PLATFORM_OS=${QUL_OS_LOWERCASE}
        USE_DMA_BASED_JPEG_DECODING
    )

    target_link_libraries(sprite_animations PRIVATE Qul::PlatformBSPConfig)

    if(NOT IAR)
        # Required for SDK code to build
        target_compile_options(sprite_animations PRIVATE
            -Wno-unused-parameter
        )
    endif()
else()
    qul_add_target(sprite_animations
        QML_PROJECT mcu_sprite_animations.qmlproject
        GENERATE_ENTRYPOINT
    )
endif()

app_target_setup_os(sprite_animations)