-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
103 lines (83 loc) · 3.64 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
# CMakeLists.txt
#
# Copyright (c) 2022 Daniel Collins
#
# This file is part of rp2040_i2s_example.
#
# rp2040_i2s_example is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License, version 3 as published by the
# Free Software Foundation.
#
# rp2040_i2s_example is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.
#
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# rp2040_i2s_example. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Set standard CMake build type options
## Default C compiler flags
set(CMAKE_C_FLAGS_DEBUG_INIT "-g3 -Og -Wall -Wextra -DDEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -Wall")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -Wall")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -Wall")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "" FORCE)
## Default C++ compiler flags
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g3 -Og -Wall -Wextra -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -Wall")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g -Wall")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "" FORCE)
# Pull in Raspberry Pi Pico SDK (must be before project)
include(pico_sdk_import.cmake)
project(i2s_example C CXX ASM )
pico_sdk_init()
# Add -fpermissive to compiler options
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpermissive")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
set(WIZNET_DIR ${CMAKE_SOURCE_DIR}/RP2040-HAT-C/libraries/ioLibrary_Driver)
set(MBEDTLS_DIR ${CMAKE_SOURCE_DIR}/RP2040-HAT-C/libraries/mbedtls)
set(PORT_DIR ${CMAKE_SOURCE_DIR}/RP2040-HAT-C/port)
add_subdirectory(RP2040-HAT-C)
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
add_executable(i2s_example)
target_sources(i2s_example PRIVATE i2s_example.cpp core1.cpp daes67/src/histogram.cpp daes67/src/log.cpp)
target_include_directories(i2s_example PRIVATE ${CMAKE_CURRENT_LIST_DIR}/daes67/include)
pico_generate_pio_header(i2s_example ${CMAKE_CURRENT_LIST_DIR}/i2s.pio)
add_custom_target(i2s_example_dis ALL
COMMAND ${CMAKE_OBJDUMP} -d -S $<TARGET_FILE:i2s_example> > i2s_example.dis2
DEPENDS i2s_example
)
pico_set_program_name(i2s_example "i2s_test")
pico_set_program_version(i2s_example "1.0.1")
# no_flash means the target is to run from RAM
# pico_set_binary_type(i2s_example no_flash)
pico_enable_stdio_uart(i2s_example 1)
pico_enable_stdio_usb(i2s_example 0)
# Add the standard library to the build
target_link_libraries(i2s_example pico_stdlib)
# Add any user requested libraries
target_link_libraries(i2s_example
hardware_i2c
hardware_dma
hardware_pio
hardware_clocks
hardware_flash
hardware_sync
hardware_spi
pico_multicore
ETHERNET_FILES
IOLIBRARY_FILES
HTTPSERVER_FILES
)
pico_add_extra_outputs(i2s_example)