This repository was archived by the owner on Apr 17, 2023. It is now read-only.
File tree 5 files changed +28
-2
lines changed 5 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ function(add_sketch_to_target _target_name _sketch_file)
31
31
if (CONVERT_SKETCHES_IF_CONVERTED_SOURCES_EXISTS OR NOT EXISTS ${sketch_converted_source_path} )
32
32
33
33
resolve_sketch_headers(${_target_name} ${_sketch_file} sketch_headers)
34
-
35
34
resolve_sketch_libraries(${_target_name} ${_sketch_file} "${sketch_headers} " )
35
+ resolve_sketch_prototypes(${_sketch_file} "${sketch_headers} " sketch_prototypes)
36
36
37
37
convert_sketch_to_source(${_sketch_file} ${sketch_converted_source_path} )
38
38
Original file line number Diff line number Diff line change
1
+ function (resolve_sketch_prototypes _sketch_file _resolved_sketch_headers _return_var)
2
+
3
+ get_source_function_definitions(${_sketch_file} sketch_func_defines)
4
+ if (NOT sketch_func_defines) # Source has no function definitions at all
5
+ return ()
6
+ endif ()
7
+
8
+ list (APPEND _resolved_sketch_headers "${_sketch_file} " )
9
+
10
+ foreach (func_def ${sketch_func_defines} )
11
+
12
+ match_function_declaration("${func_def} " "${_resolved_sketch_headers} " match)
13
+
14
+ if (${match} MATCHES "NOTFOUND" )
15
+ # ToDo: Append signature to list of prototypes to create
16
+ message ("Coludn't find a matching declaration for `${func_def} `" )
17
+ endif ()
18
+
19
+ endforeach ()
20
+
21
+ endfunction ()
Original file line number Diff line number Diff line change @@ -95,7 +95,8 @@ function(convert_sketch_to_source _sketch_file _converted_source_path)
95
95
96
96
file (STRINGS "${_sketch_file} " sketch_loc)
97
97
98
- set (header_insert_pattern "${ARDUINO_CMAKE_HEADER_INCLUDE_REGEX_PATTERN} |${ARDUINO_CMAKE_FUNCTION_REGEX_PATTERN} " )
98
+ set (header_insert_pattern
99
+ "${ARDUINO_CMAKE_HEADER_INCLUDE_REGEX_PATTERN} |${ARDUINO_CMAKE_FUNCTION_DEFINITION_REGEX_PATTERN} " )
99
100
set (header_inserted FALSE )
100
101
101
102
list (LENGTH sketch_loc num_of_loc)
Original file line number Diff line number Diff line change 1
1
include (SketchHeadersResolver)
2
2
include (SketchLibrariesResolver)
3
+ include (SketchPrototypesResolver)
3
4
include (SketchSourceConverter)
4
5
include (SketchManager)
Original file line number Diff line number Diff line change 2
2
3
3
int x = 5 ;
4
4
5
+ int bar(short , int b);
6
+
5
7
void foo()
6
8
{
7
9
Serial . print(x);
10
+ bar(5 , 6 );
8
11
}
You can’t perform that action at this time.
0 commit comments