-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
58 lines (44 loc) · 2.08 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(SQUIRREL-pico 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 1.3.0
if (PICO_SDK_VERSION_STRING VERSION_LESS "1.3.0")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.3.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(-Os) # Enable size optimizations
endif()
# Target: Create an executable
add_executable(SQUIRREL-pico # Name of executable and target.
${CMAKE_CURRENT_LIST_DIR}/src/main.c # Entrypoint
)
# Add USB configuration files
target_sources(SQUIRREL-pico PUBLIC
${CMAKE_CURRENT_LIST_DIR}/src/tinyusb/usb_descriptors.c # Use USB descriptors in target and dependencies.
)
target_include_directories(SQUIRREL-pico PUBLIC
${CMAKE_CURRENT_LIST_DIR}/src/tinyusb) # Include tinyusb headers in target and dependencies.
include_directories(${CMAKE_CURRENT_LIST_DIR}/external/squirrel/include) # Include SQUIRREL headers in target and dependencies.
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/external/squirrel) # Add SQUIRREL as a subdirectory. This will build the library.
# Pull in common dependencies
target_link_libraries(SQUIRREL-pico squirrel pico_stdlib pico_unique_id tinyusb_device tinyusb_board pico_multicore hardware_gpio)
# Enable UART outpur
pico_enable_stdio_uart(SQUIRREL-pico 1)
# Create map/bin/hex file etc.
pico_add_extra_outputs(SQUIRREL-pico)