2 variable _loading_custom 0
3 variable _loading_source ""
4 variable _initialized 0
6 variable _tcl_path [file normalize [file join [file dirname [info script]] ..]]
11 proc SourceFile {file is_custom {label ""}} {
12 variable _loading_custom
13 variable _loading_source
14 set _loading_custom $is_custom
15 set _loading_source $file
16 if {[
catch {
namespace eval :: [list source $file]} err]} {
17 set _for [
expr {$label ne "" ? " for $label" : ""}]
18 Msg Warning "failed to source [
file tail $file]$_for: $err"
21 set _loading_source ""
29 set _wrapper [
file join [Repo::Get repo_path] Hog Do]
31 set ::env(HOG_LOGO_PRINTED) 1
32 Msg Info "Running sub process: $args"
33 set _code [
catch {
exec -ignorestderr $_wrapper {*}$args >@ stdout 2>@ stderr} _res _opts]
36 if {[dict exists $_opts -errorcode]} {
37 set _ec [dict get $_opts -errorcode]
38 if {[
lindex $_ec 0] eq "CHILDSTATUS" && [
llength $_ec] >= 3} {
39 set _exit [
lindex $_ec 2]
42 return -code error -errorcode [list HOG_SPAWN_FAILED $_exit] \
43 "Hog::Spawn $args failed (exit $_exit): $_res"
53 if {$::Hog::_initialized} {
return}
54 set ::Hog::_initialized 1
56 set tcl_path $::Hog::_tcl_path
57 set repo_path [
file normalize [
file join $tcl_path .. ..]]
58 set top_path [
file join $repo_path Top]
60 source [
file join $tcl_path hog.tcl]
61 source [
file join $tcl_path core datastore.tcl]
62 source [
file join $tcl_path create_project.tcl]
63 source [
file join $tcl_path core listfile.tcl]
64 source [
file join $tcl_path core project.tcl]
65 source [
file join $tcl_path core tobj.tcl]
66 source [
file join $tcl_path core commands.tcl]
67 source [
file join $tcl_path core tools.tcl]
68 source [
file join $tcl_path core flow.tcl]
70 if {[
catch {
package require cmdline} ERROR]} {
71 Msg Debug "The cmdline Tcl package was not found, sourcing it from Hog..."
72 source $tcl_path/utils/cmdline.tcl
100 namespace eval CurrentProject {
101 proc GetProjectObj {} {
variable _ctx
return $_ctx}
104 Launcher::Set Name "Experimental"
105 Launcher::Set Version "0.1.0"
106 Launcher::Set time [
clock format [
clock seconds] -format "%Y-%m-%d %H:%M:%S"]
107 Launcher::Set script [
file normalize [
info script]]
108 Launcher::Set Git [
lindex [
Git --version] 2]
109 Launcher::Set HogTag [
Git {describe --tags --always}]
113 Repo::Set Tag [
Git {describe --tags --always}]
116 Repo::Set repo_path $repo_path
117 Repo::Set tcl_path $tcl_path
118 Repo::Set top_path $top_path
119 Repo::Set pre_synth [
file normalize "${tcl_path}/integrated/pre-synthesis.tcl"]
120 Repo::Set post_synth [
file normalize "${tcl_path}/integrated/post-synthesis.tcl"]
121 Repo::Set pre_impl [
file normalize "${tcl_path}/integrated/pre-implementation.tcl"]
122 Repo::Set post_impl [
file normalize "${tcl_path}/integrated/post-implementation.tcl"]
123 Repo::Set pre_bit [
file normalize "${tcl_path}/integrated/pre-bitstream.tcl"]
124 Repo::Set post_bit [
file normalize "${tcl_path}/integrated/post-bitstream.tcl"]
125 Repo::Set quartus_post_module [
file normalize "${tcl_path}/integrated/quartus-post-module.tcl"]
126 Repo::Set config_path [
file normalize [
file join $top_path repo.conf]]
127 Repo::Set config [tdict create]
128 if {[
file exists [Repo::Get config_path]]} {
129 set PROPERTIES [
ReadConf [Repo::Get config_path]]
130 dict for {section content} $PROPERTIES {
131 Repo::Set config $section [tdict create]
132 dict for {key val} $content {
133 Msg Debug "Setting property $key to $val for section $section"
134 Repo::Set config $section $key $val
139 Repo::Set projects_dir [
file join $repo_path Projects]