From b00dceb8c6bfb9c45c91597303ffa0ed1aa3e815 Mon Sep 17 00:00:00 2001 From: NeroBurner Date: Mon, 15 Aug 2022 13:46:42 +0200 Subject: [PATCH] Support "Centralize most color definitions" (#50) Support changes in InfiniTimeOrg/InfiniTime#1258 The file `lv_pinetime_theme.c` is renamed to `InfiniTimeTheme.cpp`. Need to pick up that change in the simulator to compile with the new cpp file if it exists. Furthermore use the new `InfiniTimeTheme.h` header in simulator files. Fixes: https://github.com/InfiniTimeOrg/InfiniSim/issues/49 --- CMakeLists.txt | 14 ++++++++++++-- main.cpp | 4 ++++ sim/displayapp/LittleVgl.cpp | 4 ++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76b90ec..c178618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,8 +197,6 @@ target_sources(infinisim PUBLIC ${InfiniTime_DIR}/src/displayapp/Colors.cpp ${InfiniTime_DIR}/src/displayapp/DisplayApp.h ${InfiniTime_DIR}/src/displayapp/DisplayApp.cpp - ${InfiniTime_DIR}/src/displayapp/lv_pinetime_theme.h - ${InfiniTime_DIR}/src/displayapp/lv_pinetime_theme.c ${InfiniTime_DIR}/src/displayapp/icons/bg_clock.c # used by WatchFaceAnalog.cpp ${InfiniTime_DIR}/src/buttonhandler/ButtonHandler.h ${InfiniTime_DIR}/src/buttonhandler/ButtonHandler.cpp @@ -231,6 +229,18 @@ target_sources(infinisim PUBLIC ${InfiniTime_DIR}/src/systemtask/SystemMonitor.cpp ) +if(EXISTS ${InfiniTime_DIR}/src/displayapp/InfiniTimeTheme.cpp) + target_compile_definitions(infinisim PUBLIC INFINITIME_THEME_CPP) + target_sources(infinisim PUBLIC + ${InfiniTime_DIR}/src/displayapp/InfiniTimeTheme.cpp + ${InfiniTime_DIR}/src/displayapp/InfiniTimeTheme.h +) +else() + target_sources(infinisim PUBLIC + ${InfiniTime_DIR}/src/displayapp/lv_pinetime_theme.h + ${InfiniTime_DIR}/src/displayapp/lv_pinetime_theme.c + ) +endif() # QCBOR add_library(QCBOR STATIC diff --git a/main.cpp b/main.cpp index ef4c997..7c34646 100644 --- a/main.cpp +++ b/main.cpp @@ -21,7 +21,11 @@ #include "lv_drivers/indev/mousewheel.h" // get PineTime header +#if defined(INFINITIME_THEME_CPP) +#include "displayapp/InfiniTimeTheme.h" +#else #include "displayapp/lv_pinetime_theme.h" +#endif #include #include diff --git a/sim/displayapp/LittleVgl.cpp b/sim/displayapp/LittleVgl.cpp index 5aa161b..355c2ba 100644 --- a/sim/displayapp/LittleVgl.cpp +++ b/sim/displayapp/LittleVgl.cpp @@ -1,5 +1,9 @@ #include "displayapp/LittleVgl.h" +#if defined(INFINITIME_THEME_CPP) +#include "displayapp/InfiniTimeTheme.h" +#else #include "displayapp/lv_pinetime_theme.h" +#endif #include #include