-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
58 lines (46 loc) · 1.68 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 3.12)
# initialize pico-sdk from submodule
# note: this must happen before project()
include(external/pico-sdk/pico_sdk_init.cmake)
project(dc32_badge C CXX ASM) # Name of project, can have multiple targets.
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
# Create files for CCLS to use for code completion.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
# Require Pico SDK version 2.0.0 - uses the rp2350 chip.
if (PICO_SDK_VERSION_STRING VERSION_LESS "2.0.0")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 2.0.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif()
# Initialize the SDK
pico_sdk_init()
# Add compiler flags:
add_compile_options(-Wall # Enable all warnings
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-Og) # Enable debug optimizations
else()
add_compile_options(-O3) # Enable speed optimizations
endif()
# Target: Create an executable
add_executable(dc32_badge
${CMAKE_CURRENT_LIST_DIR}/src/main.c
${CMAKE_CURRENT_LIST_DIR}/src/HSV2RGB.c
)
target_include_directories(dc32_badge PUBLIC
${CMAKE_CURRENT_LIST_DIR}/src
)
# Generate the PIO header files
pico_generate_pio_header(dc32_badge ${CMAKE_CURRENT_LIST_DIR}/src/ws2812.pio)
# Pull in common dependencies
target_link_libraries(
dc32_badge
pico_stdlib
pico_multicore
hardware_gpio
hardware_pio
)
# Create map/bin/hex file etc.
pico_add_extra_outputs(dc32_badge)