diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-14 02:19:09 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-14 02:19:09 -0700 |
commit | d1ebd3bd806f4b4e1f74703f682ca64994c79a28 (patch) | |
tree | 248a6a35a3b7c5232bcdafe6a6bfbe556be8ad0f /cmake | |
parent | c9402e5a5d67ef877fa7f5f67c07a794574ded35 (diff) | |
download | ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.gz ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.tar.bz2 ch573-d1ebd3bd806f4b4e1f74703f682ca64994c79a28.zip |
Get a good, basic framework for ISRs and properly handle the data sections.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/fiddle.cmake | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cmake/fiddle.cmake b/cmake/fiddle.cmake new file mode 100644 index 0000000..6b151a2 --- /dev/null +++ b/cmake/fiddle.cmake @@ -0,0 +1,32 @@ +function(add_fiddle_source header_out fdl_file) + get_filename_component(dir_path ${fdl_file} DIRECTORY) + get_filename_component(file_name_without_extension ${fdl_file} NAME_WE) + set(path_without_extension "${dir_path}/${file_name_without_extension}") + + # Define the output path based on the input `.fdl` file's name + set(output_header "${CMAKE_BINARY_DIR}/generated/${path_without_extension}.h") + get_filename_component(output_dir ${output_header} DIRECTORY) + + # Define the custom command to generate the header + add_custom_command( + OUTPUT ${output_header} + DEPENDS ${fdl_file} + COMMENT "Fiddle compile ${fdl_file} -> ${output_header}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${output_dir}" + COMMAND fiddlec -Lc -h ${output_header} -I ${CMAKE_SOURCE_DIR}/fdl/ --intf-dir ${CMAKE_BINARY_DIR}/fdli/ ${CMAKE_SOURCE_DIR}/${fdl_file} + ) + + # Make the output header file available as a source file for the target + set_source_files_properties(${output_header} PROPERTIES GENERATED TRUE) + set(${header_out} ${output_header} PARENT_SCOPE) +endfunction() + +function(fiddle_sources headers_out files) + set(headers) + foreach (fdl_file ${files}) + file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${fdl_file}") + add_fiddle_source(header_out ${rel_path}) + list(APPEND headers "${header_out}") + endforeach() + set(${headers_out} "${headers}" PARENT_SCOPE) +endfunction() |