File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -82,22 +82,23 @@ add_custom_target(
82
82
add_dependencies (${COMPONENT_LIB} picoruby)
83
83
84
84
# Compile Ruby files
85
- add_custom_target (
86
- mrbdir ALL
87
- COMMAND ${CMAKE_COMMAND} -E make_directory ${COMPONENT_DIR} /mrb
88
- )
89
- add_dependencies (mrbdir picoruby)
90
-
91
85
set (RUBY_FILES main_task)
92
86
set (PICORBC ${COMPONENT_DIR} /picoruby/bin/picorbc)
87
+ set (GENERATED_C_FILES "" )
93
88
94
89
foreach (rb ${RUBY_FILES} )
95
- add_custom_target (${rb}
96
- COMMAND echo "Compile Ruby files." && ${PICORBC} -B${rb} -o${COMPONENT_DIR} /mrb/${rb} .c ${COMPONENT_DIR} /mrblib/${rb} .rb && ls ${COMPONENT_DIR} /mrb
97
- DEPENDS mrbdir
98
- )
99
- add_dependencies (${rb} picoruby)
90
+ set (C_FILE ${COMPONENT_DIR} /mrb/${rb} .c)
91
+ set (RB_FILE ${COMPONENT_DIR} /mrblib/${rb} .rb)
92
+ add_custom_command (
93
+ OUTPUT ${C_FILE}
94
+ COMMAND ${CMAKE_COMMAND} -E echo "Compiling ${RB_FILE} ..."
95
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${COMPONENT_DIR} /mrb
96
+ COMMAND ${PICORBC} -B${rb} -o${C_FILE} ${RB_FILE}
97
+ DEPENDS picoruby ${RB_FILE}
98
+ COMMENT "Compiling ${RB_FILE} "
99
+ VERBATIM
100
+ )
101
+ list (APPEND GENERATED_C_FILES ${C_FILE} )
100
102
endforeach (rb)
101
103
102
- add_custom_target (generate_files ALL DEPENDS mrbdir ${RUBY_FILES} )
103
- add_dependencies (generate_files picoruby)
104
+ target_sources (${COMPONENT_LIB} PRIVATE ${GENERATED_C_FILES} )
You can’t perform that action at this time.
0 commit comments