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 {
|
foreach source_file $sources {
|
||||||
set source_path [file normalize $::root/$source_file]
|
# Expand wildcards
|
||||||
set target_path [file join $::ws $app_name [file tail $source_path]]
|
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
|
# Delete existing symbolic link or file if it exists
|
||||||
if {[file exists $target_path]} {
|
if {[file exists $target_path]} {
|
||||||
@@ -111,13 +125,13 @@ proc _handle_sources {app_name sources} {
|
|||||||
switch $link_srcs {
|
switch $link_srcs {
|
||||||
"y" {
|
"y" {
|
||||||
# Create symbolic link
|
# Create symbolic link
|
||||||
file link -symbolic $target_path $source_path
|
file link -symbolic $target_path $eval_source
|
||||||
_info "Created symbolic link: $target_path -> $source_path"
|
_info "Created symbolic link: $target_path -> $eval_source"
|
||||||
}
|
}
|
||||||
"n" {
|
"n" {
|
||||||
# Copy the source file
|
# Copy the source file
|
||||||
file copy $source_path $target_path
|
file copy $eval_source $target_path
|
||||||
_info "Copied source file: $source_path to $target_path"
|
_info "Copied source file: $eval_source to $target_path"
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
_error "Unknown value for LINK_SRCS: ${link_srcs}."
|
_error "Unknown value for LINK_SRCS: ${link_srcs}."
|
||||||
@@ -125,6 +139,7 @@ proc _handle_sources {app_name sources} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
proc _update_app_mem_layout {app_name mem_layout} {
|
proc _update_app_mem_layout {app_name mem_layout} {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user