各アプリケーションには、install
および uninstall
プロシージャがあります。これらのプロシージャを定義すると、Tcl Store
で認識され、特定の状況で自動的に呼び出されるようになります。
-
install
プロシージャは、アプリケーションをインストールするときに自動的に呼び出されます。インストール プロセス中に Tcl Store で最初に呼び出されるプロシージャです。アプリをインストールした後は、install
プロシージャは呼び出されません。その後 Vivado ツールを起動したときには、アプリは既に読み込まれているので、install
プロシージャは呼び出されません。 -
uninstall
プロシージャは、アプリケーションをアンインストールするときに自動的に呼び出されます。アンインストール プロセス中に Tcl Store で最後に呼び出されるプロシージャです。
install
プロシージャの名前は ::tclapp::<company>::<app>::install
で、uninstall
プロシージャの名前は ::tclapp::<company>::<app>::uninstall
です。
次に例を示します。
::tclapp::mycompany::template::install
::tclapp::mycompany::template::uninstall
install
および uninstall
プロシージャは、カスタム GUI ボタンなどの処理に使用できます。ボタンを install
プロシージャを使用してインストール、uninstall
プロシージャを使用して削除できます。1 つのアプリに複数のカスタム GUI ボタンを関連付けることができます。ボタンをインストールすると、アプリをアンインストールするまで、同じ
Vivado ツール バージョンを起動したときにそのボタンを使用できます。install
および uninstall
プロシージャはオプションです。アプリケーションが install
および uninstall
プロシージャを使用しない場合、これらのプロシージャは未定義のままにするか、ボディ部分は空で定義できます。
次に、空のプロシージャの例を示します。
proc ::tclapp::mycompany::template::install { args } {
# Summary :
# Argument Usage:
# Return Value:
# Here is the code of the install proc
# For example, a GUI custom button could be added
}
proc ::tclapp::mycompany::template::uninstall { args } {
# Summary :
# Argument Usage:
# Return Value:
# Here is the code of the uninstall proc
# For example, the GUI custom button added by the install proc should be removed
}
次のプロシージャ例では、カスタム GUI コマンドを作成しています。
proc ::tclapp::mycompany::template::install { args } {
# Summary :
# Argument Usage:
# Return Value:
## Add Vivado GUI button for the app
if { [lsearch [get_gui_custom_commands] myButton] >= 0 } {
puts "INFO: Vivado GUI button for the app is already installed. Exiting ..."
return -code ok
}
puts "INFO: Adding Vivado GUI button for the app"
create_gui_custom_command -name "myButton" \
-menu_name "Do something" \
-command "::tclapp::mycompany::template::my_command1" \
-show_on_toolbar \
-run_proc true
create_gui_custom_command_arg -command_name "myButton" -arg_name "Top_Module"
-default "\[lindex \[find_top\] 0\]"
create_gui_custom_command_arg -command_name "myButton" -arg_name
"Output_Directory" -default "-output_dir report" -optional
create_gui_custom_command_arg -command_name "myButton" -arg_name "Force" -default
"-force" -optional
return -code ok
}
proc ::tclapp::mycompany::template::uninstall { args } {
# Summary :
# Argument Usage:
# Return Value:
if { [lsearch [get_gui_custom_commands] myButton] >= 0 } {
puts "INFO: Vivado GUI button for this app is removed."
remove_gui_custom_commands "myButton"
} else {
puts "INFO: Vivado GUI button for this app is not installed."
}
return -code ok
}