Skip to content

Commit 0c64bcf

Browse files
committed
cmake: sdp: add common wrapper for all assembly related cmake
CMakeLists can now simply call `sdp_assembly_install` to add a C file for assembly generation and tracking. Signed-off-by: Marcin Szymczyk <[email protected]>
1 parent 8638dfb commit 0c64bcf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

cmake/sdp.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7+
function(sdp_assembly_install target hrt_srcs)
8+
sdp_assembly_generate("${hrt_srcs}")
9+
sdp_assembly_check("${hrt_srcs}")
10+
sdp_assembly_prepare_install("${hrt_srcs}")
11+
sdp_assembly_target_sources(${target} "${hrt_srcs}")
12+
13+
add_dependencies(${target} asm_check)
14+
endfunction()
15+
16+
function(sdp_assembly_target_sources target hrt_srcs)
17+
foreach(hrt_src ${hrt_srcs})
18+
get_filename_component(hrt_dir ${hrt_src} DIRECTORY) # directory
19+
get_filename_component(hrt_src_file ${hrt_src} NAME_WE) # filename without extension
20+
set(hrt_s_file "${hrt_dir}/${hrt_src_file}.s")
21+
target_sources(${target} PRIVATE ${hrt_s_file})
22+
endforeach()
23+
endfunction()
24+
725
function(sdp_assembly_generate hrt_srcs)
826
set(hrt_msg "Generating ASM files for Hard Real Time files.")
927
set(hrt_opts -g0 -fno-ident -fno-verbose-asm)

0 commit comments

Comments
 (0)