cmake: support services that are not based on cmake executable targets
This commit is contained in:
+30
-5
@@ -170,19 +170,44 @@ function(sysroot_add_service)
|
||||
|
||||
get_property(sysroot_targets GLOBAL PROPERTY sysroot_target_list)
|
||||
get_property(cfg_file TARGET ${arg_NAME} PROPERTY service_cfg_path)
|
||||
get_property(file_list TARGET ${arg_NAME} PROPERTY service_file_list)
|
||||
get_property(target_type TARGET ${arg_NAME} PROPERTY TYPE)
|
||||
|
||||
list(LENGTH sysroot_targets nr_sysroot_targets)
|
||||
list(LENGTH file_list nr_service_files)
|
||||
if (${nr_sysroot_targets} GREATER 0)
|
||||
math(EXPR serialiser_index "${nr_sysroot_targets}-1")
|
||||
list(GET sysroot_targets ${serialiser_index} serialiser)
|
||||
endif ()
|
||||
|
||||
add_custom_target(${sysroot_target_name}
|
||||
COMMAND ${Python_EXECUTABLE} ${sysroot_tool}
|
||||
add-binary ${sysroot_manifest} ${target_name}
|
||||
${arg_BIN_DIR} $<TARGET_FILE:${target_name}>
|
||||
set(commands
|
||||
COMMAND ${Python_EXECUTABLE} ${sysroot_tool}
|
||||
add-binary ${sysroot_manifest} ${target_name}-cfg
|
||||
${arg_SVC_DIR} ${cfg_file}
|
||||
${arg_SVC_DIR} ${cfg_file})
|
||||
|
||||
if (target_type STREQUAL "EXECUTABLE")
|
||||
set(commands ${commands}
|
||||
COMMAND ${Python_EXECUTABLE} ${sysroot_tool}
|
||||
add-binary ${sysroot_manifest} ${target_name}
|
||||
${arg_BIN_DIR} $<TARGET_FILE:${target_name}>)
|
||||
endif ()
|
||||
|
||||
if (nr_service_files GREATER 0)
|
||||
math(EXPR nr_service_files "${nr_service_files}-1")
|
||||
foreach (i RANGE 0 ${nr_service_files} 2)
|
||||
math(EXPR i2 "${i}+1")
|
||||
list(GET file_list ${i} src_file)
|
||||
list(GET file_list ${i2} dest_dir)
|
||||
|
||||
set(commands ${commands}
|
||||
COMMAND ${Python_EXECUTABLE} ${sysroot_tool}
|
||||
add-binary ${sysroot_manifest} ${target_name}-${i}
|
||||
${dest_dir} ${src_file})
|
||||
endforeach (i)
|
||||
endif ()
|
||||
|
||||
add_custom_target(${sysroot_target_name}
|
||||
${commands}
|
||||
COMMENT "Preparing sysroot component: ${target_name}"
|
||||
DEPENDS ${target_name} ${serialiser})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user