kopia lustrzana https://github.com/raspberrypi/pico-extras
rework pico_extras inclusion to be consistent with SDK 1.2.0
rodzic
e58bacf904
commit
70ace30133
|
@ -5,33 +5,29 @@ if (NOT TARGET _pico_extras_inclusion_marker)
|
||||||
|
|
||||||
# Pull in PICO SDK (must be before project)
|
# Pull in PICO SDK (must be before project)
|
||||||
include(pico_sdk_import.cmake)
|
include(pico_sdk_import.cmake)
|
||||||
|
if (PICO_SDK_VERSION_STRING VERSION_LESS "1.2.0")
|
||||||
|
message(FATAL_ERROR "Require at least Raspberry Pi Pico SDK version 1.2.0")
|
||||||
|
endif()
|
||||||
|
|
||||||
project(pico_extras C CXX)
|
project(pico_extras C CXX)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
# Initialize the SDK
|
|
||||||
pico_sdk_init()
|
|
||||||
|
|
||||||
pico_is_top_level_project(PICO_EXTRAS_TOP_LEVEL_PROJECT)
|
pico_is_top_level_project(PICO_EXTRAS_TOP_LEVEL_PROJECT)
|
||||||
|
|
||||||
add_library(pico_extras_included INTERFACE)
|
# The real work gets done in post_init which is called at the end of pico_sdk_init
|
||||||
target_compile_definitions(pico_extras_included INTERFACE
|
list(APPEND PICO_SDK_POST_LIST_FILES ${CMAKE_CURRENT_LIST_DIR}/post_init.cmake)
|
||||||
-DPICO_EXTRAS=1
|
if (PICO_EXTRAS_TOP_LEVEL_PROJECT)
|
||||||
)
|
message("pico_extras: initialize SDK since we're the top-level")
|
||||||
|
# Initialize the SDK
|
||||||
pico_add_platform_library(pico_extras_included)
|
pico_sdk_init()
|
||||||
|
else()
|
||||||
|
set(PICO_SDK_POST_LIST_FILES ${PICO_SDK_POST_LIST_FILES} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT PICO_EXTRAS_PATH)
|
if (NOT PICO_EXTRAS_PATH)
|
||||||
set(PICO_EXTRAS_PATH ${CMAKE_CURRENT_LIST_DIR})
|
set(PICO_EXTRAS_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||||
endif()
|
endif()
|
||||||
set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to Pico Extras")
|
set(PICO_EXTRAS_PATH "${PICO_EXTRAS_PATH}" CACHE PATH "Path to Pico Extras")
|
||||||
|
|
||||||
add_subdirectory(src)
|
|
||||||
|
|
||||||
if (PICO_EXTRAS_TESTS_ENABLED OR PICO_EXTRAS_TOP_LEVEL_PROJECT)
|
|
||||||
add_subdirectory(test)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
endif()
|
endif()
|
|
@ -0,0 +1,14 @@
|
||||||
|
add_library(pico_extras_included INTERFACE)
|
||||||
|
target_compile_definitions(pico_extras_included INTERFACE
|
||||||
|
-DPICO_EXTRAS=1
|
||||||
|
)
|
||||||
|
|
||||||
|
pico_add_platform_library(pico_extras_included)
|
||||||
|
|
||||||
|
# note as we're a .cmake included by the SDK, we're relative to the pico-sdk build
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/src ${CMAKE_BINARY_DIR}/pico_extras/src)
|
||||||
|
|
||||||
|
if (PICO_EXTRAS_TESTS_ENABLED OR PICO_EXTRAS_TOP_LEVEL_PROJECT)
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/test {CMAKE_BINARY_DIR}/pico_extras/test)
|
||||||
|
endif ()
|
||||||
|
|
Ładowanie…
Reference in New Issue