Skip to content

Commit 18087e3

Browse files
authored
setup: a safe, no choices to be made, setup script (#928)
Signed-off-by: Øyvind Harboe <[email protected]>
1 parent 93a06a5 commit 18087e3

File tree

5 files changed

+41
-2
lines changed

5 files changed

+41
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ core.*
7777

7878
# Python bytecode
7979
__pycache__/
80+
81+
dependencies/

build_openroad.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ set -eu
77
# Make sure we are on the correct folder before beginning
88
cd "$(dirname $(readlink -f $0))"
99

10+
# Set up paths to dependencies, such as cmake and boost. Safe no-op
11+
# if tools were set up elsewhere in the path.
12+
. dev_env.sh
13+
1014
# Defaults variable values
1115
NICE=""
1216

dev_env.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
function setpaths() {
3+
local DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
4+
export PATH="$DIR/dependencies/bin:$PATH"
5+
}
6+
7+
setpaths

docs/user/BuildLocally.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
## Clone and Install Dependencies
44

5-
The `DependencyInstaller.sh` script installs all of the dependencies, including OpenROAD dependencies, if they are not already installed.
5+
The `setup.sh` script installs all of the dependencies, including OpenROAD dependencies, if they are not already installed.
66

77
``` shell
88
git clone --recursive https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts
99
cd OpenROAD-flow-scripts
10-
./etc/DependencyInstaller.sh
10+
sudo ./setup.sh
1111
```
1212

1313
## Build
@@ -28,3 +28,14 @@ yosys -help
2828
openroad -help
2929
exit
3030
```
31+
32+
## Compiling and debugging in Visual Studio Code
33+
34+
Set up environment variables to point to tools that CMake from within
35+
Visual Studio Code will need, then start Visual Studio Code as usual
36+
and hit F7, assuming you have CMake plugins installed.
37+
38+
``` shell
39+
. ./dev_env.sh
40+
code tools/OpenROAD/
41+
```

setup.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# allow this script to be invoked from any folder
6+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7+
8+
if [ $EUID -ne 0 ]; then
9+
echo "This script must be run with sudo"
10+
exit 1
11+
fi
12+
13+
"$DIR/tools/OpenROAD/etc/DependencyInstaller.sh" -base
14+
15+
sudo -u $SUDO_USER "$DIR/tools/OpenROAD/etc/DependencyInstaller.sh" -common -prefix="$DIR/dependencies"

0 commit comments

Comments
 (0)