Skip to content

Commit f0e8bb2

Browse files
committed
Watch face selection with CMake
Move displayapp/Apps.h into a header only library (to make the integration easier in InfiniSim.
1 parent 1ad7840 commit f0e8bb2

21 files changed

+37
-33
lines changed

CMakeLists.txt

+6-10
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ endif()
3434
set(TARGET_DEVICE "PINETIME" CACHE STRING "Target device")
3535
set_property(CACHE TARGET_DEVICE PROPERTY STRINGS PINETIME MOY_TFK5 MOY_TIN5 MOY_TON5 MOY_UNK)
3636

37-
if(ENABLE_USERAPPS)
38-
set(USERAPP_TYPES ${ENABLE_USERAPPS})
39-
else ()
40-
set(USERAPP_TYPES "Apps::Navigation, Apps::StopWatch, Apps::Alarm, Apps::Timer, Apps::Steps, Apps::HeartRate, Apps::Music, Apps::Paint, Apps::Paddle, Apps::Twos, Apps::Metronome")
41-
endif ()
42-
4337
set(PROJECT_GIT_COMMIT_HASH "")
4438

4539
execute_process(COMMAND git rev-parse --short HEAD
@@ -51,6 +45,12 @@ string(STRIP "${PROJECT_GIT_COMMIT_HASH}" PROJECT_GIT_COMMIT_HASH)
5145

5246
message("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS})
5347

48+
if(DEFINED ENABLE_USERAPPS)
49+
set(USERAPP_TYPES ${ENABLE_USERAPPS} CACHE STRING "List of user apps to build into the firmware")
50+
else ()
51+
set(USERAPP_TYPES "Apps::Navigation, Apps::StopWatch, Apps::Alarm, Apps::Timer, Apps::Steps, Apps::HeartRate, Apps::Music, Apps::Paint, Apps::Paddle, Apps::Twos, Apps::Metronome" CACHE STRING "List of user apps to build into the firmware")
52+
endif ()
53+
5454
message("")
5555
message("BUILD CONFIGURATION")
5656
message("-------------------")
@@ -70,13 +70,9 @@ if(BUILD_RESOURCES)
7070
else()
7171
message(" * Build resources : Disabled")
7272
endif()
73-
message(" * User apps : " ${USERAPP_TYPES})
7473

7574
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
7675
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/Version.h)
7776
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docker/post_build.sh.in ${CMAKE_CURRENT_BINARY_DIR}/post_build.sh)
7877

79-
# Generate the list of user apps to be compiled into the firmware
80-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/displayapp/Apps.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/displayapp/Apps.h)
81-
8278
add_subdirectory(src)

src/CMakeLists.txt

+8-6
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,8 @@ target_compile_options(infinitime_fonts PUBLIC
845845
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
846846
)
847847

