Skip to content

Commit

Permalink
Revert "Add support for configuring examples individually"
Browse files Browse the repository at this point in the history
This reverts commit 129ec66.
  • Loading branch information
will-v-pi committed Feb 5, 2025
1 parent 129ec66 commit fa9d1d3
Show file tree
Hide file tree
Showing 132 changed files with 44 additions and 1,103 deletions.
99 changes: 44 additions & 55 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
# Pull in SDK (must be before project)
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/pico_extras_import_optional.cmake)
# Pull in SDK (must be before project)
include(pico_sdk_import.cmake)
include(pico_extras_import_optional.cmake)

pico_is_top_level_project(PICO_EXAMPLES_TOP_LEVEL_PROJECT)

if (PICO_EXAMPLES_TOP_LEVEL_PROJECT)
project(pico_examples C CXX ASM)
else()
# Go back to individual example for project
return()
endif()
endif()
project(pico_examples C CXX ASM)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -22,7 +13,7 @@ if (PICO_SDK_VERSION_STRING VERSION_LESS "2.1.0")
message(FATAL_ERROR "Raspberry Pi Pico SDK version 2.1.0 (or later) required. Your version is ${PICO_SDK_VERSION_STRING}")
endif()

set(PICO_EXAMPLES_PATH ${CMAKE_CURRENT_LIST_DIR})
set(PICO_EXAMPLES_PATH ${PROJECT_SOURCE_DIR})

# If you want debug output from USB (pass -DPICO_STDIO_USB=1) this ensures you don't lose any debug output while USB is set up
if (NOT DEFINED PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS)
Expand All @@ -32,7 +23,7 @@ endif()
# Initialize the SDK
pico_sdk_init()

include(${CMAKE_CURRENT_LIST_DIR}/example_auto_set_url.cmake)
include(example_auto_set_url.cmake)

function(add_subdirectory_exclude_platforms NAME)
if (ARGN)
Expand All @@ -51,6 +42,13 @@ function(add_subdirectory_exclude_platforms NAME)
add_subdirectory(${NAME})
endfunction()

# Add blink example
add_subdirectory_exclude_platforms(blink)
add_subdirectory_exclude_platforms(blink_simple)

# Add hello world example
add_subdirectory_exclude_platforms(hello_world)

add_compile_options(-Wall
-Wno-format # int != int32_t as far as the compiler is concerned because gcc has int32_t as long int
-Wno-unused-function # we have some for the docs that aren't called
Expand All @@ -59,43 +57,34 @@ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-maybe-uninitialized)
endif()

if (PICO_EXAMPLES_TOP_LEVEL_PROJECT)
# Add blink example
add_subdirectory_exclude_platforms(blink)
add_subdirectory_exclude_platforms(blink_simple)

# Add hello world example
add_subdirectory_exclude_platforms(hello_world)

