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

Commit bff2591

Browse files
committed
Fixed resolve_sketch_headers to actually return headers
Fixed small function argument-stripping bug
1 parent 5254988 commit bff2591

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

cmake/Platform/Sketches/SketchHeadersResolver.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
function(resolve_sketch_headers _target_name _sketch_file _return_var)
99

1010
get_target_include_directories(${_target_name} target_include_dirs)
11-
get_source_headers("${_sketch_file}" ${target_include_dirs} sketch_headers RECURSIVE)
11+
12+
get_source_headers("${_sketch_file}" "${target_include_dirs}" sketch_headers RECURSIVE)
13+
get_source_headers("${ARDUINO_CMAKE_PLATFORM_HEADER_PATH}" "${target_include_dirs}" platform_headers RECURSIVE)
14+
15+
list(APPEND sketch_headers ${platform_headers})
16+
list(REMOVE_DUPLICATES sketch_headers)
17+
18+
set(${_return_var} ${sketch_headers} PARENT_SCOPE)
1219

1320
endfunction()

cmake/Platform/Sources/FunctionSignatureStripper.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ function(_get_function_arguments_types _signature _return_var)
88

99
string(REGEX MATCH ${ARDUINO_CMAKE_FUNCTION_ARGS_REGEX_PATTERN} function_args_string "${_signature}")
1010
string(REGEX MATCHALL ${ARDUINO_CMAKE_FUNCTION_SINGLE_ARG_REGEX_PATTERN}
11-
function_arg_list "${_function_args_string}")
12-
11+
function_arg_list "${function_args_string}")
1312
# Iterate through all arguments to extract only their type
1413
foreach (arg ${function_arg_list})
14+
1515
string(REGEX MATCH ${ARDUINO_CMAKE_FUNCTION_ARG_TYPE_REGEX_PATTERN} arg_type "${arg}")
1616
string(STRIP "${arg_type}" arg_type) # Strip remaining whitespaces
17-
list(APPEND function_args ${arg_type})
17+
18+
if (NOT "${arg_type}" STREQUAL "void") # Do NOT append 'void' arguments - they're meaningless
19+
list(APPEND function_args ${arg_type})
20+
endif ()
21+
1822
endforeach ()
1923

2024
set(${_return_var} ${function_args} PARENT_SCOPE)

cmake/Platform/Sources/HeaderRetriever.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ function(get_header_file _header_we _dir_list _return_var)
1515
find_header_files("${include_dir}" include_dir_headers RECURSE)
1616

1717
foreach (included_header ${include_dir_headers})
18-
get_name_without_file_extension(${included_header} included_header_we)
18+
get_name_without_file_extension("${included_header}" included_header_we)
1919
if ("${included_header_we}" STREQUAL "${_header_we}")
20-
set(_return_var ${included_header} PARENT_SCOPE)
20+
set(${_return_var} ${included_header} PARENT_SCOPE)
2121
return()
2222
endif ()
2323
endforeach ()
2424

2525
endforeach ()
2626

27-
set(_return_var NOTFOUND PARENT_SCOPE)
27+
set(${_return_var} "NOTFOUND" PARENT_SCOPE)
2828

2929
endfunction()

0 commit comments

Comments
 (0)