Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit f504bb6

Browse files
committed
Exported 'add_arduino_library' function to public API.
It can now be used to add 3rd-party arduino libraries located outside the SDK, or having a name that doesn't comply with the current used scheme (Will be fixed soon). On the same note - Added an example that uses a 3rd-party/custom arduino library, leveraging the above.
1 parent 4991c2e commit f504bb6

25 files changed

+3906
-3
lines changed

cmake/Platform/Sources/SourcesManager.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ function(get_headers_parent_directories _sources _return_var)
6464
get_filename_component(header_parent_dir ${header_source} DIRECTORY)
6565
list(APPEND parent_dirs ${header_parent_dir})
6666
endforeach ()
67-
list(REMOVE_DUPLICATES parent_dirs)
67+
if (parent_dirs) # Check parent dirs, could be none if there aren't any headers amongst sources
68+
list(REMOVE_DUPLICATES parent_dirs)
69+
endif ()
6870

6971
set(${_return_var} ${parent_dirs} PARENT_SCOPE)
7072

cmake/Platform/Targets/ArduinoLibraryTarget.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ endfunction()
7676
# _board_id - Board ID associated with the linked Core Lib.
7777
# _sources - Source and header files to create target from.
7878
#=============================================================================#
79-
function(_add_arduino_library _target_name _board_id _sources)
79+
function(add_arduino_library _target_name _board_id _sources)
8080

8181
_add_arduino_cmake_library(${_target_name} ${_board_id} "${_sources}" "${ARGN}")
8282
find_dependent_platform_libraries("${_sources}" lib_platform_libs)
@@ -131,7 +131,7 @@ function(find_arduino_library _target_name _library_name _board_id)
131131
message(SEND_ERROR "${error_message}")
132132
else ()
133133
set(sources ${library_headers} ${library_sources})
134-
_add_arduino_library(${_target_name} ${_board_id} "${sources}" ARCH ${lib_arch})
134+
add_arduino_library(${_target_name} ${_board_id} "${sources}" ARCH ${lib_arch})
135135
endif ()
136136
endif ()
137137
endif ()

examples/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project(Examples LANGUAGES C CXX ASM)
44

55
add_subdirectory(hello-world)
66
add_subdirectory(arduino-library)
7+
add_subdirectory(custom-library)
78
add_subdirectory(blink-example)
89
add_subdirectory(servo-knob-example)
910
add_subdirectory(sketch)

0 commit comments

Comments
 (0)