diff --git a/README.md b/README.md index 6259a35..3d907e0 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ Vivado is a pain in the ass to source control decently, so these scripts provide - A git wrapper that will recreate the project script and add it before committing. + - A Tcl script (`wproj`) to just create the project generator script without using git. + ### Workflow 1. When first starting with a project, create it in a folder called `vivado_proj` (e.g. `PROJECT_NAME/vivado_proj`) . All the untracked files will be under this directory. diff --git a/Vivado_init.tcl b/Vivado_init.tcl index 63f15a1..e68a413 100644 --- a/Vivado_init.tcl +++ b/Vivado_init.tcl @@ -4,4 +4,7 @@ source $init_dir/scripts/write_project_tcl_git.tcl namespace import ::custom::write_project_tcl_git source $init_dir/scripts/git_wrapper.tcl -namespace import ::git_wrapper::git \ No newline at end of file +namespace import ::git_wrapper::git + +source $init_dir/scripts/alias.tcl +namespace import ::alias::wproj diff --git a/scripts/alias.tcl b/scripts/alias.tcl new file mode 100755 index 0000000..9cafea3 --- /dev/null +++ b/scripts/alias.tcl @@ -0,0 +1,31 @@ +# Aliases + +# Interface +namespace eval ::alias { + namespace export wproj + namespace import ::custom::write_project_tcl_git + namespace import ::current_project + namespace import ::common::get_property +} + +# Define +namespace eval ::alias { + proc wproj {} { + + # Change directory project directory if not in it yet + set proj_dir [regsub {\/vivado_proj$} [get_property DIRECTORY [current_project]] {}] + set current_dir [pwd] + if { + [string compare -nocase $proj_dir $current_dir] + } then { + puts "Not in project directory" + puts "Changing directory to: ${proj_dir}" + cd $proj_dir + } + + # Generate project + set proj_file [current_project].tcl + puts $proj_file + write_project_tcl_git -no_copy_sources -force $proj_file + } +}