-
Notifications
You must be signed in to change notification settings - Fork 16
/
CMakeLists.txt
57 lines (46 loc) · 1.54 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
project(codal-nrf52)
string(FIND "${device.processor}" "NRF52840" pos40)
string(FIND "${device.processor}" "NRF52833" pos33)
if (NOT "${pos40}" STREQUAL "-1")
set(TEMPLATE "nRF52840")
set(DEV "nrf52840")
else()
if (NOT "${pos33}" STREQUAL "-1")
set(TEMPLATE "nRF52833")
set(DEV "nrf52833")
else()
set(TEMPLATE "nRF52832")
set(DEV "nrf52")
endif()
endif()
include("${CODAL_UTILS_LOCATION}")
# find sources and headers
RECURSIVE_FIND_FILE(SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/source" "*.c??")
list(APPEND INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/inc"
"${CMAKE_CURRENT_SOURCE_DIR}/inc/cmsis"
"${CMAKE_CURRENT_SOURCE_DIR}/nrfx/mdk"
"${CMAKE_CURRENT_SOURCE_DIR}/nrfx"
"${CMAKE_CURRENT_SOURCE_DIR}/nrfx/templates/"
"${CMAKE_CURRENT_SOURCE_DIR}/nrfx/templates/${TEMPLATE}"
"${CMAKE_CURRENT_SOURCE_DIR}/nrfx/drivers/include"
"${CMAKE_CURRENT_SOURCE_DIR}/nrfx/drivers/src"
)
list(APPEND SOURCE_FILES "asm/CortexContextSwitch.s")
list(APPEND SOURCE_FILES "nrfx/mdk/system_${DEV}.c")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/nrfx_mods/mdk/gcc_startup_${DEV}.S")
list(APPEND SOURCE_FILES "nrfx_mods/mdk/gcc_startup_${DEV}.S")
else()
list(APPEND SOURCE_FILES "nrfx/mdk/gcc_startup_${DEV}.S")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNRFX_PRS_ENABLED=0")
# add them
include_directories(${INCLUDE_DIRS})
# create our target
add_library(codal-nrf52 ${SOURCE_FILES})
target_link_libraries(
codal-nrf52
codal-core
)
# expose it to parent cmake.
target_include_directories(codal-nrf52 PUBLIC ${INCLUDE_DIRS})