view CMakeLists.txt @ 30:92fdf2ef995d default tip

Use 32 bit rather than 16 bit ints for loop vars. No risk of overflow and is actually faster.
author Daniel O'Connor <darius@dons.net.au>
date Thu, 27 Feb 2025 15:24:17 +1030
parents 56a79dce90e9
children
line wrap: on
line source

cmake_minimum_required(VERSION 3.12)

# Change your executable name to something creative!
set(NAME modulator)

include(pico_sdk_import.cmake)
include(local.cmake)

# Gooey boilerplate
project(${NAME} C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

# Initialize the SDK
pico_sdk_init()

add_executable(${NAME}
    modulator.c
    q/q.c
    )

# Bring the pain
set_source_files_properties(modulator.c PROPERTIES COMPILE_OPTIONS -Wall -Wextra -Werror)
set_source_files_properties(q/q.c PROPERTIES COMPILE_OPTIONS -DQVERSION=0x902)
# XXX: this didn't work - everything got the flags
#target_compile_options(${NAME} PRIVATE -Wall -Wextra -Werror)

pico_generate_pio_header(${NAME} ${CMAKE_CURRENT_LIST_DIR}/dac.pio)
pico_generate_pio_header(${NAME} ${CMAKE_CURRENT_LIST_DIR}/ctrl.pio)
pico_generate_pio_header(${NAME} ${CMAKE_CURRENT_LIST_DIR}/trigger.pio)

target_link_libraries(${NAME}
		pico_stdlib
		hardware_clocks
		hardware_dma
		hardware_interp
		hardware_irq
		hardware_pio
		hardware_pwm
)

#bin2elf(${NAME} shaped-trap.dat)
#bin2elf(${NAME} sgauss.dat)

# create map/bin/hex file etc.
pico_add_extra_outputs(${NAME})

# Set up files for the release packages
install(FILES
    ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.uf2
    DESTINATION .
)

set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_GENERATOR "ZIP" "TGZ")
include(CPack)