848+
add_subdirectory(displayapp/apps)
849+
848850
# NRF SDK
849851
add_library(nrf-sdk STATIC ${SDK_SOURCE_FILES})
850852
target_include_directories(nrf-sdk SYSTEM PUBLIC . ../)
@@ -900,7 +902,7 @@ set(EXECUTABLE_FILE_NAME ${EXECUTABLE_NAME}-${pinetime_VERSION_MAJOR}.${pinetime
900902
set(NRF5_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/gcc_nrf52.ld")
901903
add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})
902904
set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME})
903-
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts)
905+
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps)
904906
target_compile_options(${EXECUTABLE_NAME} PUBLIC
905907
${COMMON_FLAGS}
906908
${WARNING_FLAGS}
@@ -934,7 +936,7 @@ set(IMAGE_MCUBOOT_FILE_NAME_BIN ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERS
934936
set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
935937
set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld")
936938
add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES})
937-
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts)
939+
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps)
938940
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME})
939941
target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC
940942
${COMMON_FLAGS}
@@ -976,7 +978,7 @@ endif()
976978
set(EXECUTABLE_RECOVERY_NAME "pinetime-recovery")
977979
set(EXECUTABLE_RECOVERY_FILE_NAME ${EXECUTABLE_RECOVERY_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
978980
add_executable(${EXECUTABLE_RECOVERY_NAME} ${RECOVERY_SOURCE_FILES})
979-
target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs infinitime_fonts)
981+
target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs infinitime_fonts infinitime_apps)
980982
set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME})
981983
target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY")
982984
target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC
@@ -1008,7 +1010,7 @@ set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-$
10081010
set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME_HEX ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}.hex)
10091011
set(DFU_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
10101012
add_executable(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} ${RECOVERY_SOURCE_FILES})
1011-
target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs infinitime_fonts)
1013+
target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs infinitime_fonts infinitime_apps)
10121014
set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME})
10131015
target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY")
10141016
target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC
@@ -1048,7 +1050,7 @@ endif()
10481050
set(EXECUTABLE_RECOVERYLOADER_NAME "pinetime-recovery-loader")
10491051
set(EXECUTABLE_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_RECOVERYLOADER_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH})
10501052
add_executable(${EXECUTABLE_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES})
1051-
target_link_libraries(${EXECUTABLE_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts)
1053+
target_link_libraries(${EXECUTABLE_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts infinitime_apps)
10521054
set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERYLOADER_FILE_NAME})
10531055
target_compile_options(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC
10541056
${COMMON_FLAGS}
@@ -1083,7 +1085,7 @@ set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_N
10831085
set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME_HEX ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.hex)
10841086
set(DFU_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
10851087
add_executable(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES})
1086-
target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts)
1088+
target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts infinitime_apps)
10871089
set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME})
10881090
target_compile_options(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC
10891091
${COMMON_FLAGS}

src/displayapp/DisplayApp.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <task.h>
55
#include <memory>
66
#include <systemtask/Messages.h>
7-
#include "displayapp/Apps.h"
7+
#include "displayapp/apps/Apps.h"
88
#include "displayapp/LittleVgl.h"
99
#include "displayapp/TouchEvents.h"
1010
#include "components/brightness/BrightnessController.h"

src/displayapp/DisplayAppRecovery.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <components/motor/MotorController.h>
1212
#include "BootErrors.h"
1313
#include "displayapp/TouchEvents.h"
14-
#include "displayapp/Apps.h"
14+
#include "displayapp/apps/Apps.h"
1515
#include "displayapp/Messages.h"
1616

1717
namespace Pinetime {

src/displayapp/UserApps.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#pragma once
2-
#include "displayapp/Apps.h"
2+
#include "displayapp/apps/Apps.h"
33
#include "Controllers.h"
44

55
#include "displayapp/screens/Alarm.h"
File renamed without changes.

src/displayapp/apps/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
add_library(infinitime_apps INTERFACE)
2+
target_sources(infinitime_apps INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/Apps.h")
3+
target_include_directories(infinitime_apps INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/")
4+
5+
# Generate the list of user apps to be compiled into the firmware
6+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Apps.h.in ${CMAKE_CURRENT_BINARY_DIR}/Apps.h)

src/displayapp/screens/Alarm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
#pragma once
1919

20-
#include "displayapp/Apps.h"
20+
#include "displayapp/apps/Apps.h"
2121
#include "components/settings/Settings.h"
2222
#include "displayapp/screens/Screen.h"
2323
#include "displayapp/widgets/Counter.h"

src/displayapp/screens/ApplicationList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <array>
44
#include <memory>
5-
#include "displayapp/Apps.h"
5+
#include "displayapp/apps/Apps.h"
66
#include "Screen.h"
77
#include "ScreenList.h"
88
#include "displayapp/Controllers.h"

src/displayapp/screens/CheckboxList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "displayapp/Apps.h"
3+
#include "displayapp/apps/Apps.h"
44
#include "displayapp/screens/Screen.h"
55
#include <array>
66
#include <cstdint>

src/displayapp/screens/InfiniPaint.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "displayapp/screens/Screen.h"
77
#include "components/motor/MotorController.h"
88
#include "Symbols.h"
9-
#include <displayapp/Apps.h>
9+
#include "displayapp/apps/Apps.h"
1010
#include <displayapp/Controllers.h>
1111

1212
namespace Pinetime {

src/displayapp/screens/List.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <array>
66
#include "displayapp/screens/Screen.h"
77
#include "displayapp/widgets/PageIndicator.h"
8-
#include "displayapp/Apps.h"
8+
#include "displayapp/apps/Apps.h"
99
#include "components/settings/Settings.h"
1010

1111
#define MAXLISTITEMS 4

src/displayapp/screens/Motion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <lvgl/src/lv_core/lv_obj.h>
88
#include <components/motion/MotionController.h>
99
#include "displayapp/Controllers.h"
10-
#include "displayapp/Apps.h"
10+
#include "displayapp/apps/Apps.h"
1111

1212
namespace Pinetime {
1313
namespace Applications {

src/displayapp/screens/Music.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <lvgl/src/lv_core/lv_obj.h>
2222
#include <string>
2323
#include "displayapp/screens/Screen.h"
24-
#include "displayapp/Apps.h"
24+
#include "displayapp/apps/Apps.h"
2525
#include "displayapp/Controllers.h"
2626
#include "Symbols.h"
2727

src/displayapp/screens/Navigation.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <string>
2323
#include "displayapp/screens/Screen.h"
2424
#include <array>
25-
#include "displayapp/Apps.h"
25+
#include "displayapp/apps/Apps.h"
2626
#include "displayapp/Controllers.h"
2727
#include "Symbols.h"
2828

src/displayapp/screens/Paddle.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <lvgl/lvgl.h>
44
#include <cstdint>
55
#include "displayapp/screens/Screen.h"
6-
#include "displayapp/Apps.h"
6+
#include "displayapp/apps/Apps.h"
77
#include "displayapp/Controllers.h"
88
#include "Symbols.h"
99

src/displayapp/screens/Steps.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <lvgl/lvgl.h>
55
#include "displayapp/screens/Screen.h"
66
#include <components/motion/MotionController.h>
7-
#include "displayapp/Apps.h"
7+
#include "displayapp/apps/Apps.h"
88
#include "displayapp/Controllers.h"
99
#include "Symbols.h"
1010

src/displayapp/screens/StopWatch.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "portmacro_cmsis.h"
88

99
#include "systemtask/SystemTask.h"
10-
#include "displayapp/Apps.h"
10+
#include "displayapp/apps/Apps.h"
1111
#include "displayapp/Controllers.h"
1212
#include "Symbols.h"
1313

src/displayapp/screens/Tile.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <cstdint>
55
#include <memory>
66
#include "displayapp/screens/Screen.h"
7-
#include "displayapp/Apps.h"
7+
#include "displayapp/apps/Apps.h"
88
#include "components/datetime/DateTimeController.h"
99
#include "components/settings/Settings.h"
1010
#include "components/battery/BatteryController.h"

src/displayapp/screens/Twos.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "displayapp/Apps.h"
3+
#include "displayapp/apps/Apps.h"
44
#include "displayapp/screens/Screen.h"
55
#include "displayapp/Controllers.h"
66

src/displayapp/screens/settings/Settings.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "displayapp/screens/settings/Settings.h"
22
#include <lvgl/lvgl.h>
33
#include <functional>
4-
#include "displayapp/Apps.h"
4+
#include "displayapp/apps/Apps.h"
55
#include "displayapp/DisplayApp.h"
66

77
using namespace Pinetime::Applications::Screens;

0 commit comments

Comments
 (0)