Watch face selection at build time
Replace the options that allowed to select the user apps independently by a single string variable that contains the ordered list of apps to build.
This commit is contained in:
parent
f2996f54a8
commit
1ad7840072
|
@ -34,18 +34,11 @@ endif()
|
|||
set(TARGET_DEVICE "PINETIME" CACHE STRING "Target device")
|
||||
set_property(CACHE TARGET_DEVICE PROPERTY STRINGS PINETIME MOY_TFK5 MOY_TIN5 MOY_TON5 MOY_UNK)
|
||||
|
||||
option(ENABLE_APP_STOPWATCH "Enable the Stopwatch application" True)
|
||||
option(ENABLE_APP_ALARM "Enable the Alarm application" True)
|
||||
option(ENABLE_APP_TIMER "Enable the Timer application" True)
|
||||
option(ENABLE_APP_STEPS "Enable the Steps application" True)
|
||||
option(ENABLE_APP_HEARTRATE "Enable the HeartRate application" True)
|
||||
option(ENABLE_APP_MUSIC "Enable the Music application" True)
|
||||
option(ENABLE_APP_PAINT "Enable the Paint application" True)
|
||||
option(ENABLE_APP_PADDLE "Enable the Paddle game" True)
|
||||
option(ENABLE_APP_TWOS "Enable the Twos game" True)
|
||||
option(ENABLE_APP_METRONOME "Enable the Metronome application" True)
|
||||
option(ENABLE_APP_NAVIGATION "Enable the Navigation application" True)
|
||||
option(ENABLE_APP_MOTION "Enable the Motion application" False)
|
||||
if(ENABLE_USERAPPS)
|
||||
set(USERAPP_TYPES ${ENABLE_USERAPPS})
|
||||
else ()
|
||||
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")
|
||||
endif ()
|
||||
|
||||
set(PROJECT_GIT_COMMIT_HASH "")
|
||||
|
||||
|
@ -77,34 +70,13 @@ if(BUILD_RESOURCES)
|
|||
else()
|
||||
message(" * Build resources : Disabled")
|
||||
endif()
|
||||
message(" * User apps : " ${USERAPP_TYPES})
|
||||
|
||||
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
|
||||
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)
|
||||
|
||||
function(AddToListIfEnabled list enabled type)
|
||||
if(${enabled})
|
||||
list(APPEND ${list} ${type})
|
||||
endif ()
|
||||
#return(PROPAGATE ${list})
|
||||
set(${list} "${${list}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Generate the list of user apps to be compiled into the firmware
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_STOPWATCH} "Apps::StopWatch")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_ALARM} "Apps::Alarm")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_TIMER} "Apps::Timer")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_STEPS} "Apps::Steps")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_HEARTRATE} "Apps::HeartRate")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_MUSIC} "Apps::Music")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_PAINT} "Apps::Paint")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_PADDLE} "Apps::Paddle")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_TWOS} "Apps::Twos")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_METRONOME} "Apps::Metronome")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_NAVIGATION} "Apps::Navigation")
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_MOTION} "Apps::Motion")
|
||||
|
||||
list(JOIN USERAPP_TYPES_LIST "," USERAPP_TYPES)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/displayapp/Apps.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/displayapp/Apps.h)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
|
|
@ -159,22 +159,10 @@ 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, add a new `option` in the main [CMakeLists.txt file](../../CMakeLists.txt). The application will be built by default if the value is set to `True`. :
|
||||
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
|
||||
option(ENABLE_APP_MYAPP "Enable the MyApp application" True)
|
||||
```
|
||||
|
||||
The default value can be overridden by passing an additional parameter to the command line of CMake :
|
||||
|
||||
```cmake
|
||||
$ cmake ... -DENABLE_APP_MYAPP=True ...
|
||||
```
|
||||
|
||||
Then add your **user app** to the list of apps by calling `AddToListIfEnabled()` :
|
||||
|
||||
```cmake
|
||||
AddToListIfEnabled(USERAPP_TYPES_LIST ${ENABLE_APP_MYAPP} "Apps::MyApp")
|
||||
$ cmake ... -DENABLE_USERAPPS="Apps::Alarm, Apps::Timer, Apps::MyApp" ...
|
||||
```
|
||||
|
||||
You should now be able to [build](../buildAndProgram.md) the firmware
|
||||
|
|
Loading…
Reference in New Issue
Block a user