Skip to content

Commit 116f30c

Browse files
authored
Merge pull request #1914 from byuccl/venv
Refactor build/dependency documentation + new markdown parser (myst-parser)
2 parents 372c028 + ac2d1ef commit 116f30c

32 files changed

+357
-382
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: 25 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -1,255 +1,49 @@
1-
# Building VTR #
1+
# Building VTR
22

33

4-
## Overview ##
4+
## Setting up Your Environment
55

6-
VTR uses [CMake](https://cmake.org) as it's build system.
76

8-
CMake provides a portable cross-platform build systems with many useful features.
7+
VTR requires several system packages. From the top-level directory, run the following script to install the required packages on a modern Debian or Ubuntu system:
98

10-
## Tested Compilers ##
11-
VTR requires a C++-14 compliant compiler.
12-
It is tested against the default compilers of all Debian and Ubuntu releases within their standard support lifetime. Currently, those are the following:
9+
./install_apt_packages.sh
1310

14-
* GCC/G++: 7, 8, 9, 10, 11
15-
* Clang/Clang++: 6, 7, 10
1611

17-
Other compilers may work but are untested (your milage may vary).
12+
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:
1813

19-
## Unix-like ##
20-
For unix-like systems we provide a wrapper Makefile which supports the traditional `make` and `make clean` commands, but calls CMake behind the scenes.
14+
make env
15+
source .venv/bin/activate
2116

22-
### Dependencies ###
17+
Then to install the Python packages:
2318

24-
For the basic tools you need:
25-
* Bison & Flex
26-
* cmake, make
27-
* A modern C++ compiler supporting C++14 (such as GCC >= 4.9 or clang >= 3.6)
19+
pip install -r requirements.txt
2820

29-
For the VPR GUI you need:
30-
* Cairo
31-
* FreeType
32-
* Xft (libXft + libX11)
33-
* fontconfig
34-
* libgtk-3-dev
21+
**Note:** If you chose to install the Python virtual environment, you will need to remember to activate it on any new terminal window you use, before you can run the VTR flow or regressions tests (`source .venv/bin/activate`).
3522

36-
For the [regression testing and benchmarking](README.developers.md#running-tests) you will need:
37-
* Perl + List::MoreUtils
38-
* Python
39-
* time
23+
## Building
4024

41-
It is also recommended you install the following development tools:
42-
* git
43-
* ctags
44-
* gdb
45-
* valgrind
46-
* clang-format-7
25+
From the top-level, run:
4726

48-
For Docs generation you will need:
49-
* Doxygen
50-
* python-sphinx
51-
* python-sphinx-rtd-theme
52-
* python-recommonmark
27+
make
5328

54-
#### Debian & Ubuntu ####
29+
which will build all the required tools.
5530

56-
The following should be enough to get the tools, VPR GUI and tests going on a modern Debian or Ubuntu system:
31+
The complete VTR flow has been tested on 64-bit Linux systems.
32+
The flow should work in other platforms (32-bit Linux, Windows with cygwin) but this is untested.
5733

58-
```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
74-
```
34+
*Full information about building VTR, including setting up required system packages and Python packages, can be found in [Optional Build Information](doc/src/vtr/optional_build_info.md) page.*
7535

76-
For documentation generation these additional packages are required:
36+
Please [let us know](doc/src/contact.md) your experience with building VTR so that we can improve the experience for others.
7737

78-
```shell
79-
apt-get install \
80-
doxygen \
81-
python-sphinx \
82-
python-sphinx-rtd-theme \
83-
python-recommonmark
84-
```
38+
The tools included official VTR releases have been tested for compatibility.
39+
If you download a different version of those tools, then those versions may not be mutually compatible with the VTR release.
8540

41+
## Verifying Installation
8642

87-
For development the following additional packages are useful:
43+
To verfiy that VTR has been installed correctly run::
8844

89-
```shell
90-
apt-get install \
91-
git \
92-
valgrind \
93-
gdb \
94-
ctags
95-
```
45+
./vtr_flow/scripts/run_vtr_task.py basic_flow
9646

97-
#### Using Nix ####
47+
The expected output is::
9848

99-
Although the recommended platform is Debian or Ubuntu, Nix can be used to build VTR on other platforms, such as MacOS.
100-
101-
If you don't have [Nix](https://nixos.org/nix/), you can [get it](https://nixos.org/nix/download.html) with:
102-
103-
```shell
104-
$ curl -L https://nixos.org/nix/install | sh
105-
```
106-
107-
These commands will set up dependencies for Linux and MacOS and build VTR:
108-
109-
```shell
110-
#In the VTR root
111-
$ nix-shell dev/nix/shell.nix
112-
$ make
113-
```
114-
115-
### Building using the Makefile wrapper ###
116-
Run `make` from the root of the VTR source tree
117-
118-
```shell
119-
#In the VTR root
120-
$ make
121-
...
122-
[100%] Built target vpr
123-
```
124-
125-
126-
#### Specifying the build type ####
127-
You can specify the build type by passing the `BUILD_TYPE` parameter.
128-
129-
For instance to create a debug build (no optimization and debug symbols):
130-
131-
```shell
132-
#In the VTR root
133-
$ make BUILD_TYPE=debug
134-
...
135-
[100%] Built target vpr
136-
```
137-
138-
139-
#### Passing parameters to CMake ####
140-
You can also pass parameters to CMake.
141-
142-
For instance to set the CMake configuration variable `VTR_ENABLE_SANITIZE` on:
143-
144-
```shell
145-
#In the VTR root
146-
$ make CMAKE_PARAMS="-DVTR_ENABLE_SANITIZE=ON"
147-
...
148-
[100%] Built target vpr
149-
```
150-
151-
Both the `BUILD_TYPE` and `CMAKE_PARAMS` can be specified concurrently:
152-
```shell
153-
#In the VTR root
154-
$ make BUILD_TYPE=debug CMAKE_PARAMS="-DVTR_ENABLE_SANITIZE=ON"
155-
...
156-
[100%] Built target vpr
157-
```
158-
159-
160-
### Using CMake directly ###
161-
You can also use cmake directly.
162-
163-
First create a build directory under the VTR root:
164-
165-
```shell
166-
#In the VTR root
167-
$ mkdir build
168-
$ cd build
169-
170-
#Call cmake pointing to the directory containing the root CMakeLists.txt
171-
$ cmake ..
172-
173-
#Build
174-
$ make
175-
```
176-
177-
#### Changing configuration on the command line ####
178-
You can change the CMake configuration by passing command line parameters.
179-
180-
For instance to set the configuration to debug:
181-
182-
```shell
183-
#In the build directory
184-
$ cmake . -DCMAKE_BUILD_TYPE=debug
185-
186-
#Re-build
187-
$ make
188-
```
189-
190-
#### Changing configuration interactively with ccmake ####
191-
You can also use `ccmake` to to modify the build configuration.
192-
193-
```shell
194-
#From the build directory
195-
$ ccmake . #Make some configuration change
196-
197-
#Build
198-
$ make
199-
```
200-
201-
## Other platforms ##
202-
203-
CMake supports a variety of operating systems and can generate project files for a variety of build systems and IDEs.
204-
While VTR is developed primarily on Linux, it should be possible to build on different platforms (your milage may vary).
205-
See the [CMake documentation](https://cmake.org) for more details about using cmake and generating project files on other platforms and build systems (e.g. Eclipse, Microsoft Visual Studio).
206-
207-
208-
### Microsoft Windows ###
209-
210-
*NOTE: VTR support on Microsoft Windows is considered experimental*
211-
212-
#### Cygwin ####
213-
[Cygwin](https://www.cygwin.com/) provides a POSIX (i.e. unix-like) environment for Microsoft Windows.
214-
215-
From within the cygwin terminal follow the Unix-like build instructions listed above.
216-
217-
Note that the generated executables will rely upon Cygwin (e.g. `cygwin1.dll`) for POSIX compatibility.
218-
219-
#### Cross-compiling from Linux to Microsoft Windows with MinGW-W64 ####
220-
It is possible to cross-compile from a Linux host system to generate Microsoft Windows executables using the [MinGW-W64](https://mingw-w64.org) compilers.
221-
These can usually be installed with your Linux distribution's package manager (e.g. `sudo apt-get install mingw-w64` on Debian/Ubuntu).
222-
223-
Unlike Cygwin, MinGW executables will depend upon the standard Microsoft Visual C++ run-time.
224-
225-
To build VTR using MinGW:
226-
```shell
227-
#In the VTR root
228-
$ mkdir build_win64
229-
$ cd build_win64
230-
231-
#Run cmake specifying the toolchain file to setup the cross-compilation environment
232-
$ cmake .. -DCMAKE_TOOLCHAIN_FILE ../cmake/toolchains/mingw-linux-cross-compile-to-windows.cmake
233-
234-
#Building will produce Windows executables
235-
$ make
236-
```
237-
238-
Note that by default the MS Windows target system will need to dynamically link to the `libgcc` and `libstdc++` DLLs.
239-
These are usually found under /usr/lib/gcc on the Linux host machine.
240-
241-
See the [toolchain file](cmake/toolchains/mingw-linux-cross-compile-to-windows.cmake) for more details.
242-
243-
#### Microsoft Visual Studio ####
244-
CMake can generate a Microsft Visual Studio project, enabling VTR to be built with the Microsoft Visual C++ (MSVC) compiler.
245-
246-
##### Installing additional tools #####
247-
VTR depends on some external unix-style tools during it's buid process; in particular the `flex` and `bison` parser generators.
248-
249-
One approach is to install these tools using [MSYS2](http://www.msys2.org/), which provides up-to-date versions of many unix tools for MS Windows.
250-
251-
To ensure CMake can find the `flex` and `bison` executables you must ensure that they are available on your system path.
252-
For instance, if MSYS2 was installed to `C:\msys64` you would need to ensure that `C:\msys64\usr\bin` was included in the system PATH environment variable.
253-
254-
##### Generating the Visual Studio Project #####
255-
CMake (e.g. the `cmake-gui`) can then be configured to generate the MSVC project.
49+
k6_N10_memSize16384_memData64_40nm_timing/ch_intrinsics...OK

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)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The following are general tips for making your pull requests easy to review (and
154154
* Keep changes small
155155

156156
Large change sets are difficult and time-consuming to review.
157-
If a change set is becoming too large, consider splitting it into smaller pieces; you'll probably want to [file an issue](#filling-feature-requests) to discuss things first.
157+
If a change set is becoming too large, consider splitting it into smaller pieces; you'll probably want to [file an issue](#filling-enhancement-requests) to discuss things first.
158158

159159
* Do one thing only
160160

README.developers.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ $ make
966966
this turns on more extensive assertion checking and re-builds VTR.
967967
968968
## GDB Pretty Printers
969-
To make it easier to debug some of VTR's data structures with [GDB](www.gnu.org/gdb).
969+
To make it easier to debug some of VTR's data structures with [GDB](https://www.sourceware.org/gdb/).
970970

971971
### STL Pretty Printers
972972

@@ -1145,7 +1145,7 @@ make CMAKE_PARAMS="-DVTR_IPO_BUILD=off" -j8 vpr
11451145
# External Subtrees
11461146
VTR includes some code which is developed in external repositories, and is integrated into the VTR source tree using [git subtrees](https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree).
11471147
1148-
To simplify the process of working with subtrees we use the [`dev/external_subtrees.py`](./dev/external_subtrees.py) script.
1148+
To simplify the process of working with subtrees we use the [`dev/external_subtrees.py`](https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/master/dev/external_subtrees.py) script.
11491149
11501150
For instance, running `./dev/external_subtrees.py --list` from the VTR root it shows the subtrees:
11511151
```
@@ -1159,15 +1159,15 @@ Component: libtatum Path: libs/EXTERNAL/libtatum URL: https://git
11591159
Code included in VTR by subtrees should *not be modified within the VTR source tree*.
11601160
Instead changes should be made in the relevant up-stream repository, and then synced into the VTR tree.
11611161
1162-
### Updating an existing Subtree
1162+
## Updating an existing Subtree
11631163
1. From the VTR root run: `./dev/external_subtrees.py $SUBTREE_NAME`, where `$SUBTREE_NAME` is the name of an existing subtree.
11641164
11651165
For example to update the `libtatum` subtree:
11661166
```shell
11671167
./dev/external_subtrees.py --update libtatum
11681168
```
11691169
1170-
### Adding a new Subtree
1170+
## Adding a new Subtree
11711171
11721172
To add a new external subtree to VTR do the following:
11731173
@@ -1207,7 +1207,7 @@ To add a new external subtree to VTR do the following:
12071207
The first will squash all the upstream changes, the second will merge those changes into the current branch.
12081208
12091209
1210-
### Subtree Rational
1210+
## Subtree Rational
12111211
12121212
VTR uses subtrees to allow easy tracking of upstream dependencies.
12131213
@@ -1221,7 +1221,7 @@ See [here](https://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git
12211221
# Finding Bugs with Coverity
12221222
[Coverity Scan](https://scan.coverity.com) is a static code analysis service which can be used to detect bugs.
12231223
1224-
### Browsing Defects
1224+
## Browsing Defects
12251225
To view defects detected do the following:
12261226
12271227
1. Get a coverity scan account
@@ -1231,7 +1231,7 @@ To view defects detected do the following:
12311231
2. Browse the existing defects through the coverity web interface
12321232
12331233
1234-
### Submitting a build
1234+
## Submitting a build
12351235
To submit a build to coverity do the following:
12361236
12371237
1. [Download](https://scan.coverity.com/download) the coverity build tool
@@ -1264,7 +1264,7 @@ Note that we explicitly asked for gcc and g++, the coverity build tool defaults
12641264
12651265
Once the build has been analyzed you can browse the latest results through the coverity web interface
12661266
1267-
### No files emitted
1267+
## No files emitted
12681268
If you get the following warning from cov-build:
12691269
12701270
[WARNING] No files were emitted.
@@ -1303,5 +1303,5 @@ The following outlines the procedure to following when making an official VTR re
13031303
* GitHub will automatically create a release based on the tag
13041304
* Add the new change log entry to the [GitHub release description](https://github.com/verilog-to-routing/vtr-verilog-to-routing/releases)
13051305
* Update the [ReadTheDocs configuration](https://readthedocs.org/projects/vtr/versions/) to build and serve documentation for the relevant tag (e.g. `v8.0.0`)
1306-
* Send a release announcement email to the [vtr-announce]([email protected]) mailing list (make sure to thank all contributors!)
1306+
* Send a release announcement email to the [vtr-announce](mailto:[email protected]) mailing list (make sure to thank all contributors!)
13071307

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+
)

0 commit comments

Comments
 (0)