-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
58 lines (41 loc) · 1.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
cmake_minimum_required (VERSION 2.8.12)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# set the build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE MATCHES Debug)
message("Debug build.")
elseif(CMAKE_BUILD_TYPE MATCHES Release)
message("Release build.")
endif()
# set search path for CMake modules
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
# include OpenOCD module, but make it not required
find_package(OpenOCD)
# Project specific settings
set(application_name "blackpill")
cmake_policy(SET CMP0048 NEW)
project (${application_name} VERSION 1.0.0 LANGUAGES C CXX ASM)
configure_file(${CMAKE_SOURCE_DIR}/src/app/inc/app/version.h.in
${CMAKE_SOURCE_DIR}/src/app/inc/app/version.h)
# platform-specific configurations
include(CMake/platform.cmake)
# STM32-specific settings
set(DEVICE_FAMILY STM32F401xx)
# Speed of external resonator
set(HSE_VALUE 16000000)
# Speed of internal resonator
set(HSI_VALUE 16000000)
# Used linker file (just for testing)
get_filename_component(LINKER_SCRIPT linker/stm32f401rbt6.ld ABSOLUTE)
# Use LTO? WARNING: This might break the code
#set(ADDITIONAL_CORE_FLAGS -flto)
# OpenOCD config file
#get_filename_component(OPENOCD_CONFIG tools/stm32f4discovery.cfg ABSOLUTE)
get_filename_component(OPENOCD_CONFIG tools/stm32f4x-jlink.cfg ABSOLUTE)
# add libraries
add_subdirectory(lib-hal)
add_subdirectory(ThirdParty)
# add main project
add_subdirectory(src)