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(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 ) target_compile_definitions(sprite_animations PRIVATE USE_DMA_BASED_JPEG_DECODING) 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} ) 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() elseif(QUL_PLATFORM MATCHES "tviic2d6m-baremetal") # In CI we test with the 500-BGA variant with graphics driver TVII_GRAPHICS_DRIVER_DIR_1_1_0_4M6M # (infineon-traveo-t2g-cyt4dn-baremetal-500-bga-windows-ghs-arm) # and to be able to build the imagedecoder backend an SDL upgrade is required. if(QUL_TVIIC2D6M_BOARD_REVISION STREQUAL "500-BGA") return() endif() if(NOT TVII_JPEG_DRIVER_DIR) message(FATAL_ERROR "TVII_JPEG_DRIVER_DIR is not set. Reconfigure the example by providing the path to the JPEG decoder SDK root folder.") else() if(IAR) set(TVII_JPEG_DRIVER_SDK_TOOLCHAIN_DIR "iar") else() set(TVII_JPEG_DRIVER_SDK_TOOLCHAIN_DIR "arm-none-ghs") endif() find_library(TVII_JPEG_DRIVER_LIB libjpeg_driver_cm7.a PATHS ${TVII_JPEG_DRIVER_DIR}/Bin/${TVII_JPEG_DRIVER_SDK_TOOLCHAIN_DIR}/production/bin NO_CMAKE_SYSTEM_PATH NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) if(NOT TVII_JPEG_DRIVER_LIB) message(STATUS "TVII_JPEG_DRIVER static library not found: building libjpeg_driver_cm7 from sources.") set(TVII_JPEG_DRIVER_LIB libjpeg_driver_cm7) if(NOT TARGET ${TVII_JPEG_DRIVER_LIB}) add_library(${TVII_JPEG_DRIVER_LIB} STATIC) set_target_properties(${TVII_JPEG_DRIVER_LIB} PROPERTIES OUTPUT_NAME jpeg_driver_cm7_${QUL_PLATFORM}_${CMAKE_HOST_SYSTEM_NAME}_${QUL_COMPILER_NAME}_$<CONFIG> ) target_sources(${TVII_JPEG_DRIVER_LIB} PRIVATE ${TVII_JPEG_DRIVER_DIR}/Source/jpgdec/lib_src/intjpg_drvif.c ${TVII_JPEG_DRIVER_DIR}/Source/jpgdec/lib_src/intjpg_ctrl.c ) target_include_directories(${TVII_JPEG_DRIVER_LIB} PRIVATE ${TVII_JPEG_DRIVER_DIR}/Source/jpgdec/include ${TVII_JPEG_DRIVER_DIR}/Source/jpgdec/lib_include ) target_link_libraries(${TVII_JPEG_DRIVER_LIB} PRIVATE Qul::PlatformArchitecture Qul::PlatformBSPConfig) target_compile_definitions(${TVII_JPEG_DRIVER_LIB} PRIVATE PRODUCTION) if(GREENHILLS) target_compile_options(${TVII_JPEG_DRIVER_LIB} PRIVATE "SHELL:-section .bss=.cyjpg_bss" "SHELL:-section .data=.cyjpg_data" "SHELL:-section .rodata=.cyjpg_rodata" "SHELL:-section .text=.cyjpg_text" ) else() target_compile_options(${TVII_JPEG_DRIVER_LIB} PRIVATE "SHELL:--section .bss=.cyjpg_bss" "SHELL:--section .data=.cyjpg_data" "SHELL:--section .rodata=.cyjpg_rodata" "SHELL:--section .text=.cyjpg_text" ) endif() endif() else() message(STATUS "TVII_JPEG_DRIVER library found: ${TVII_JPEG_DRIVER_LIB}") endif() qul_add_target(sprite_animations QML_PROJECT mcu_sprite_animations_jpeg.qmlproject os/${QUL_OS_LOWERCASE}/main.cpp ) target_sources(sprite_animations PRIVATE ../imagedecoder/traveo-t2g/board_config.cpp ../imagedecoder/traveo-t2g/traveot2gimagedecoder.cpp ../imagedecoder/traveo-t2g/tvii_jpeg.c ../imagedecoder/common/jpeg.cpp ) list(APPEND CMAKE_MODULE_PATH ${QUL_PLATFORM_TARGET_DIR}/../common/cmake/modules) # Old path needed for platform compatibility checks after UL-5159 (renamed folder from tvii-shared to common) list(APPEND CMAKE_MODULE_PATH ${QUL_PLATFORM_TARGET_DIR}/../tvii-shared/cmake/modules) find_package(TVII-SDK REQUIRED COMPONENTS basic_graphics util freetype) target_include_directories(sprite_animations PRIVATE ../imagedecoder/ ../imagedecoder/traveo-t2g/ ${TVII_JPEG_DRIVER_DIR}/Source/jpgdec/include ${TVII_SDK_INCLUDE_DIRS} ) target_link_libraries(sprite_animations PRIVATE Qul::PlatformBSPConfig ${TVII_JPEG_DRIVER_LIB}) if(GREENHILLS) target_link_libraries(sprite_animations PRIVATE -T ${CMAKE_CURRENT_SOURCE_DIR}/../imagedecoder/traveo-t2g/JPEGDEC_register_map.ld) endif() if(IAR) target_compile_options(sprite_animations PRIVATE --diag_suppress=Pe940) # Pe940 missing return statement at end of non-void function (graphics driver 1.2.1) endif() endif() elseif(QUL_PLATFORM MATCHES "rh850-d1m1a-baremetal") qul_add_target(sprite_animations QML_PROJECT mcu_sprite_animations_jpeg.qmlproject os/${QUL_OS_LOWERCASE}/main.cpp ) target_sources(sprite_animations PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../imagedecoder/renesas-rh850/board_config.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../imagedecoder/renesas-rh850/rh850imagedecoder.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../imagedecoder/renesas-rh850/rh850_jpeg.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../imagedecoder/common/jpeg.cpp ) target_include_directories(sprite_animations PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../imagedecoder/ ${CMAKE_CURRENT_SOURCE_DIR}/../imagedecoder/renesas-rh850/ ) target_compile_definitions(sprite_animations PRIVATE USE_OUTPUT_SPLIT_MODE DECODE_BUFFER_PIXEL_LINES=16 CHROMA_SUBSAMPLING=R_JCUA_JPEG_FORMAT_YCBCR420 ) target_link_libraries(sprite_animations PRIVATE Qul::PlatformBSPConfig) else() qul_add_target(sprite_animations QML_PROJECT mcu_sprite_animations.qmlproject GENERATE_ENTRYPOINT ) endif() app_target_setup_os(sprite_animations)