diff options
| author | Jean-François Milants <jf@codingfield.com> | 2023-12-17 17:18:25 +0100 |
|---|---|---|
| committer | JF <JF002@users.noreply.github.com> | 2023-12-23 21:29:13 +0100 |
| commit | f2996f54a8dfce031c5101d93087cfda8a0740a4 (patch) | |
| tree | adda80e76a43295f82a6f953261d58f7e0b342ef /doc/code/Apps.md | |
| parent | e00b98b82c3f29fa963eef68ca9e097808982d6e (diff) | |
CMake User Applications selection
Update documentation about building a new application and add instructions to add the app in CMake files.
Diffstat (limited to 'doc/code/Apps.md')
| -rw-r--r-- | doc/code/Apps.md | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/doc/code/Apps.md b/doc/code/Apps.md index 714e0045..2d49c60e 100644 --- a/doc/code/Apps.md +++ b/doc/code/Apps.md @@ -59,7 +59,7 @@ and then the function `create` is called to create an instance of the app. The list of user applications is generated at build time by the `consteval` function `CreateAppDescriptions()` in `UserApps.h`. This method takes the list of applications that must be built into the firmware image. -This list of applications is defined as a list `Apps` enum values named `UserAppTypes` in `Apps.h`. +This list of applications is defined as a list `Apps` enum values named `UserAppTypes` in `Apps.h`. For each application listed in `UserAppTypes`, an entry of type `AppDescription` is added to the array `userApps`. This entry is created by using the information provided by a template `AppTraits` that is customized for every user application. @@ -159,6 +159,24 @@ 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`. : + +```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") +``` + You should now be able to [build](../buildAndProgram.md) the firmware and flash it to your PineTime. Yay! |
