Skip to content

Commit accc3fd

Browse files
authored
Merge pull request hathach#2151 from kilograham/rp2040_build_fixes
Fix build issues when building for RP2040 from pico-examples/pico-sdk.
2 parents 3db9452 + 2021c62 commit accc3fd

File tree

7 files changed

+18
-32
lines changed

7 files changed

+18
-32
lines changed

examples/device/net_lwip_webserver/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ cmake_minimum_required(VERSION 3.17)
22

33
include(${CMAKE_CURRENT_LIST_DIR}/../../../hw/bsp/family_support.cmake)
44

5+
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
6+
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
7+
58
set(LWIP ${TOP}/lib/lwip)
69
if (NOT EXISTS ${LWIP}/src)
7-
MESSAGE(WARNING "lib/lwip submodule not found, please run 'python tools/get_deps.py lib/lwip' to fetch it")
10+
family_example_missing_dependency(${PROJECT} "lib/lwip")
811
return()
912
endif()
1013

11-
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>)
12-
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
13-
1414
project(${PROJECT} C CXX ASM)
1515

1616
# Checks this example is valid for the family and initializes the project

examples/host/bare_api/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,3 @@ target_include_directories(${PROJECT} PUBLIC
2525
# Configure compilation flags and libraries for the example without RTOS.
2626
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
2727
family_configure_host_example(${PROJECT} noos)
28-
29-
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
30-
if(FAMILY STREQUAL "rp2040")
31-
family_add_pico_pio_usb(${PROJECT})
32-
endif()

examples/host/cdc_msc_hid/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,3 @@ target_include_directories(${PROJECT} PUBLIC
2828
# Configure compilation flags and libraries for the example without RTOS.
2929
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
3030
family_configure_host_example(${PROJECT} noos)
31-
32-
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
33-
if(FAMILY STREQUAL "rp2040")
34-
family_add_pico_pio_usb(${PROJECT})
35-
endif()

examples/host/hid_controller/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,3 @@ target_include_directories(${PROJECT} PUBLIC
2626
# Configure compilation flags and libraries for the example without RTOS.
2727
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
2828
family_configure_host_example(${PROJECT} noos)
29-
30-
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
31-
if(FAMILY STREQUAL "rp2040")
32-
family_add_pico_pio_usb(${PROJECT})
33-
endif()

examples/host/msc_file_explorer/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,3 @@ target_include_directories(${PROJECT} PUBLIC
3838
# Configure compilation flags and libraries for the example without RTOS.
3939
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
4040
family_configure_host_example(${PROJECT} noos)
41-
42-
# Add pico-pio-usb for rp2040 since user can choose to run on bit-banging host
43-
if(FAMILY STREQUAL "rp2040")
44-
family_add_pico_pio_usb(${PROJECT})
45-
endif()

hw/bsp/family_support.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include_guard()
1+
include_guard(GLOBAL)
22

33
include(CMakePrintHelpers)
44

@@ -36,12 +36,14 @@ if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${FAMILY}/family.cmake)
3636
message(FATAL_ERROR "Family '${FAMILY}' is not known/supported")
3737
endif()
3838

39-
# enable LTO if supported
40-
include(CheckIPOSupported)
41-
check_ipo_supported(RESULT IPO_SUPPORTED)
42-
if (IPO_SUPPORTED)
43-
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
44-
endif ()
39+
if (NOT FAMILY STREQUAL rp2040)
40+
# enable LTO if supported skip rp2040
41+
include(CheckIPOSupported)
42+
check_ipo_supported(RESULT IPO_SUPPORTED)
43+
if (IPO_SUPPORTED)
44+
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
45+
endif()
46+
endif()
4547

4648
set(WARNING_FLAGS_GNU
4749
-Wall
@@ -288,6 +290,10 @@ function(family_configure_dual_usb_example TARGET RTOS)
288290
family_configure_example(${TARGET} ${RTOS})
289291
endfunction()
290292

293+
function(family_example_missing_dependency TARGET DEPENDENCY)
294+
message(WARNING "${DEPENDENCY} submodule needed by ${TARGET} not found, please run 'python tools/get_deps.py ${DEPENDENCY}' to fetch it")
295+
endfunction()
296+
291297
#----------------------------------
292298
# RPI specific: refactor later
293299
#----------------------------------

hw/bsp/rp2040/family.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.13)
2-
include_guard()
2+
include_guard(GLOBAL)
33

44
if (NOT BOARD)
55
message("BOARD not specified, defaulting to pico_sdk")

0 commit comments

Comments
 (0)