-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Some cmake build improvements #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,63 @@ | ||
| # Initialize the Raspberry Pi Pico SDK | ||
| # Pre-initialize the Raspberry Pi Pico SDK, setting up the platform and toolchain and some CMake utility functions | ||
| # This file must be included prior to the project() call | ||
|
|
||
| if (_PICO_SDK_INIT) | ||
| return() | ||
| endif () | ||
| set(_PICO_SDK_INIT 1) | ||
|
|
||
| function(pico_is_top_level_project VAR) | ||
| string(TOLOWER ${CMAKE_CURRENT_LIST_DIR} __list_dir) | ||
| string(TOLOWER ${CMAKE_SOURCE_DIR} __source_dir) | ||
| if (__source_dir STREQUAL __list_dir) | ||
| set(${VAR} 1 PARENT_SCOPE) | ||
| else() | ||
| set(${VAR} 0 PARENT_SCOPE) | ||
| endif() | ||
| endfunction() | ||
|
|
||
| if (NOT PICO_SDK_PATH) | ||
| set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
| endif () | ||
|
|
||
| get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") | ||
|
|
||
| set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) | ||
|
|
||
| list(APPEND CMAKE_MODULE_PATH ${PICO_SDK_PATH}/cmake) | ||
|
|
||
| include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_version.cmake) | ||
| include(pico_utils) | ||
|
|
||
| message("PICO_SDK_PATH is ${CMAKE_CURRENT_LIST_DIR}") | ||
|
|
||
| include(pico_pre_load_platform) | ||
|
|
||
| # todo perhaps this should be included by the platform instead? | ||
| # We want to configure correct toolchain prior to project load | ||
| include(pico_pre_load_toolchain) | ||
|
|
||
| macro(pico_sdk_init) | ||
| if (NOT CMAKE_PROJECT_NAME) | ||
| message(WARNING "pico_sdk_init() should be called after the project is created (and languages added)") | ||
| endif() | ||
| add_subdirectory(${PICO_SDK_PATH} pico-sdk) | ||
| endmacro() | ||
|
|
||
| macro(add_sub_list_dirs var) | ||
| foreach(LIST_DIR IN LISTS ${var}) | ||
| get_filename_component(SHORT_NAME "${LIST_DIR}" NAME) | ||
| message("Including custom CMakeLists.txt ${SHORT_NAME}") | ||
| add_subdirectory(${LIST_DIR} ${SHORT_NAME}) | ||
| endforeach() | ||
| endmacro() | ||
|
|
||
| # Note: this file is perhaps named badly, as it provides a method pico_sdk_init which | ||
| # the enclosing project calls LATER to actually "initialize" the SDK (by including the CMakeLists.txt from this | ||
| # same directory) | ||
|
|
||
| if (NOT TARGET _pico_sdk_pre_init_marker) | ||
| add_library(_pico_sdk_pre_init_marker INTERFACE) | ||
|
|
||
| function(pico_is_top_level_project VAR) | ||
| string(TOLOWER ${CMAKE_CURRENT_LIST_DIR} __list_dir) | ||
| string(TOLOWER ${CMAKE_SOURCE_DIR} __source_dir) | ||
| if (__source_dir STREQUAL __list_dir) | ||
| set(${VAR} 1 PARENT_SCOPE) | ||
| else() | ||
| set(${VAR} 0 PARENT_SCOPE) | ||
| endif() | ||
| endfunction() | ||
|
|
||
| if (NOT PICO_SDK_PATH) | ||
| set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
| endif () | ||
|
|
||
| get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}") | ||
|
|
||
| set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE) | ||
|
|
||
| list(APPEND CMAKE_MODULE_PATH ${PICO_SDK_PATH}/cmake) | ||
|
|
||
| include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_version.cmake) | ||
| include(pico_utils) | ||
|
|
||
| message("PICO_SDK_PATH is ${CMAKE_CURRENT_LIST_DIR}") | ||
|
|
||
| include(pico_pre_load_platform) | ||
|
|
||
| # todo perhaps this should be included by the platform instead? | ||
| # We want to configure correct toolchain prior to project load | ||
| include(pico_pre_load_toolchain) | ||
|
|
||
| macro(pico_sdk_init) | ||
| if (NOT CMAKE_PROJECT_NAME) | ||
| message(WARNING "pico_sdk_init() should be called after the project is created (and languages added)") | ||
| endif() | ||
| add_subdirectory(${PICO_SDK_PATH} pico-sdk) | ||
| endmacro() | ||
|
|
||
| macro(add_sub_list_dirs var) | ||
| foreach(LIST_DIR IN LISTS ${var}) | ||
| get_filename_component(SHORT_NAME "${LIST_DIR}" NAME) | ||
| message(DEBUG "Including custom CMakeLists.txt ${SHORT_NAME}") | ||
| add_subdirectory(${LIST_DIR} ${SHORT_NAME}) | ||
| endforeach() | ||
| endmacro() | ||
|
|
||
| macro(add_sub_list_files var) | ||
| foreach(LIST_FILE IN LISTS ${var}) | ||
| message(DEBUG "Including custom CMake file ${LIST_FILE}") | ||
| include(${LIST_FILE}) | ||
| endforeach() | ||
| endmacro() | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
|
|
||
| #include "pico/sem.h" | ||
| #include "pico/time.h" | ||
| #include "sys/select.h" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ???
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doh! i was looking at something else, and was wondering if it was available |
||
|
|
||
| void sem_init(semaphore_t *sem, int16_t initial_permits, int16_t max_permits) { | ||
| lock_init(&sem->core, next_striped_spin_lock_num()); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.