-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
86 lines (65 loc) · 3.02 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
cmake_minimum_required(VERSION 3.26)
# Set environment variables
# I prefer setting this here instead of in .bashrc or other OS-specific file. Basically, you just need to make sure
# to set your PICO_SDK_PATH environment variable to the location of the Pico SDK on your system.
set(ENV{PICO_SDK_PATH} "/home/cbmeeks/sdk/pico/pico-sdk")
# Include build functions from Pico SDK
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
include($ENV{PICO_SDK_PATH}/tools/CMakeLists.txt)
# Set the name of the project (as PROJECT_NAME) and C/C++ standards
project(VgaPico C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Creates a pico-sdk subdirectory in our project for the libraries
pico_sdk_init()
# Tell CMake where to find the executable source file
add_executable(${PROJECT_NAME}
sprite.c
vga_graphics.c
vga_base.h
demo.c
bit_helper.h
sprite.h
images/player.h
images/rock.h
images/grinch.h
images/metroid.h
images/grinch2.h
images/grinch3.h
images/robocop.h
images/tree1.h
images/tree2.h
images/sb.h
)
# by default the header is generated into the build dir
# however, alternatively you can choose to generate it somewhere else (in this case in the source tree for check in)
# HSYNC and VSYNC are the same in all versions. Only the RGB PIO needs to change for each resolution.
# TODO, look at making this more dynamic and changeable within the code
pico_generate_pio_header(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/pio/hsync.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/pio)
pico_generate_pio_header(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/pio/vsync.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/pio)
# Build the rgb_640 version.
# pico_generate_pio_header(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/pio/rgb_640/rgb.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/pio)
# Build the rgb_320 version.
pico_generate_pio_header(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/pio/rgb_320/rgb.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/pio)
# Build the rgb_160 version.
# pico_generate_pio_header(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/pio/rgb_160/rgb.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/pio)
# Build the rgb_80 version.
# pico_generate_pio_header(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/pio/rgb_80/rgb.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/pio)
# Build the rgb_40 version.
# pico_generate_pio_header(${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/pio/rgb_40/rgb.pio OUTPUT_DIR ${CMAKE_CURRENT_LIST_DIR}/pio)
# Create map/bin/hex/uf2 files
pico_add_extra_outputs(${PROJECT_NAME})
# must match with executable name and source file names
target_sources(${PROJECT_NAME} PRIVATE demo.c vga_graphics.c)
# Link to libraries (gpio, time, etc. functions)
target_link_libraries(${PROJECT_NAME}
pico_multicore
pico_stdlib
hardware_adc
hardware_dma
hardware_irq
hardware_pio
)
# Enable USB output, disable UART output
pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0)