feat(platform/xilinx): enable wildcard support in source file configuration
Allow wildcards in the source file section of the configuration. The script evaluates wildcards and adds matching source files automatically.
This commit is contained in:
@@ -98,8 +98,22 @@ proc _handle_sources {app_name sources} {
|
||||
}
|
||||
|
||||
foreach source_file $sources {
|
||||
set source_path [file normalize $::root/$source_file]
|
||||
set target_path [file join $::ws $app_name [file tail $source_path]]
|
||||
# Expand wildcards
|
||||
set expanded_sources [glob -nocomplain -directory $::root $source_file]
|
||||
if {[llength $expanded_sources] == 0} {
|
||||
_error "Source file not found" "No file or directory matches $source_file"
|
||||
}
|
||||
# Hanle each expanded source
|
||||
foreach eval_source $expanded_sources {
|
||||
set relative_source [string range $eval_source [expr [string length $::root] + 1] end]
|
||||
set target_path [file join $::ws $app_name $relative_source]
|
||||
|
||||
# Ensure the target directory exists
|
||||
set target_dir [file dirname $target_path]
|
||||
if {![file exists $target_dir]} {
|
||||
file mkdir $target_dir
|
||||
_info "Created directory: $target_dir"
|
||||
}
|
||||
|
||||
# Delete existing symbolic link or file if it exists
|
||||
if {[file exists $target_path]} {
|
||||
@@ -111,19 +125,20 @@ proc _handle_sources {app_name sources} {
|
||||
switch $link_srcs {
|
||||
"y" {
|
||||
# Create symbolic link
|
||||
file link -symbolic $target_path $source_path
|
||||
_info "Created symbolic link: $target_path -> $source_path"
|
||||
file link -symbolic $target_path $eval_source
|
||||
_info "Created symbolic link: $target_path -> $eval_source"
|
||||
}
|
||||
"n" {
|
||||
# Copy the source file
|
||||
file copy $source_path $target_path
|
||||
_info "Copied source file: $source_path to $target_path"
|
||||
file copy $eval_source $target_path
|
||||
_info "Copied source file: $eval_source to $target_path"
|
||||
}
|
||||
default {
|
||||
_error "Unknown value for LINK_SRCS: ${link_srcs}."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
proc _update_app_mem_layout {app_name mem_layout} {
|
||||
|
||||
Reference in New Issue
Block a user