2020-01-18 14:52:33 -05:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2022-05-10 16:11:08 -04:00
|
|
|
|
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose Debug or Release")
|
|
|
|
|
2023-06-24 10:00:10 -04:00
|
|
|
project(pinetime VERSION 1.13.0 LANGUAGES C CXX ASM)
|
2019-11-17 14:47:04 -05:00
|
|
|
|
2021-03-16 08:43:50 -04:00
|
|
|
set(CMAKE_C_STANDARD 99)
|
2023-10-23 14:12:34 -04:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2021-03-16 08:43:50 -04:00
|
|
|
|
|
|
|
# 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)
|
2019-11-17 14:47:04 -05:00
|
|
|
set(NRF_TARGET "nrf52")
|
2023-12-17 10:34:00 -05:00
|
|
|
cmake_policy(SET CMP0140 NEW)
|
2019-11-17 14:47:04 -05:00
|
|
|
|
|
|
|
if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH)
|
2020-10-02 14:43:30 -04:00
|
|
|
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>")
|
2019-11-17 14:47:04 -05:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (NOT NRF5_SDK_PATH)
|
2020-01-05 13:55:01 -05:00
|
|
|
message(FATAL_ERROR "The path to the NRF52 SDK must be specified on the command line (add -DNRF5_SDK_PATH=<path>")
|
2019-11-17 14:47:04 -05:00
|
|
|
endif ()
|
|
|
|
|
2021-02-01 15:07:53 -05:00
|
|
|
if(BUILD_DFU)
|
|
|
|
set(BUILD_DFU true)
|
|
|
|
endif()
|
|
|
|
|
2022-09-11 06:43:30 -04:00
|
|
|
if(BUILD_RESOURCES)
|
|
|
|
set(BUILD_RESOURCES true)
|
|
|
|
endif()
|
|
|
|
|
2022-05-10 15:46:36 -04:00
|
|
|
set(TARGET_DEVICE "PINETIME" CACHE STRING "Target device")
|
2023-11-16 14:08:07 -05:00
|
|
|
set_property(CACHE TARGET_DEVICE PROPERTY STRINGS PINETIME MOY_TFK5 MOY_TIN5 MOY_TON5 MOY_UNK)
|
2021-09-13 05:41:51 -04:00
|
|
|
|
2023-12-17 10:34:00 -05:00
|
|
|
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)
|
|
|
|
|
2021-05-13 18:08:37 -04:00
|
|
|
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)
|
|
|
|
|
2021-05-24 04:53:18 -04:00
|
|
|
string(STRIP "${PROJECT_GIT_COMMIT_HASH}" PROJECT_GIT_COMMIT_HASH)
|
2021-05-13 18:08:37 -04:00
|
|
|
|
|
|
|
message("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS})
|
|
|
|
|
2022-05-10 16:11:08 -04:00
|
|
|
message("")
|
2020-01-17 08:56:56 -05:00
|
|
|
message("BUILD CONFIGURATION")
|
|
|
|
message("-------------------")
|
2022-05-10 16:11:08 -04:00
|
|
|
message(" * Mode : " ${CMAKE_BUILD_TYPE})
|
2020-01-18 08:50:24 -05:00
|
|
|
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
2020-01-17 08:56:56 -05:00
|
|
|
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
|
2021-05-13 18:08:37 -04:00
|
|
|
message(" * GitRef(S) : " ${PROJECT_GIT_COMMIT_HASH})
|
2020-01-17 08:56:56 -05:00
|
|
|
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
2021-09-13 05:41:51 -04:00
|
|
|
message(" * Target device : " ${TARGET_DEVICE})
|
2021-02-01 15:07:53 -05:00
|
|
|
if(BUILD_DFU)
|
|
|
|
message(" * Build DFU (using adafruit-nrfutil) : Enabled")
|
|
|
|
else()
|
|
|
|
message(" * Build DFU (using adafruit-nrfutil) : Disabled")
|
|
|
|
endif()
|
2022-09-11 06:43:30 -04:00
|
|
|
if(BUILD_RESOURCES)
|
|
|
|
message(" * Build resources : Enabled")
|
|
|
|
else()
|
|
|
|
message(" * Build resources : Disabled")
|
|
|
|
endif()
|
2020-01-17 08:56:56 -05:00
|
|
|
|
2020-01-18 08:50:24 -05:00
|
|
|
set(VERSION_EDIT_WARNING "// Do not edit this file, it is automatically generated by CMAKE!")
|
2022-01-17 15:25:16 -05:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/Version.h)
|
2020-12-22 06:38:17 -05:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docker/post_build.sh.in ${CMAKE_CURRENT_BINARY_DIR}/post_build.sh)
|
2019-11-17 14:47:04 -05:00
|
|
|
|
2023-12-17 10:34:00 -05:00
|
|
|
function(AddToListIfEnabled list enabled type)
|
|
|
|
if(${enabled})
|
|
|
|
list(APPEND ${list} ${type})
|
|
|
|
endif ()
|
|
|
|
return(PROPAGATE ${list})
|
|
|
|
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)
|
2020-08-19 15:52:46 -04:00
|
|
|
|
2019-11-17 14:47:04 -05:00
|
|
|
add_subdirectory(src)
|