-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
120 lines (94 loc) · 3.07 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
# == DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work ==
if(WIN32)
set(USERHOME $ENV{USERPROFILE})
else()
set(USERHOME $ENV{HOME})
endif()
set(sdkVersion 2.0.0)
set(toolchainVersion 13_2_Rel1)
set(picotoolVersion 2.0.0)
set(picoVscode ${USERHOME}/.pico-sdk/cmake/pico-vscode.cmake)
if (EXISTS ${picoVscode})
include(${picoVscode})
endif()
# ====================================================================================
cmake_minimum_required(VERSION 3.13)
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
set(PICO_BOARD pico_w)
include(pico_sdk_import.cmake)
project(pico_asha C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(PICO_ASHA_VERSION "0.1.0-dev")
pico_sdk_init()
message("Pico SDK version is ${PICO_SDK_VERSION_STRING}")
if(PICO_SDK_VERSION_STRING VERSION_LESS "2.0.0")
message( FATAL_ERROR "Pico SDK version must be 2.0.0 or greater" )
endif()
Include(FetchContent)
FetchContent_Declare(
etl
GIT_REPOSITORY https://github.com/ETLCPP/etl
GIT_TAG 20.38.17
)
FetchContent_MakeAvailable(etl)
FetchContent_Declare(ArduinoJson
GIT_REPOSITORY https://github.com/bblanchon/ArduinoJson.git
GIT_TAG v7.1.0
)
FetchContent_MakeAvailable(ArduinoJson)
set(ASHA_SRC
src/main.cpp
src/runtime_settings.cpp
src/asha_audio.cpp
src/asha_bt.cpp
src/asha_logging.cpp
src/asha_led.cpp
src/hearing_aid.cpp
src/usb_descriptors.cpp
src/usb_audio.cpp
src/btstack_ad_dump.c
src/util.cpp
lib/g722/g722_encode.cc
)
set_source_files_properties(${ASHA_SRC} PROPERTIES COMPILE_OPTIONS "-Wall;-Wextra;-Werror")
add_executable(pico_asha ${ASHA_SRC})
target_include_directories(pico_asha PUBLIC src/ lib/)
option(ENABLE_BLE_AD_DUMP "Enable dumping of advertisement packet data" OFF)
option(ENABLE_UAC2_LOG "Enable USB logging" OFF)
option(ENABLE_PAIR_DEL "Delete all HA pairings" OFF)
list(APPEND pico_asha_defines "PICO_ASHA_VERS=\"${PICO_ASHA_VERSION}\"")
list(APPEND pico_asha_defines "PICO_STDIO_USB_ENABLE_RESET_VIA_BAUD_RATE=1")
pico_enable_stdio_usb(pico_asha 1)
pico_enable_stdio_uart(pico_asha 1)
list(APPEND pico_asha_defines "PICO_FLASH_BANK_TOTAL_SIZE=(FLASH_SECTOR_SIZE * 8u)")
if(ENABLE_BLE_AD_DUMP)
list(APPEND pico_asha_defines "ASHA_AD_DUMP")
endif()
if (ENABLE_UAC2_LOG)
list(APPEND pico_asha_defines "CFG_TUSB_DEBUG=1")
endif()
if(ENABLE_PAIR_DEL)
list(APPEND pico_asha_defines "ASHA_DELETE_PAIRINGS")
endif()
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wdeprecated-enum-enum-conversion HAVE_DEP_ENNUM_ENUM_CONV)
if (HAVE_DEP_ENNUM_ENUM_CONV)
target_compile_options(pico_asha PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>)
endif (HAVE_DEP_ENNUM_ENUM_CONV)
target_compile_definitions(pico_asha PUBLIC ${pico_asha_defines})
pico_add_extra_outputs(pico_asha)
target_link_libraries(pico_asha
pico_stdlib
pico_btstack_ble
pico_btstack_cyw43
pico_cyw43_arch_none
pico_multicore
tinyusb_device
tinyusb_board
etl::etl
ArduinoJson
)
target_link_options(pico_asha PUBLIC -Wl,--print-memory-usage)