forked from InfiniTimeOrg/InfiniTime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
107 lines (86 loc) · 3.29 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
cmake_minimum_required(VERSION 3.10)
project(pinetime VERSION 1.8.0 LANGUAGES C CXX ASM)
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)
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(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()
if(USE_OPENOCD)
if(NOT OPENOCD_BIN_PATH)
set(OPENOCD_BIN_PATH "openocd")
endif()
endif()
if(DEFINED USE_DEBUG_PINS AND USE_DEBUG_PINS)
add_definitions(-DUSE_DEBUG_PINS)
endif()
if(BUILD_DFU)
set(BUILD_DFU true)
endif()
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()
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("BUILD CONFIGURATION")
message("-------------------")
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})
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})
elseif(USE_OPENOCD)
message(" * Programmer/debugger : OpenOCD Client")
endif()
if(USE_DEBUG_PINS)
message(" * Debug pins : Enabled")
else()
message(" * Debug pins : Disabled")
endif()
if(BUILD_DFU)
message(" * Build DFU (using adafruit-nrfutil) : Enabled")
else()
message(" * Build DFU (using adafruit-nrfutil) : 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_SOURCE_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)