Hog v9.9.0
compile_simlib.tcl
Go to the documentation of this file.
1 # Copyright 2018-2024 The University of Birmingham
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 # @file
16 # Compiles Simulation libraries
17 
18 if {[catch {package require cmdline} ERROR]} {
19  puts "$ERROR\n If you are running this script on tclsh, you can fix this by installing 'tcllib'"
20  return
21 }
22 
23 set parameters {
24  {simulator.arg "Target simulator, for which you want to compile the simulation libraries."}
25  {output_dir.arg "Output directory for the compiled simulation libraries."}
26 }
27 
28 set usage "Compile the simulation libraries for the target simulator - USAGE: compile_simlib.tcl \[options\]"
29 
30 set tcl_path [file dirname [info script]]
31 set repo_path [file normalize $tcl_path/../../..]
32 source $tcl_path/../hog.tcl
33 
34 if {[catch {array set options [cmdline::getoptions ::argv $parameters $usage]}]} {
35  Msg Info [cmdline::usage $parameters $usage]
36  exit 1
37 }
38 
39 if { $options(simulator) != "" } {
40  set simulator $options(simulator)
41 } else {
42  Msg Error "No simulator has been selected. Exiting..."
43  exit 1
44 }
45 
46 if { $options(output_dir) != "" } {
47  set output_dir $options(output_dir)
48 } else {
49  Msg Info "No output_dir has been defined. Using default: SimulationLib/"
50  set output_dir "SimulationLib"
51 }
52 
53 set repo_path [pwd]
54 cd $repo_path/..
55 compile_simlib -simulator $simulator -family all -language all -library all -dir $output_dir