-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqp_set_path
executable file
·114 lines (102 loc) · 3.22 KB
/
qp_set_path
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env bash
#
# Set Intel Quartus path variable
# usage:
# qp_set_path - info (list Quartus install dir)
# qp_set_path /c/intelFPGA_pro/21.1 - set path to Quartus
#
# Time-stamp: <2022-07-07 09:19:53>
echo "+------------------------------------------------------------------------+"
echo "| Set Intel Quartus path variable |"
echo "+------------------------------------------------------------------------+"
# Function to set variable coupled to Quartus:
# QUARTUS_ROOTDIR_OVERRIDE
# QUARTUS_ROOTDIR,
# quartus_bin_dir,
# nios2_bin_dir.
#
# Input parameter:
# 1 - Path to Quartus
fun_qp_set_path ()
{
if [ -n "$1" ]; then
_PATH="${1}quartus"
if [ -d "$_PATH" ]; then
export QUARTUS_ROOTDIR_OVERRIDE="${_PATH}"
export QUARTUS_ROOTDIR="${_PATH}"
printf "\\e[32m\\e[1mSetup of path successful!\\e[0m\\n"
else
printf "\\e[31m\\e[1m"
echo " *****************************************************"
echo " * ERROR! can't find required '$1' quartus version"
echo " * (there are not PATH: $_PATH)"
echo " *****************************************************"
printf "\\e[0m"
# exit 1
fi
fi
# BITS:
if [ "`uname`" = Linux ]; then
BITS=bin
fi
if [ "$OS" = "Windows_NT" ]; then
if [ $QUARTUS_64BIT -eq 1 ]
then
BITS=bin64
else
BITS=bin
fi
fi
quartus_bin_dir="$QUARTUS_ROOTDIR_OVERRIDE/$BITS"
quartus_sopc_bin_dir="$QUARTUS_ROOTDIR_OVERRIDE/sopc_builder/bin"
nios2_bin_dir="$QUARTUS_ROOTDIR_OVERRIDE/../nios2eds/bin"
}
list_dir() {
DIR="$1"
ls "$DIR" &> /dev/null
if [ "$?" == 0 ]; then
echo "* Path: $DIR"
ls -F "$DIR" | grep / | sed "s/\///g"
fi
}
SCRIPT_NAME=$(basename "${BASH_SOURCE##*/}")
if [ "$#" -eq 0 ] || [ "$1" == '-h' ] || [ "$1" == '--help' ] || [ "$1" == '-help' ]; then
echo "Usage:"
echo " ${BASH_SOURCE##*/} [path2quartus]"
echo
echo "ARGS:"
echo " <path2quartus>"
echo " Path to Quartus, example(s):"
echo " /c/intelFPGA_pro/21.1/"
echo " /opt/altera/19.1/"
echo ""
echo "List of available Quartus directories:"
if [ "`uname`" = Linux ]; then
list_dir /opt/altera
else
list_dir "/c/Altera"
list_dir "/c/Altera_pro"
list_dir "/c/intelFPGA"
list_dir "/c/intelFPGA_pro"
fi
else
fun_qp_set_path $*
export PATH="$quartus_bin_dir:$PATH"
export PATH="$quartus_sopc_bin_dir:$PATH"
export PATH="$nios2_bin_dir:$PATH"
# QSYS_ROOTDIR:
export PATH="$quartus_bin_dir/../sopc_builder/bin:$PATH"
echo " Set variables:"
echo " QUARTUS_ROOTDIR_OVERRIDE = $QUARTUS_ROOTDIR_OVERRIDE"
echo " QUARTUS_ROOTDIR = $QUARTUS_ROOTDIR"
echo " Add to PATH variable:"
echo " $quartus_bin_dir"
echo " $quartus_sopc_bin_dir"
echo " $nios2_bin_dir"
fi
# This is for the sake of Emacs.
# Local Variables:
# time-stamp-end: "$"
# time-stamp-format: "<%:y-%02m-%02d %02H:%02M:%02S>"
# time-stamp-start: "Time-stamp: "
# End: