diff --git a/CMakeLists.txt b/CMakeLists.txt index ae6b1c5eef..2e3a033d38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,6 @@ set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - set(NRF_TARGET "nrf52") if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH) @@ -70,5 +69,4 @@ set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generate configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/Version.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docker/post_build.sh.in ${CMAKE_CURRENT_BINARY_DIR}/post_build.sh) - add_subdirectory(src) diff --git a/doc/code/Apps.md b/doc/code/Apps.md index 714e004561..6ca844815b 100644 --- a/doc/code/Apps.md +++ b/doc/code/Apps.md @@ -159,6 +159,15 @@ If your application is a **user** application, you don't need to add anything in everything will be automatically generated for you. The user application will also be automatically be added to the app launcher menu. +Since the list of **user** application is generated by CMake, you need to add the variable `ENABLE_USERAPPS` to the command line of CMake. +This variable must be set with a string composed of an ordered list of the **user** applications that must be built into the firmware. +The items of the list are fields from the enumeration `Apps`. +Ex : build the firmware with 3 user application : Alarm, Timer and MyApp (the application will be listed in this specific order in the application menu). + +```cmake +$ cmake ... -DENABLE_USERAPPS="Apps::Alarm, Apps::Timer, Apps::MyApp" ... +``` + You should now be able to [build](../buildAndProgram.md) the firmware and flash it to your PineTime. Yay! diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb7b90c006..b9f333f6b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -845,6 +845,8 @@ target_compile_options(infinitime_fonts PUBLIC $<$: ${ASM_FLAGS}> ) +add_subdirectory(displayapp/apps) + # NRF SDK add_library(nrf-sdk STATIC ${SDK_SOURCE_FILES}) target_include_directories(nrf-sdk SYSTEM PUBLIC . ../) @@ -900,7 +902,7 @@ set(EXECUTABLE_FILE_NAME ${EXECUTABLE_NAME}-${pinetime_VERSION_MAJOR}.${pinetime set(NRF5_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/gcc_nrf52.ld") add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES}) set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME}) -target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts) +target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps) target_compile_options(${EXECUTABLE_NAME} PUBLIC ${COMMON_FLAGS} ${WARNING_FLAGS} @@ -934,7 +936,7 @@ set(IMAGE_MCUBOOT_FILE_NAME_BIN ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERS set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip) set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld") add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES}) -target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts) +target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps) set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME}) target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC ${COMMON_FLAGS} @@ -976,7 +978,7 @@ endif() set(EXECUTABLE_RECOVERY_NAME "pinetime-recovery") set(EXECUTABLE_RECOVERY_FILE_NAME ${EXECUTABLE_RECOVERY_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) add_executable(${EXECUTABLE_RECOVERY_NAME} ${RECOVERY_SOURCE_FILES}) -target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs infinitime_fonts) +target_link_libraries(${EXECUTABLE_RECOVERY_NAME} nimble nrf-sdk littlefs infinitime_fonts infinitime_apps) set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_FILE_NAME}) target_compile_definitions(${EXECUTABLE_RECOVERY_NAME} PUBLIC "PINETIME_IS_RECOVERY") target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC @@ -1008,7 +1010,7 @@ set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-image-$ set(IMAGE_RECOVERY_MCUBOOT_FILE_NAME_HEX ${IMAGE_RECOVERY_MCUBOOT_FILE_NAME}.hex) set(DFU_RECOVERY_MCUBOOT_FILE_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip) add_executable(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} ${RECOVERY_SOURCE_FILES}) -target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs infinitime_fonts) +target_link_libraries(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} nimble nrf-sdk littlefs infinitime_fonts infinitime_apps) set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}) target_compile_definitions(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC "PINETIME_IS_RECOVERY") target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC @@ -1048,7 +1050,7 @@ endif() set(EXECUTABLE_RECOVERYLOADER_NAME "pinetime-recovery-loader") set(EXECUTABLE_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_RECOVERYLOADER_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) add_executable(${EXECUTABLE_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES}) -target_link_libraries(${EXECUTABLE_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts) +target_link_libraries(${EXECUTABLE_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts infinitime_apps) set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_RECOVERYLOADER_FILE_NAME}) target_compile_options(${EXECUTABLE_RECOVERYLOADER_NAME} PUBLIC ${COMMON_FLAGS} @@ -1083,7 +1085,7 @@ set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_N set(IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME_HEX ${IMAGE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.hex) set(DFU_MCUBOOT_RECOVERYLOADER_FILE_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip) add_executable(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} ${RECOVERYLOADER_SOURCE_FILES}) -target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts) +target_link_libraries(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} nrf-sdk infinitime_fonts infinitime_apps) set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}) target_compile_options(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PUBLIC ${COMMON_FLAGS} diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index c9a0b799ce..89c2ba97a1 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -3,7 +3,7 @@ #include #include "components/brightness/BrightnessController.h" #include "components/fs/FS.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" namespace Pinetime { namespace Controllers { diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 349ca01424..96bce4dd1d 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -4,7 +4,7 @@ #include #include #include -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/LittleVgl.h" #include "displayapp/TouchEvents.h" #include "components/brightness/BrightnessController.h" diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index fd79ef287b..3a5c78d909 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -11,7 +11,7 @@ #include #include "BootErrors.h" #include "displayapp/TouchEvents.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/Messages.h" namespace Pinetime { diff --git a/src/displayapp/UserApps.h b/src/displayapp/UserApps.h index cb6d57795d..0307035a01 100644 --- a/src/displayapp/UserApps.h +++ b/src/displayapp/UserApps.h @@ -1,5 +1,5 @@ #pragma once -#include "Apps.h" +#include "displayapp/apps/Apps.h" #include "Controllers.h" #include "displayapp/screens/Alarm.h" diff --git a/src/displayapp/Apps.h b/src/displayapp/apps/Apps.h.in similarity index 70% rename from src/displayapp/Apps.h rename to src/displayapp/apps/Apps.h.in index ebd8bf78d4..b4f117206d 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/apps/Apps.h.in @@ -63,28 +63,13 @@ namespace Pinetime { static constexpr size_t Count = sizeof...(As); }; + using UserAppTypes = TypeList<@USERAPP_TYPES@>; + template struct WatchFaceTypeList { static constexpr size_t Count = sizeof...(Ws); }; - using UserAppTypes = TypeList; - using UserWatchFaceTypes = WatchFaceTypeList #include -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "Screen.h" #include "ScreenList.h" #include "displayapp/Controllers.h" diff --git a/src/displayapp/screens/CheckboxList.h b/src/displayapp/screens/CheckboxList.h index c208bc489d..c6119970a1 100644 --- a/src/displayapp/screens/CheckboxList.h +++ b/src/displayapp/screens/CheckboxList.h @@ -1,6 +1,6 @@ #pragma once -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/screens/Screen.h" #include #include diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h index f7d6de535e..b1f9741a02 100644 --- a/src/displayapp/screens/InfiniPaint.h +++ b/src/displayapp/screens/InfiniPaint.h @@ -6,7 +6,7 @@ #include "displayapp/screens/Screen.h" #include "components/motor/MotorController.h" #include "Symbols.h" -#include +#include "displayapp/apps/Apps.h" #include namespace Pinetime { diff --git a/src/displayapp/screens/List.h b/src/displayapp/screens/List.h index 564229e694..17a25f8209 100644 --- a/src/displayapp/screens/List.h +++ b/src/displayapp/screens/List.h @@ -5,7 +5,7 @@ #include #include "displayapp/screens/Screen.h" #include "displayapp/widgets/PageIndicator.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "components/settings/Settings.h" #define MAXLISTITEMS 4 diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index 9cd126f440..e13e068cd9 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -7,7 +7,7 @@ #include #include #include "displayapp/Controllers.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index 062bd968af..522533215b 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -21,7 +21,7 @@ #include #include #include "displayapp/screens/Screen.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/Controllers.h" #include "Symbols.h" diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h index e62745b2ca..5c7a04299f 100644 --- a/src/displayapp/screens/Navigation.h +++ b/src/displayapp/screens/Navigation.h @@ -22,7 +22,7 @@ #include #include "displayapp/screens/Screen.h" #include -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/Controllers.h" #include "Symbols.h" diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h index 1ea2515881..586cccf4cf 100644 --- a/src/displayapp/screens/Paddle.h +++ b/src/displayapp/screens/Paddle.h @@ -3,7 +3,7 @@ #include #include #include "displayapp/screens/Screen.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/Controllers.h" #include "Symbols.h" diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h index 428e4b2980..6443582f5e 100644 --- a/src/displayapp/screens/Steps.h +++ b/src/displayapp/screens/Steps.h @@ -4,7 +4,7 @@ #include #include "displayapp/screens/Screen.h" #include -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/Controllers.h" #include "Symbols.h" diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h index b3bbba8744..3386d042b8 100644 --- a/src/displayapp/screens/StopWatch.h +++ b/src/displayapp/screens/StopWatch.h @@ -7,7 +7,7 @@ #include "portmacro_cmsis.h" #include "systemtask/SystemTask.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/Controllers.h" #include "Symbols.h" diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h index 8c1cd12cdc..f1b86246ce 100644 --- a/src/displayapp/screens/Tile.h +++ b/src/displayapp/screens/Tile.h @@ -4,7 +4,7 @@ #include #include #include "displayapp/screens/Screen.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "components/datetime/DateTimeController.h" #include "components/settings/Settings.h" #include "components/battery/BatteryController.h" diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h index d983d13640..52449fd36c 100644 --- a/src/displayapp/screens/Twos.h +++ b/src/displayapp/screens/Twos.h @@ -1,6 +1,6 @@ #pragma once -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/screens/Screen.h" #include "displayapp/Controllers.h" diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.h b/src/displayapp/screens/WatchFaceCasioStyleG7710.h index 7f71a21fb9..f10e931ce4 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.h +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.h @@ -10,7 +10,7 @@ #include "components/datetime/DateTimeController.h" #include "components/ble/BleController.h" #include "utility/DirtyValue.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" namespace Pinetime { namespace Controllers { diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index a124a1c562..a4664792c0 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -9,7 +9,7 @@ #include "components/ble/BleController.h" #include "displayapp/widgets/StatusIcons.h" #include "utility/DirtyValue.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" namespace Pinetime { namespace Controllers { diff --git a/src/displayapp/screens/WatchFaceInfineat.h b/src/displayapp/screens/WatchFaceInfineat.h index bd8862d509..32c08f1887 100644 --- a/src/displayapp/screens/WatchFaceInfineat.h +++ b/src/displayapp/screens/WatchFaceInfineat.h @@ -8,7 +8,7 @@ #include "displayapp/screens/Screen.h" #include "components/datetime/DateTimeController.h" #include "utility/DirtyValue.h" -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" namespace Pinetime { namespace Controllers { diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 065417fa7c..cb5ba413e8 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -1,7 +1,7 @@ #include "displayapp/screens/settings/Settings.h" #include #include -#include "displayapp/Apps.h" +#include "displayapp/apps/Apps.h" #include "displayapp/DisplayApp.h" using namespace Pinetime::Applications::Screens;