Skip to content

Commit c6a5ccb

Browse files
committed
New environment setup instructions
Signed-off-by: Jeff Goeders <[email protected]>
1 parent 6aa5209 commit c6a5ccb

File tree

7 files changed

+83
-23
lines changed

7 files changed

+83
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ ODIN_II/usefull_tools/**/track_completed
104104
#Python
105105
#
106106
*.pyc
107+
/.venv
107108

108109
#
109110
#Vim

BUILDING.md

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,28 @@ For Docs generation you will need:
5656
The following should be enough to get the tools, VPR GUI and tests going on a modern Debian or Ubuntu system:
5757

5858
```shell
59-
apt-get install \
60-
build-essential \
61-
flex \
62-
bison \
63-
cmake \
64-
fontconfig \
65-
libcairo2-dev \
66-
libfontconfig1-dev \
67-
libx11-dev \
68-
libxft-dev \
69-
libgtk-3-dev \
70-
perl \
71-
liblist-moreutils-perl \
72-
python \
73-
time
59+
./install_apt_packages.sh
7460
```
7561

76-
For documentation generation these additional packages are required:
62+
You will also need several Python packages. You can optionally install and activate a Python virtual environment so that you do not need to modify your system Python installation:
63+
```shell
64+
make env
65+
source .venv/bin/activate
66+
```
67+
68+
Then to install the Python packages:
7769

7870
```shell
79-
apt-get install \
80-
doxygen \
81-
python-sphinx \
82-
python-sphinx-rtd-theme \
83-
python-recommonmark
71+
pip install -r requirements.txt
8472
```
8573

74+
*NOTE: Anytime you run the VTR flow or regressions tests (which use Python) you should activate the virtual environment in your terminal.*
75+
76+
For documentation generation these additional Python packages are required:
77+
78+
```shell
79+
pip install -r doc/requirements.txt
80+
```
8681

8782
For development the following additional packages are useful:
8883

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,3 +451,9 @@ list(APPEND DIRS_TO_FORMAT_PY "${CMAKE_CURRENT_SOURCE_DIR}/vpr")
451451
list(APPEND DIRS_TO_FORMAT_PY "${CMAKE_CURRENT_SOURCE_DIR}/vtr_flow")
452452

453453
include(AutoPyFormat)
454+
455+
456+
#
457+
# Python Environment setup
458+
#
459+
include(PyEnv)

cmake/modules/PyEnv.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Create a python virtual environment using venv and install all necessary packages
2+
# wheel should be installed before the requirements.txt list to prevent errors.
3+
add_custom_target(env
4+
COMMAND python3 -m venv ../.venv
5+
COMMAND . ../.venv/bin/activate && pip3 install wheel
6+
COMMAND . ../.venv/bin/activate && pip3 install -r ../requirements.txt
7+
)

doc/src/quickstart/index.rst

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ The first step is to `download VTR <https://verilogtorouting.org/download/>`_ an
1414

1515
.. note:: Developers planning to modify VTR should clone the `VTR git repository <https://github.com/verilog-to-routing/vtr-verilog-to-routing/>`_.
1616

17+
18+
Environment Setup
19+
-----------------
20+
VTR requires several system packages and Python packages to build and run the flow. You can install the required system packages using the following command (this works on Ubuntu 18.04 and 20.04, but you may require different packages on other Linux distributions):
21+
22+
.. code-block:: bash
23+
24+
> ./install_apt_packages.sh
25+
26+
Then, to install the required Python packages within a new virtual environment:
27+
28+
.. code-block:: bash
29+
30+
> make env
31+
> source .venv/bin/activate
32+
> pip install -r requirements.txt
33+
34+
1735
Build VTR
1836
---------
1937

@@ -368,7 +386,13 @@ Automatically Running the VTR Flow
368386
Running each stage of the flow manually is time consuming (and potentially error prone).
369387
For convenience, VTR provides a script (:ref:`run_vtr_flow`) which automates this process.
370388

371-
Lets make a new directory to work in named ``blink_run_flow``:
389+
First, make sure you sure you have activated the Python virtual environment created at the beginning of this tutorial:
390+
391+
.. code-block:: bash
392+
393+
> source $VTR_ROOT/.venv/bin/activate
394+
395+
Next, make a new directory to work in named ``blink_run_flow``:
372396

373397
.. code-block:: bash
374398

doc/src/vtr/install_vtr.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Install VTR
1414
The complete VTR flow has been tested on 64-bit Linux systems.
1515
The flow should work in other platforms (32-bit Linux, Windows with cygwin) but this is untested.
1616

17-
.. seealso:: More information about building VTR can be found in the :ref:`developer_guide`
17+
.. seealso:: Full information about building VTR, including setting up required system packages and Python packages, can be found in the :ref:`Building VTR guide <building_vtr>`.
1818

1919
Please :ref:`let us know <contact>` your experience with building VTR so that we can improve the experience for others.
2020

install_apt_packages.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
sudo apt-get update
2+
3+
# Base packages to compile and run basic regression tests
4+
sudo apt-get install -y \
5+
make \
6+
cmake \
7+
build-essential \
8+
pkg-config \
9+
bison \
10+
flex \
11+
python3-dev \
12+
python3-venv
13+
14+
# Required for graphics
15+
sudo apt-get install -y \
16+
libgtk-3-dev \
17+
libx11-dev
18+
19+
# Required for yosys front-end
20+
sudo apt-get install -y \
21+
clang \
22+
tcl-dev \
23+
libreadline-dev
24+
25+
# Required to build the documentation
26+
sudo apt-get install -y \
27+
sphinx-common

0 commit comments

Comments
 (0)