forked from antmicro/CFU-Playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
environment
38 lines (33 loc) · 1.1 KB
/
environment
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
#!/bin/bash
# Exports environment variables needed by parts of this project.
# PYTHONPATH
# PATH
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo -e "This script should be sourced, not run:\nsource $0" >&2
exit 1
fi
# Using ccache speeds up verilator simulation when not much has changed.
if which ccache >/dev/null; then
export OBJCACHE="ccache"
export CC="ccache gcc"
fi
CFU_ROOT=$(dirname $(realpath ${BASH_SOURCE[0]}))
# We deliberately clear anything that may have already been in PYTHONPATH to
# prevent accidentally pulling in anything outside this project.
PYTHONPATH="${CFU_ROOT}/python:${CFU_ROOT}/soc/board_specific_workflows"
for i in "${CFU_ROOT}/third_party/python/"*; do
# Avoid adding files such as README.md to our path
if [ -d "$i/src" ]; then
PYTHONPATH="${PYTHONPATH}:${i}/src"
elif [ -d "$i" ]; then
PYTHONPATH="${PYTHONPATH}:${i}"
fi
done
export PYTHONPATH
pathadd() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
export PATH="${1}${PATH:+":$PATH"}"
fi
}
pathadd "${CFU_ROOT}/third_party/usr/local/bin"
pathadd "${CFU_ROOT}/scripts"