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