63e0c4f4ef
A list of "user applications" is built at compile time. It contains all the info needed to create the application at runtime (ptr to a create() function) and to display the app in the application menu. All applications declare a TypeTrait with these information. When a new app must be loaded, DisplayApp first check if this app is a System app (in which case it creates it like it did before). If it's not a System app, it looks for the app in the list of User applications and creates it if it found it. Those changes allow to more easily add new app and to select which app must be built into the firmware. Switch to C++20 (and fix a few issues in SpiMaster.cpp and Watchdog.cpp.
75 lines
2.5 KiB
CMake
75 lines
2.5 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release")
|
|
|
|
project(pinetime VERSION 1.13.0 LANGUAGES C CXX ASM)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
# set(CMAKE_GENERATOR "Unix Makefiles")
|
|
set(CMAKE_C_EXTENSIONS OFF)
|
|
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)
|
|
message(FATAL_ERROR "The path to the toolchain (arm-none-eabi) must be specified on the command line (add -DARM_NONE_EABI_TOOLCHAIN_PATH=<path>")
|
|
endif ()
|
|
|
|
if (NOT NRF5_SDK_PATH)
|
|
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
|
|
endif ()
|
|
|
|
if(BUILD_DFU)
|
|
set(BUILD_DFU true)
|
|
endif()
|
|
|
|
if(BUILD_RESOURCES)
|
|
set(BUILD_RESOURCES true)
|
|
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)
|
|
|
|
set(PROJECT_GIT_COMMIT_HASH "")
|
|
|
|
execute_process(COMMAND git rev-parse --short HEAD
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
OUTPUT_VARIABLE PROJECT_GIT_COMMIT_HASH
|
|
RESULT_VARIABLE PROJECT_GIT_COMMIT_HASH_SUCCESS)
|
|
|
|
string(STRIP "${PROJECT_GIT_COMMIT_HASH}" PROJECT_GIT_COMMIT_HASH)
|
|
|
|
message("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS})
|
|
|
|
message("")
|
|
message("BUILD CONFIGURATION")
|
|
message("-------------------")
|
|
message(" * Mode : " ${CMAKE_BUILD_TYPE})
|
|
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
|
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
|
|
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
|
|
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
|
message(" * Target device : " ${TARGET_DEVICE})
|
|
if(BUILD_DFU)
|
|
message(" * Build DFU (using adafruit-nrfutil) : Enabled")
|
|
else()
|
|
message(" * Build DFU (using adafruit-nrfutil) : Disabled")
|
|
endif()
|
|
if(BUILD_RESOURCES)
|
|
message(" * Build resources : Enabled")
|
|
else()
|
|
message(" * Build resources : Disabled")
|
|
endif()
|
|
|
|
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)
|
|
|
|
|
|
add_subdirectory(src)
|