# Hardware-specific examples in subdirectories:
add_subdirectory(adc)
add_subdirectory(binary_info)
add_subdirectory(bootloaders)
add_subdirectory(clocks)
add_subdirectory(cmake)
add_subdirectory(dcp)
add_subdirectory(divider)
add_subdirectory(dma)
add_subdirectory(flash)
add_subdirectory(gpio)
add_subdirectory(hstx)
add_subdirectory(i2c)
add_subdirectory(interp)
add_subdirectory(multicore)
add_subdirectory(otp)
add_subdirectory(picoboard)
add_subdirectory(pico_w)
add_subdirectory(pio)
add_subdirectory(pwm)
add_subdirectory(reset)
add_subdirectory(rtc)
add_subdirectory(spi)
add_subdirectory(system)
add_subdirectory(timer)
add_subdirectory(uart)
add_subdirectory(universal)
add_subdirectory(usb)
add_subdirectory(watchdog)
add_subdirectory(sha)
add_subdirectory(freertos)
endif()
# Hardware-specific examples in subdirectories:
add_subdirectory(adc)
add_subdirectory(binary_info)
add_subdirectory(bootloaders)
add_subdirectory(clocks)
add_subdirectory(cmake)
add_subdirectory(dcp)
add_subdirectory(divider)
add_subdirectory(dma)
add_subdirectory(flash)
add_subdirectory(gpio)
add_subdirectory(hstx)
add_subdirectory(i2c)
add_subdirectory(interp)
add_subdirectory(multicore)
add_subdirectory(otp)
add_subdirectory(picoboard)
add_subdirectory(pico_w)
add_subdirectory(pio)
add_subdirectory(pwm)
add_subdirectory(reset)
add_subdirectory(rtc)
add_subdirectory(spi)
add_subdirectory(system)
add_subdirectory(timer)
add_subdirectory(uart)
add_subdirectory(universal)
add_subdirectory(usb)
add_subdirectory(watchdog)
add_subdirectory(sha)
add_subdirectory(freertos)
8 changes: 0 additions & 8 deletions adc/adc_console/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(adc_console C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(adc_console
adc_console.c
)
Expand Down
8 changes: 0 additions & 8 deletions adc/dma_capture/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(dma_capture C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(adc_dma_capture
dma_capture.c
)
Expand Down
8 changes: 0 additions & 8 deletions adc/hello_adc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(hello_adc C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(hello_adc
hello_adc.c
)
Expand Down
8 changes: 0 additions & 8 deletions adc/joystick_display/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(joystick_display C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(joystick_display
joystick_display.c
)
Expand Down
8 changes: 0 additions & 8 deletions adc/microphone_adc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(microphone_adc C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(microphone_adc
microphone_adc.c
)
Expand Down
8 changes: 0 additions & 8 deletions adc/onboard_temperature/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(onboard_temperature C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(onboard_temperature onboard_temperature.c)

target_link_libraries(onboard_temperature pico_stdlib hardware_adc)
Expand Down
8 changes: 0 additions & 8 deletions adc/read_vsys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(read_vsys C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_library(power_status_adc INTERFACE)
target_sources(power_status_adc INTERFACE
${CMAKE_CURRENT_LIST_DIR}/power_status.c
Expand Down
8 changes: 0 additions & 8 deletions binary_info/blink_any/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(blink_any C CXX ASM)
include(../../CMakeLists.txt)
endif()

if (NOT PICO_CYW43_SUPPORTED)
message("Only building blink_any for non W boards as PICO_CYW43_SUPPORTED is not set")
endif()
Expand Down
8 changes: 0 additions & 8 deletions binary_info/hello_anything/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(hello_anything C CXX ASM)
include(../../CMakeLists.txt)
endif()

if (TARGET tinyusb_device)
add_executable(hello_anything
hello_anything.c
Expand Down
8 changes: 0 additions & 8 deletions blink/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../CMakeLists.txt)
project(blink C CXX ASM)
include(../CMakeLists.txt)
endif()

add_executable(blink
blink.c
)
Expand Down
8 changes: 0 additions & 8 deletions blink_simple/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../CMakeLists.txt)
project(blink_simple C CXX ASM)
include(../CMakeLists.txt)
endif()

add_executable(blink_simple
blink_simple.c
)
Expand Down
8 changes: 0 additions & 8 deletions bootloaders/encrypted/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(encrypted C CXX ASM)
include(../../CMakeLists.txt)
endif()

# Encrypted Bootloader
add_executable(enc_bootloader
enc_bootloader.c
Expand Down
8 changes: 0 additions & 8 deletions clocks/detached_clk_peri/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(detached_clk_peri C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(clocks_detached_clk_peri
detached_clk_peri.c
)
Expand Down
8 changes: 0 additions & 8 deletions clocks/hello_48MHz/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(hello_48MHz C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(hello_48MHz
hello_48MHz.c
)
Expand Down
8 changes: 0 additions & 8 deletions clocks/hello_gpout/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(hello_gpout C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(hello_gpout
hello_gpout.c
)
Expand Down
8 changes: 0 additions & 8 deletions clocks/hello_resus/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(hello_resus C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(hello_resus
hello_resus.c
)
Expand Down
8 changes: 0 additions & 8 deletions cmake/build_variants/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(build_variants C CXX ASM)
include(../../CMakeLists.txt)
endif()

# 1 Create an INTERFACE library aggregating all the common parts of the application
add_library(common_stuff INTERFACE)

Expand Down
8 changes: 0 additions & 8 deletions dcp/hello_dcp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(hello_dcp C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(hello_dcp
hello_dcp.c
dcp_examples.S
Expand Down
8 changes: 0 additions & 8 deletions divider/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../CMakeLists.txt)
project(divider C CXX ASM)
include(../CMakeLists.txt)
endif()

if (TARGET hardware_divider)
add_executable(hello_divider
hello_divider.c
Expand Down
8 changes: 0 additions & 8 deletions dma/channel_irq/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(channel_irq C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(dma_channel_irq
channel_irq.c
)
Expand Down
8 changes: 0 additions & 8 deletions dma/control_blocks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(control_blocks C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(dma_control_blocks
control_blocks.c
)
Expand Down
8 changes: 0 additions & 8 deletions dma/hello_dma/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
cmake_minimum_required(VERSION 3.12)

if (NOT CMAKE_PROJECT_NAME)
include(../../CMakeLists.txt)
project(hello_dma C CXX ASM)
include(../../CMakeLists.txt)
endif()

add_executable(hello_dma
hello_dma.c
)
Expand Down
Loading

0 comments on commit fa9d1d3

Please sign in to comment.