2020-01-18 14:52:33 -05:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2022-01-07 11:27:43 -05:00
|
|
|
project(pinetime VERSION 1.8.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)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
|
|
|
|
# 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")
|
|
|
|
|
|
|
|
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 ()
|
|
|
|
|
2020-01-17 08:56:56 -05:00
|
|
|
if(USE_JLINK)
|
|
|
|
if (NOT NRFJPROG)
|
|
|
|
message(FATAL_ERROR "the path to the tool nrfjprog must be specified on the command line (add -DNRFJPROG=<path>")
|
|
|
|
endif ()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_GDB_CLIENT)
|
|
|
|
if(NOT GDB_CLIENT_BIN_PATH)
|
|
|
|
set(GDB_CLIENT_BIN_PATH "arm-none-eabi-gdb")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT GDB_CLIENT_TARGET_REMOTE)
|
|
|
|
message(FATAL_ERROR "The GDB target must be specified (add -DGDB_CLIENT_TARGET_REMOTE=<target>")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-01-26 10:40:45 -05:00
|
|
|
if(USE_OPENOCD)
|
|
|
|
if(NOT OPENOCD_BIN_PATH)
|
|
|
|
set(OPENOCD_BIN_PATH "openocd")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-03-01 15:00:59 -05:00
|
|
|
if(DEFINED USE_DEBUG_PINS AND USE_DEBUG_PINS)
|
|
|
|
add_definitions(-DUSE_DEBUG_PINS)
|
|
|
|
endif()
|
|
|
|
|
2021-02-01 15:07:53 -05:00
|
|
|
if(BUILD_DFU)
|
|
|
|
set(BUILD_DFU true)
|
|
|
|
endif()
|
|
|
|
|
2021-09-13 05:41:51 -04:00
|
|
|
option(WATCH_COLMI_P8 "Build for the Colmi P8" OFF)
|
|
|
|
set(TARGET_DEVICE "PineTime")
|
|
|
|
|
|
|
|
if(WATCH_COLMI_P8)
|
|
|
|
set(TARGET_DEVICE "Colmi P8")
|
|
|
|
add_definitions(-DWATCH_P8)
|
|
|
|
endif()
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
string(STRIP ${PROJECT_GIT_COMMIT_HASH} PROJECT_GIT_COMMIT_HASH)
|
|
|
|
|
|
|
|
message("PROJECT_GIT_COMMIT_HASH_SUCCESS? " ${PROJECT_GIT_COMMIT_HASH_SUCCESS})
|
|
|
|
|
2020-01-17 08:56:56 -05:00
|
|
|
message("BUILD CONFIGURATION")
|
|
|
|
message("-------------------")
|
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})
|
2020-01-17 08:56:56 -05:00
|
|
|
set(PROGRAMMER "???")
|
|
|
|
if(USE_JLINK)
|
|
|
|
message(" * Programmer/debugger : JLINK")
|
|
|
|
message(" * NrfJprog : " ${NRFJPROG})
|
|
|
|
elseif(USE_GDB_CLIENT)
|
|
|
|
message(" * Programmer/debugger : GDB Client")
|
|
|
|
message(" * GDB Client path : " ${GDB_CLIENT_BIN_PATH})
|
|
|
|
message(" * GDB Target : " ${GDB_CLIENT_TARGET_REMOTE})
|
2020-01-26 10:40:45 -05:00
|
|
|
elseif(USE_OPENOCD)
|
2020-01-25 19:38:06 -05:00
|
|
|
message(" * Programmer/debugger : OpenOCD Client")
|
2020-01-17 08:56:56 -05:00
|
|
|
endif()
|
2020-03-01 15:00:59 -05:00
|
|
|
if(USE_DEBUG_PINS)
|
|
|
|
message(" * Debug pins : Enabled")
|
|
|
|
else()
|
|
|
|
message(" * Debug pins : Disabled")
|
|
|
|
endif()
|
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()
|
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!")
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/Version.h.in ${CMAKE_CURRENT_SOURCE_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
|
|
|
|
2020-08-19 15:52:46 -04:00
|
|
|
|
2019-11-17 14:47:04 -05:00
|
|
|
add_subdirectory(src)
|