2020-01-18 22:52:33 +03:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2020-10-27 22:00:06 +03:00
|
|
|
project(pinetime VERSION 0.9.0 LANGUAGES C CXX ASM)
|
2019-11-17 22:47:04 +03:00
|
|
|
|
|
|
|
set(NRF_TARGET "nrf52")
|
|
|
|
|
|
|
|
if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH)
|
2020-10-02 21:43:30 +03: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 22:47:04 +03:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (NOT NRF5_SDK_PATH)
|
2020-01-05 21:55:01 +03: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 22:47:04 +03:00
|
|
|
endif ()
|
|
|
|
|
2020-01-26 21:29:50 +03:00
|
|
|
if(NOT USE_JLINK AND NOT USE_GDB_CLIENT AND NOT USE_OPENOCD)
|
|
|
|
set(USE_JLINK true)
|
|
|
|
endif()
|
2020-01-17 16:56:56 +03: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 18:40:45 +03:00
|
|
|
if(USE_OPENOCD)
|
|
|
|
if(NOT OPENOCD_BIN_PATH)
|
|
|
|
set(OPENOCD_BIN_PATH "openocd")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-03-01 23:00:59 +03:00
|
|
|
if(DEFINED USE_DEBUG_PINS AND USE_DEBUG_PINS)
|
|
|
|
add_definitions(-DUSE_DEBUG_PINS)
|
|
|
|
endif()
|
|
|
|
|
2020-01-17 16:56:56 +03:00
|
|
|
message("BUILD CONFIGURATION")
|
|
|
|
message("-------------------")
|
2020-01-18 16:50:24 +03:00
|
|
|
message(" * Version : " ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
2020-01-17 16:56:56 +03:00
|
|
|
message(" * Toolchain : " ${ARM_NONE_EABI_TOOLCHAIN_PATH})
|
|
|
|
message(" * NRF52 SDK : " ${NRF5_SDK_PATH})
|
|
|
|
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 18:40:45 +03:00
|
|
|
elseif(USE_OPENOCD)
|
2020-01-26 03:38:06 +03:00
|
|
|
message(" * Programmer/debugger : OpenOCD Client")
|
2020-01-17 16:56:56 +03:00
|
|
|
endif()
|
2020-03-01 23:00:59 +03:00
|
|
|
if(USE_DEBUG_PINS)
|
|
|
|
message(" * Debug pins : Enabled")
|
|
|
|
else()
|
|
|
|
message(" * Debug pins : Disabled")
|
|
|
|
endif()
|
2020-01-17 16:56:56 +03:00
|
|
|
|
2020-01-18 16:50:24 +03: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 14:38:17 +03:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docker/post_build.sh.in ${CMAKE_CURRENT_BINARY_DIR}/post_build.sh)
|
2019-11-17 22:47:04 +03:00
|
|
|
|
2020-08-19 22:52:46 +03:00
|
|
|
|
2019-11-17 22:47:04 +03:00
|
|
|
add_subdirectory(src)
|