C
Qt Quick Ultralite Thermostat Demo
cmake_minimum_required (VERSION 3.15) project(thermo VERSION 0.0.1 LANGUAGES C CXX ASM) if (NOT TARGET Qul::Core) find_package(Qul) endif() qul_add_target(thermo_small) set(UNIT_SYSTEM "metric" CACHE STRING "Thermostat Demo Unit System") set(COMMON_QML_FILES thermo.qml TopBar.qml BottomBar.qml PlacesView.qml Card.qml CardRow.qml PowerSwitch.qml ScheduleView.qml RoomSchedule.qml StatsView.qml RoomView.qml RoomControlButton.qml AnimatedDigit.qml WeatherStatus.qml ThermoView.qml StatsContents.qml TimeIntervalSlider.qml TimeIntervalSliderHandle.qml FanControlButton.qml LanguageDialog.qml LanguageButton.qml) set(MODULE_QML_FILES imports/Thermo/ColorStyle.qml imports/Thermo/Rooms.qml imports/Thermo/Room.qml) if(QUL_PLATFORM MATCHES "^ek-ra6m3g") set(ANIM_CONFIG "static" CACHE STRING "Thermostat Demo Animation Configuration") else() set(ANIM_CONFIG "dynamic" CACHE STRING "Thermostat Demo Animation Configuration") endif() if(QUL_PLATFORM MATCHES "^ek-ra6m3g") set(FONT_ENGINE "Static" CACHE STRING "Thermostat Demo Font Engine") else() set(FONT_ENGINE "Spark" CACHE STRING "Thermostat Demo Font Engine") endif() if(FONT_ENGINE STREQUAL "Static") set(TRANSLATION_FILES thermo.de_DE.ts thermo.ja_JP.ts) set(DEFAULT_FONT_FAMILY "Roboto") set(FONT_FILES NotoSansArabic-Regular.ttf NotoSansJP-Regular.otf NotoSansThai-Regular.ttf Roboto-Regular.ttf ) else() set(TRANSLATION_FILES thermo.de_DE.ts thermo.ja_JP.ts thermo.ar_EG.ts thermo.th_TH.ts) set(DEFAULT_FONT_FAMILY "regular") set(FONT_FILES ThermoDemoFontmap.fmp ) endif() list(TRANSFORM FONT_FILES PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/fonts/) qul_add_resource(thermo_small BASE small/${FONT_ENGINE} FILES small/${FONT_ENGINE}/popup-bg.png ) qul_add_resource(thermo_small BASE small FILES small/qt-logo.png small/JAPAN.png small/temp-down-pressed.png small/switch-handle.png small/scrollbar-temperature-track.png small/radiobutton-checked-pressed.png small/digitMaskBottom.png small/switch-i.png small/btn-bg-big-on.png small/radiobutton-pressed.png small/pressed-bg-up.png small/selected.png small/eco-on.png small/streamer-on-small.png small/page-indicator.png small/jog-off.png small/status-small.png small/dryer-on-small.png small/dryer-on.png small/close.png small/auto-card.png small/toggle-year.png small/eco-on-small.png small/separator-line.png small/radiobutton-checked.png small/streamer-on.png small/btn-bg-down.png small/slider-handle.png small/thermo-handle.png small/switch-bg.png small/pressed-bg-down.png small/auto-on.png small/place-back.png small/UK.png small/EGYPT.png small/THAILAND.png small/radiobutton.png small/baseline-arrow-back.png small/digitMaskTop.png small/switch-o.png small/power-on.png small/temp-up-pressed.png small/btn-bg-big-off.png small/toggle-month.png small/jog.png small/GERMANY.png small/change-language.png small/scrollbar-off-track.png small/weather/w_06.png small/weather/w_01.png small/weather/w_02.png small/weather/w_07.png small/weather/w_05.png small/weather/w_04.png small/weather/w_03.png small/stats-month.png small/stats-year.png ) qul_add_resource(thermo_small FILES images/inner-circle.png images/card-back-topleft.png images/card-back-bottomleft.png images/card-back-topright.png images/card-back-bottomright.png ) if(QUL_PLATFORM MATCHES "^stm32" AND IAR) # For stm32 together with IAR compiler there is a performance issue with # blending the 1 pixel width background. To avoid blending the full # background image is included. qul_add_resource(thermo_small BASE small FILES small/main-bg-full.png ) set(ADDITIONAL_QML_FILES_SMALL "small/stm32_iar/BackgroundImage.qml") set(ADDITIONAL_QML_FILES_BIG "BackgroundImage.qml") else() qul_add_resource(thermo_small BASE small FILES small/main-bg.png ) list(APPEND COMMON_QML_FILES "BackgroundImage.qml") endif() qul_target_qml_sources(thermo_small ${COMMON_QML_FILES} ${ADDITIONAL_QML_FILES_SMALL}) qul_add_qml_module(thermo_small_module URI Thermo QML_FILES ${MODULE_QML_FILES} small/Theme.qml ${UNIT_SYSTEM}/Units.qml OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thermo_small_module ) qul_add_resource(thermo_small_module BASE small FILES small/fan-off.png small/fan-off-small.png small/fan-1-on.png small/fan-1-on-small.png small/fan-2-on.png small/fan-2-on-small.png small/fan-3-on.png small/fan-3-on-small.png small/fan-4-on.png small/fan-4-on-small.png ) set_target_properties(thermo_small PROPERTIES QUL_DEFAULT_FONT_FAMILY "${DEFAULT_FONT_FAMILY}" QUL_FONT_ENGINE "${FONT_ENGINE}" QUL_FONT_FILES "${FONT_FILES}" ) if(FONT_ENGINE STREQUAL "Spark") if(QUL_PLATFORM MATCHES "^stm32") # Enable preallocation of the spark heap to ensure it ends up in SDRAM set_target_properties(thermo_small PROPERTIES QUL_FONT_HEAP_SIZE 100000) elseif(QUL_PLATFORM MATCHES "^ek-ra6m3g") set_target_properties(thermo_small PROPERTIES QUL_FONT_HEAP_SIZE 24000 QUL_FONT_CACHE_SIZE 100000) endif() endif() if (QUL_PLATFORM STREQUAL "mimxrt1050-evk-freertos" OR QUL_PLATFORM STREQUAL "mimxrt1064-evk-freertos") # default FreeRTOS heap size 256k math(EXPR heap_size "512 * 1024") add_compile_definitions(configTOTAL_HEAP_SIZE=${heap_size}) endif() qul_add_qml_module(thermo_configuration_small_module URI ThermoConfiguration QML_FILES fonts/${FONT_ENGINE}/FontConfiguration.qml ${ANIM_CONFIG}/Configuration.qml OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thermo_configuration_small_module ) qul_target_embed_translations(thermo_configuration_small_module ${TRANSLATION_FILES}) qul_target_embed_translations(thermo_small_module ${TRANSLATION_FILES}) qul_target_embed_translations(thermo_small ${TRANSLATION_FILES}) target_link_libraries(thermo_small PRIVATE thermo_configuration_small_module thermo_small_module Qul::ControlsTemplates) app_target_setup_os(thermo_small) app_target_default_entrypoint(thermo_small thermo) # FIXME: the if below should be changed to # if (NOT "thermo_big" IN_LIST QUL_PLATFORM_EXCLUDED_DEMOS) # Assets currently too big for devices (except stm32s) if(QUL_PLATFORM STREQUAL "qt" OR QUL_PLATFORM MATCHES "^stm32f7" OR QUL_PLATFORM MATCHES "^stm32f4") qul_add_target(thermo_big) qul_add_resource(thermo_big BASE big/${FONT_ENGINE} FILES big/${FONT_ENGINE}/popup-bg.png ) qul_add_resource(thermo_big BASE big FILES big/qt-logo.png big/JAPAN.png big/temp-down-pressed.png big/switch-handle.png big/scrollbar-temperature-track.png big/radiobutton-checked-pressed.png big/digitMaskBottom.png big/switch-i.png big/btn-bg-big-on.png big/radiobutton-pressed.png big/pressed-bg-up.png big/selected.png big/eco-on.png big/streamer-on-small.png big/page-indicator.png big/jog-off.png big/status-small.png big/dryer-on-small.png big/dryer-on.png big/close.png big/auto-card.png big/toggle-year.png big/eco-on-small.png big/separator-line.png big/radiobutton-checked.png big/streamer-on.png big/radiobutton-disabled.png big/btn-bg-down.png big/slider-handle.png big/thermo-handle.png big/switch-bg.png big/pressed-bg-down.png big/main-bg.png big/auto-on.png big/place-back.png big/UK.png big/EGYPT.png big/THAILAND.png big/radiobutton.png big/baseline-arrow-back.png big/digitMaskTop.png big/switch-o.png big/power-on.png big/temp-up-pressed.png big/btn-bg-big-off.png big/toggle-month.png big/jog.png big/GERMANY.png big/change-language.png big/scrollbar-off-track.png big/weather/w_06.png big/weather/w_01.png big/weather/w_02.png big/weather/w_07.png big/weather/w_05.png big/weather/w_04.png big/weather/w_03.png big/stats-month.png big/stats-year.png ) qul_add_resource(thermo_big FILES images/inner-circle.png images/card-back-topleft.png images/card-back-bottomleft.png images/card-back-topright.png images/card-back-bottomright.png ) qul_target_qml_sources(thermo_big ${COMMON_QML_FILES} ${ADDITIONAL_QML_FILES_BIG}) qul_add_qml_module(thermo_big_module URI Thermo QML_FILES ${MODULE_QML_FILES} big/Theme.qml ${UNIT_SYSTEM}/Units.qml OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thermo_big_module ) qul_add_resource(thermo_big_module BASE big FILES big/fan-off.png big/fan-off-small.png big/fan-1-on.png big/fan-1-on-small.png big/fan-2-on.png big/fan-2-on-small.png big/fan-3-on.png big/fan-3-on-small.png big/fan-4-on.png big/fan-4-on-small.png ) set_target_properties(thermo_big PROPERTIES QUL_DEFAULT_FONT_FAMILY "${DEFAULT_FONT_FAMILY}" QUL_FONT_ENGINE "${FONT_ENGINE}" QUL_FONT_FILES "${FONT_FILES}" ) if(FONT_ENGINE STREQUAL "Spark" AND QUL_PLATFORM MATCHES "^stm32") # Enable preallocation of the spark heap to ensure it ends up in SDRAM set_target_properties(thermo_big PROPERTIES QUL_FONT_HEAP_SIZE 100000) endif() qul_add_qml_module(thermo_configuration_big_module URI ThermoConfiguration QML_FILES fonts/${FONT_ENGINE}/FontConfiguration.qml ${ANIM_CONFIG}/Configuration.qml OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thermo_configuration_big_module ) qul_target_embed_translations(thermo_configuration_big_module ${TRANSLATION_FILES}) qul_target_embed_translations(thermo_big_module ${TRANSLATION_FILES}) qul_target_embed_translations(thermo_big ${TRANSLATION_FILES}) target_link_libraries(thermo_big PRIVATE thermo_configuration_big_module thermo_big_module Qul::ControlsTemplates) app_target_setup_os(thermo_big) app_target_default_entrypoint(thermo_big thermo) endif()