@@ -15,24 +15,38 @@ function(pico_get_runtime_output_directory TARGET output_path_name)
15
15
set (${output_path_name} ${output_path} PARENT_SCOPE )
16
16
endfunction ()
17
17
18
+ function (pico_get_output_name TARGET output_name_var )
19
+ get_target_property (output_name ${TARGET} OUTPUT_NAME )
20
+ # Generator expressions not supported in byproducts
21
+ set (output_name_copy ${output_name} )
22
+ string (GENEX_STRIP "${output_name} " output_name )
23
+ if (NOT output_name OR (NOT output_name STREQUAL output_name_copy ))
24
+ get_target_property (output_name ${TARGET} NAME )
25
+ endif ()
26
+ set (${output_name_var} ${output_name} PARENT_SCOPE )
27
+ endfunction ()
28
+
18
29
# pico_add_hex_output(TARGET)
19
30
# \brief\ Generate a hex file for the target
20
31
function (pico_add_hex_output TARGET )
21
32
pico_get_runtime_output_directory (${TARGET} output_path )
22
- add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex $< TARGET_FILE:${TARGET} > ${output_path} $< IF:$< BOOL:$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> > ,$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> ,$< TARGET_PROPERTY:${TARGET} ,NAME> > .hex VERBATIM )
33
+ pico_get_output_name (${TARGET} output_name )
34
+ add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Oihex $< TARGET_FILE:${TARGET} > ${output_path} $< IF:$< BOOL:$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> > ,$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> ,$< TARGET_PROPERTY:${TARGET} ,NAME> > .hex VERBATIM BYPRODUCTS "${output_path}${output_name} .hex" )
23
35
endfunction ()
24
36
25
37
# pico_add_bin_output(TARGET)
26
38
# \brief\ Generate a bin file for the target
27
39
function (pico_add_bin_output TARGET )
28
40
pico_get_runtime_output_directory (${TARGET} output_path )
29
- add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary $< TARGET_FILE:${TARGET} > ${output_path} $< IF:$< BOOL:$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> > ,$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> ,$< TARGET_PROPERTY:${TARGET} ,NAME> > .bin VERBATIM )
41
+ pico_get_output_name (${TARGET} output_name )
42
+ add_custom_command (TARGET ${TARGET} POST_BUILD COMMAND ${CMAKE_OBJCOPY} -Obinary $< TARGET_FILE:${TARGET} > ${output_path} $< IF:$< BOOL:$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> > ,$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> ,$< TARGET_PROPERTY:${TARGET} ,NAME> > .bin VERBATIM BYPRODUCTS "${output_path}${output_name} .bin" )
30
43
endfunction ()
31
44
32
45
# pico_add_dis_output(TARGET)
33
46
# \brief\ Generate a disassembly file for the target
34
47
function (pico_add_dis_output TARGET )
35
48
pico_get_runtime_output_directory (${TARGET} output_path )
49
+ pico_get_output_name (${TARGET} output_name )
36
50
37
51
# PICO_CMAKE_CONFIG: PICO_NO_COPRO_DIS, Disable disassembly listing postprocessing that disassembles RP2350 coprocessor instructions, type=bool, default=0, group=build
38
52
if (NOT (PICO_NO_COPRO_DIS OR PICO_NO_PICOTOOL OR PICO_RISCV OR PICO_RP2040 ))
@@ -48,6 +62,7 @@ function(pico_add_dis_output TARGET)
48
62
COMMAND ${CMAKE_OBJDUMP} -d ${PICO_DISASM_OBJDUMP_ARGS} $< TARGET_FILE:${TARGET} > >> ${output_path} $< IF:$< BOOL:$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> > ,$< TARGET_PROPERTY:${TARGET} ,OUTPUT_NAME> ,$< TARGET_PROPERTY:${TARGET} ,NAME> > .dis
49
63
${EXTRA_COMMAND}
50
64
VERBATIM
65
+ BYPRODUCTS "${output_path}${output_name} .dis"
51
66
)
52
67
endfunction ()
53
68
@@ -88,6 +103,7 @@ function(pico_add_extra_outputs TARGET)
88
103
COMMAND rm -f "${PICO_SYMLINK_ELF_AS_FILENAME} "
89
104
COMMAND ln -s -r $< TARGET_FILE:${TARGET} > "${PICO_SYMLINK_ELF_AS_FILENAME} "
90
105
COMMENT "Symlinking from ${PICO_SYMLINK_ELF_AS_FILENAME} to ${TARGET} "
106
+ BYPRODUCTS "${PICO_SYMLINK_ELF_AS_FILENAME} "
91
107
)
92
108
endif ()
93
109
# PICO_CMAKE_CONFIG: PICO_NO_UF2, Disable UF2 output, type=bool, default=0, group=build
0 commit comments