cmake_minimum_required(VERSION 3.13) project(PicoVGA CXX C ASM) set(CMAKE_CXX_STANDARD 20) set(PICO_CXX_ENABLE_EXCEPTIONS 1) #set(PICO_CXX_ENABLE_RTTI 1) MESSAGE (STATUS "System = ${CMAKE_SYSTEM_NAME}") # Linux, PICO MESSAGE (STATUS "CPU = ${CMAKE_SYSTEM_PROCESSOR}") # x86_64, cortex-m0plus if(CMAKE_SYSTEM_NAME STREQUAL "PICO") set(UNIT_TEST OFF) else() set(UNIT_TEST ON) endif() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE -DNDEBUG") #################################################################### # OPTIONS: option(STDIO_USE_UTF8 "use UTF-8 on serial line" ON) set(DEFAULT_SCREENSIZE "640x480" CACHE STRING "Default screen size") set(DEFAULT_COLORMODE "a1w8_rgb" CACHE STRING "Default color mode") set(DEFAULT_SCANLINE_BUFFER_SIZE "4" CACHE STRING "default buffer size for prepared scanlines: save ram or have more sprites") set_property(CACHE DEFAULT_COLORMODE PROPERTY STRINGS i1 i2 i4 i8 a1w8_rgb) set_property(CACHE DEFAULT_SCREENSIZE PROPERTY STRINGS 320x240 400x300 512x384 640x480 800x600 1024x768 640x384 1280x768) set_property(CACHE DEFAULT_SCANLINE_BUFFER_SIZE PROPERTY STRINGS "2" "4" "8" "16") #################################################################### if(CMAKE_SYSTEM_NAME STREQUAL "PICO") include(pico_sdk_import.cmake) include(pico_extras_import.cmake) pico_sdk_init() endif() add_compile_definitions( ON=1 OFF=0 STDIO_USE_UTF8=${STDIO_USE_UTF8} ENABLE_STDIO_UART=${PICO_STDIO_UART} ENABLE_STDIO_USB=${PICO_STDIO_USB} DEFAULT_SCREENSIZE=Video::screensize_${DEFAULT_SCREENSIZE} DEFAULT_COLORMODE=Graphics::colormode_${DEFAULT_COLORMODE} DEFAULT_SCANLINE_BUFFER_SIZE=${DEFAULT_SCANLINE_BUFFER_SIZE} ) add_subdirectory(kilipili) ########################################################################## ## Sprite Demo ## ########################################################################## # add_executable(SpriteDemo # main.cpp # main.h # run_test_video.cpp # run_test_sprites.cpp # run_test_systemclock.cpp # VgaTerminal.h # VgaTerminal.cpp # kilipili/utilities/malloc.cpp # ) # # target_compile_definitions(SpriteDemo PUBLIC # RUN_TEST_SYSTEMCLOCK=1 # RUN_TEST_SPRITES=1 # ) # # pico_enable_stdio_usb(SpriteDemo ${PICO_STDIO_USB}) # pico_enable_stdio_uart(SpriteDemo ${PICO_STDIO_UART}) # # # Pull in libraries: (whatever you need, this also adds the header file search path!) # target_link_libraries(SpriteDemo PRIVATE # kilipili # pico_stdlib # pico_multicore # #hardware_pwm # #hardware_pio # #hardware_dma # #hardware_irq # #hardware_spi # #hardware_interp # #hardware_rtc # #hardware_i2c # #hardware_adc # #hardware_flash # ) # # # create map/bin/hex/uf2 file etc. # pico_add_extra_outputs(SpriteDemo) ########################################################################## ## PicoTerm Terminal ## ########################################################################## if(CMAKE_SYSTEM_NAME STREQUAL "PICO") add_executable(PicoTerm main.cpp main.h VgaTerminal.h VgaTerminal.cpp kilipili/utilities/malloc.cpp ) target_compile_definitions(PicoTerm PUBLIC RUN_PICOTERM=1 ) pico_enable_stdio_usb(PicoTerm ${PICO_STDIO_USB}) pico_enable_stdio_uart(PicoTerm ${PICO_STDIO_UART}) # Pull in libraries: (this also adds the header search paths) target_link_libraries(PicoTerm PUBLIC kilipili pico_stdlib pico_multicore ) # create map/bin/hex/uf2 file etc. pico_add_extra_outputs(PicoTerm) endif() ########################################################################## ## PicoTerm Terminal ## ########################################################################## if(CMAKE_SYSTEM_NAME STREQUAL "PICO") if(${USB_ENABLE_HOST} AND ${USB_ENABLE_KEYBOARD}) add_executable(Console main.cpp main.h Console.h Console.cpp kilipili/utilities/malloc.cpp ) target_compile_definitions(Console PUBLIC RUN_CONSOLE=1 ) #pico_enable_stdio_usb(Console ${PICO_STDIO_USB}) pico_enable_stdio_uart(Console ${PICO_STDIO_UART}) # Pull in libraries: (this also adds the header search paths) target_link_libraries(Console PUBLIC kilipili pico_stdlib pico_multicore #hardware_pwm #hardware_pio #hardware_dma #hardware_irq #hardware_spi #hardware_interp #hardware_rtc #hardware_i2c #hardware_adc #hardware_flash ) # create map/bin/hex/uf2 file etc. pico_add_extra_outputs(Console) endif() endif()