diff --git a/CMakeLists.txt b/CMakeLists.txt index 45560d7..599da40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ if (PICO_SDK_VERSION_STRING VERSION_LESS "1.5.0") message(FATAL_ERROR "Raspberry Pi Pico SDK version 1.5.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}") endif() -project(raspi_keyer C CXX ASM) +project(raspi_keyer VERSION "0.0.1" LANGUAGES C CXX ASM) # Initialise the Raspberry Pi Pico SDK pico_sdk_init() @@ -29,7 +29,7 @@ add_executable(raspi_keyer) add_subdirectory(src) pico_set_program_name(raspi_keyer "raspi_keyer") -pico_set_program_version(raspi_keyer "0.0.1") +pico_set_program_version(raspi_keyer ${PROJECT_VERSION}) pico_enable_stdio_uart(raspi_keyer 1) pico_enable_stdio_usb(raspi_keyer 0) @@ -46,11 +46,6 @@ target_include_directories(raspi_keyer PRIVATE ${CMAKE_CURRENT_LIST_DIR}/.. # for our common lwipopts or any other standard includes, if required ) -# Make sure TinyUSB can find tusb_config.h -target_include_directories(raspi_keyer PUBLIC - ${CMAKE_CURRENT_LIST_DIR}/src -) - # Add any user requested libraries target_link_libraries(raspi_keyer hardware_flash @@ -61,8 +56,6 @@ target_link_libraries(raspi_keyer hardware_adc tinyusb_device tinyusb_board - #hardware_pio - #hardware_uart ) pico_add_extra_outputs(raspi_keyer) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 74e638f..887f394 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,16 @@ +configure_file(config.h.in config.h @ONLY) + +# Make sure TinyUSB can find tusb_config.h +target_include_directories(raspi_keyer PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) + +# Make sure the compiler can find the +# generated config.h +target_include_directories(raspi_keyer PUBLIC + ${CMAKE_CURRENT_BINARY_DIR} +) + target_sources(raspi_keyer PRIVATE raspi_keyer.cpp settings.cpp diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..eca4837 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,3 @@ +#pragma once + +#cmakedefine PROJECT_VERSION "@PROJECT_VERSION@" \ No newline at end of file diff --git a/src/raspi_keyer.cpp b/src/raspi_keyer.cpp index f50d3a6..1d223ed 100644 --- a/src/raspi_keyer.cpp +++ b/src/raspi_keyer.cpp @@ -10,6 +10,7 @@ #include "keyer.h" #include "settings.h" +#include #include "tusb_config.h" namespace @@ -199,7 +200,7 @@ int main() board_init(); tud_init(BOARD_TUD_RHPORT); - printf("Hello from core0!\n"); + printf("RaspiKeyer Version %s\n", PROJECT_VERSION); queue_init(&keyerQueue, sizeof(KeyerQueueData), 2); multicore_reset_core1();