-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
200 lines (154 loc) · 5.44 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#-----------------------------------------------------------------------------
#
# CMakeLists for lnDSO
# An opensource firmware for the DSO SHELL 150
# With optional hardware mods :
# - Alternative rotary encoder wiring : MUCH Better, almost mandatory
#
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.0)
MESSAGE(STATUS "===============")
MESSAGE(STATUS "Starting lnDSO")
MESSAGE(STATUS "===============")
cmake_policy(SET CMP0079 NEW)
#____________________
# Options
#____________________
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(LN_ENABLE_I2C OFF CACHE INTERNAL "")
SET(LN_ENABLE_SPI OFF CACHE INTERNAL "")
OPTION(USE_ROTARY_FULL_STEP "Use full step for rotary encoder, else half step" FALSE)
OPTION(USE_USB "Enable USB support" FALSE)
OPTION(USE_SMALLFOOTPRINT "Build for 64k flash targets" FALSE)
OPTION(USE_FNIRSI_BUTTON "Use FNIRSI button layout" FALSE)
IF(USE_NO_DEFAULT)
ELSE(USE_NO_DEFAULT)
include(./build_default.cmake)
ENDIF(USE_NO_DEFAULT)
SET(LN_USB_NB_CDC 1 CACHE INTERNAL "")
SET(LN_USB_NB_HID 0 CACHE INTERNAL "")
SET(LN_USB_DFU_RUNTIME 1 CACHE INTERNAL "")
SET(LN_ENABLE_I2C FALSE CACHE INTERNAL "")
SET(LN_ENABLE_SPI TRUE CACHE INTERNAL "")
IF(LN_ENABLE_USBD)
ADD_DEFINITIONS("-DSTM32F103xB")
SET(LN_ENABLE_USBD True CACHE INTERNAL "")
ENDIF()
SET(AF_FOLDER ${CMAKE_SOURCE_DIR}/lnArduino/)
include(./mcuSelect.cmake)
SET(CMAKE_TOOLCHAIN_FILE ${AF_FOLDER}/lnArduino.cmake)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${AF_FOLDER}/cmake CACHE INTERNAL "")
include(./FindGitSvn.cmake)
SET(CMAKE_TOOLCHAIN_FILE ${AF_FOLDER}/lnArduino.cmake)
PROJECT(lnDSO NONE) # the NONE is very important !
enable_language(C CXX ASM) # this is important too!
#
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/include)
SET(LN_INITIAL_STACK_SIZE 1600 CACHE INTERNAL "")
SET(LN_INITIAL_TASK_PRIORITY 4 CACHE INTERNAL "")
add_subdirectory(${AF_FOLDER})
include(${AF_FOLDER}/setup.cmake)
admGetGitRevision(${CMAKE_SOURCE_DIR} git_rev)
SET(EXTENSION "_${LN_MCU}")
IF(USE_VANILLA_HW)
SET(EXTENSION "${EXTENSION}_vanilla")
ELSE(USE_VANILLA_HW)
ADD_DEFINITIONS("-DUSE_RXTX_PIN_FOR_ROTARY")
SET(EXTENSION "${EXTENSION}_mod")
ENDIF(USE_VANILLA_HW)
IF(USE_FNIRSI_BUTTON)
SET(EXTENSION "${EXTENSION}_fnirsi")
SET(USE_ROTARY_FULL_STEP True CACHE INTERNAL "")
ENDIF()
IF(USE_ROTARY_FULL_STEP)
SET(EXTENSION "${EXTENSION}_fstep")
ELSE(USE_ROTARY_FULL_STEP)
ADD_DEFINITIONS("-DDSO_ROTARY_FULL_STEP")
SET(EXTENSION "${EXTENSION}_hstep")
ENDIF(USE_ROTARY_FULL_STEP)
math(EXPR MCU_SPEED_M "${LN_MCU_SPEED}/1000000")
SET(EXTENSION "${EXTENSION}_${MCU_SPEED_M}M")
include_directories(src)
#_______________________
# FPU
#_______________________
IF("${LN_ARCH}" STREQUAL "RISCV")
SET(FP_LIB rvfp)
ELSEIF("${LN_ARCH}" STREQUAL "ARM")
IF("${LN_MCU}" STREQUAL "M3")
SET(FP_LIB qfpm3)
ENDIF("${LN_MCU}" STREQUAL "M3")
ENDIF("${LN_ARCH}" STREQUAL "RISCV")
ADD_SUBDIRECTORY(fp)
include_directories(fp)
# FreeRTOS
SET(USE_TRIGGER True)
#_______________________
# Display
#_______________________
IF(USE_SMALLFOOTPRINT)
SET(EXTENSION "${EXTENSION}_small")
ELSE()
SET(DSO_EXTRA_LIB simplerILI9341HS)
SET(SIMPLER_ILI9341_FONT_COMPRESSION ON CACHE INTERNAL "")
SET(SIMPLER_ILI9341_2BPP_SUPPORT ON CACHE INTERNAL "")
ENDIF()
include_directories(externals/simplerILI9341/cpp/platformExample/lnArduino)
SET(ILI9341_DRIVER platformExample/lnArduino/ili_ln8bits.cpp)
ADD_SUBDIRECTORY(externals/simplerILI9341/cpp)
include_directories(externals/simplerILI9341/cpp)
#target_link_libraries(simplerILI9341 PRIVATE lnArduino)
#
include_directories(capture)
USE_LIBRARY(NeVerMind)
ADD_SUBDIRECTORY(assets)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(capture)
#ADD_SUBDIRECTORY(testFunc)
#
IF(LN_ENABLE_USBD)
USE_LIBRARY(tinyUsb)
SET(EXTENSION "${EXTENSION}_USB")
ENDIF(LN_ENABLE_USBD)
IF(LN_ENABLE_USBD)
SET(NPB ${CMAKE_SOURCE_DIR}/externals/nanopb)
include_directories( ${NPB} )
#ADD_LIBRARY(nanopb ${NPB}/pb_decode.c ${NPB}/pb_encode.c )
ADD_SUBDIRECTORY( ${NPB} )
ENDIF(LN_ENABLE_USBD)
IF(USE_CLANG)
SET(EXTENSION "${EXTENSION}_CLANG")
ELSE()
SET(EXTENSION "${EXTENSION}_GCC")
ENDIF()
#____________________
# Build
#____________________
GENERATE_GD32_FIRMWARE(lnDSO)
TARGET_LINK_LIBRARIES( lnDSO captureLib )
TARGET_LINK_LIBRARIES( lnDSO sourceLib )
IF(LN_ENABLE_USBD)
TARGET_LINK_LIBRARIES( lnDSO nanopb)
ENDIF()
TARGET_LINK_LIBRARIES( lnDSO simplerILI9341 ${DSO_EXTRA_LIB} assets ${FP_LIB} )
HASH_GD32_FIRMWARE(lnDSO)
# Summary
MESSAGE(STATUS "Configuration:")
MESSAGE(STATUS "\tBuild folder ${CMAKE_BINARY_DIR}")
MESSAGE(STATUS "\tUsing ${LN_MCU} based MCU at ${LN_MCU_SPEED} Hz")
MESSAGE(STATUS "\tUsing ${LN_MCU_FLASH_SIZE} kB of flash (small = ${USE_SMALLFOOTPRINT})")
MESSAGE(STATUS "\tUSB control enabled : ${LN_ENABLE_USBD}")
if(USE_VANILLA_HW)
MESSAGE(STATUS "\tUsing vanilla HW")
else(USE_VANILLA_HW)
MESSAGE(STATUS "\tUsing rotary encoder modification (PB14/PB15) ")
endif(USE_VANILLA_HW)
IF(USE_ROTARY_FULL_STEP)
MESSAGE(STATUS "\tUsing rotary encoder Full step ")
ELSE()
MESSAGE(STATUS "\tUsing rotary encoder Half step ")
ENDIF()
#
set_target_properties(lnDSO PROPERTIES OUTPUT_NAME lnDSO${EXTENSION})
MESSAGE(STATUS "\tFinal name is ${EXTENSION}")