-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
110 lines (91 loc) · 2.52 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
cmake_minimum_required(VERSION 3.13)
set(dir ${CMAKE_CURRENT_LIST_DIR})
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
endif ()
if (PICO_SDK_PATH)
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
project(demo C CXX ASM)
pico_sdk_init()
set(CMAKE_CXX_FLAGS "-Ofast -Wall -mcpu=cortex-m0plus -mtune=cortex-m0plus")
add_library(codec2 STATIC
${dir}/src/sine.c
${dir}/src/codec2.c
${dir}/src/phase.c
${dir}/src/quantise.c
${dir}/src/helpers.c
${dir}/src/tables.c
${dir}/src/cmsis
${dir}/src/cmsis/arm_cfft_radix4_q31.c
${dir}/src/cmsis/arm_bitreversal2.S
${dir}/src/cmsis/arm_rfft_init_q31.c
${dir}/src/cmsis/arm_cfft_q31.c
${dir}/src/cmsis/arm_shift_q31.c
${dir}/src/cmsis/arm_bitreversal.c
${dir}/src/cmsis/arm_rfft_q31.c
${dir}/src/interpolate.c
)
add_executable(demo
${dir}/src/demo/demo-pico.c
)
target_link_libraries(demo
codec2
pico_stdlib
hardware_divider
hardware_dma
hardware_pwm
)
target_link_options(demo PRIVATE
-Xlinker
--print-memory-usage
)
pico_enable_stdio_uart(demo 0)
pico_enable_stdio_usb(demo 1)
pico_set_float_implementation(demo pico)
pico_set_double_implementation(demo pico)
pico_add_extra_outputs(demo)
target_include_directories(demo PRIVATE
${dir}/header/
${dir}/header/cmsis/
$ENV{PICO_SDK_PATH}/src/common/pico_base/include/
$ENV{PICO_SDK_PATH}/rp2_common/hardware_dma/include/
$ENV{PICO_SDK_PATH}/rp2_common/hardware_pwm/include/
)
else ()
project(demo C CXX ASM)
set(CMAKE_CXX_FLAGS "-Ofast -Wall")
add_library(codec2 STATIC
${dir}/src/sine.c
${dir}/src/codec2.c
${dir}/src/phase.c
${dir}/src/quantise.c
${dir}/src/helpers.c
${dir}/src/tables.c
${dir}/src/cmsis
${dir}/src/cmsis/arm_cfft_radix4_q31.c
${dir}/src/cmsis/arm_bitreversal2.c
${dir}/src/cmsis/arm_rfft_init_q31.c
${dir}/src/cmsis/arm_cfft_q31.c
${dir}/src/cmsis/arm_shift_q31.c
${dir}/src/cmsis/arm_bitreversal.c
${dir}/src/cmsis/arm_rfft_q31.c
${dir}/src/interpolate.c
)
add_executable(demo
${dir}/src/demo/demo-host.c
)
target_include_directories(demo PRIVATE
${dir}/header/
${dir}/header/cmsis/
)
target_link_libraries(demo codec2)
endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
target_link_options(codec2 PRIVATE)
target_include_directories(codec2 PUBLIC
${dir}/header/
${dir}/header/cmsis/
)