Skip to content

Commit 0aef782

Browse files
Moving primary build instructions to docs
Also drop visual studio instructions.
1 parent 2bd5339 commit 0aef782

File tree

2 files changed

+130
-138
lines changed

2 files changed

+130
-138
lines changed

README.md

Lines changed: 29 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Third-party software distributed alongside this software
1818
is licensed under compatible licenses.
1919
Please refer to `abc` and `libs` subdirectories for their license terms.
2020

21+
2122
Web Site and Other Resources
2223
============================
2324

@@ -49,9 +50,25 @@ For more information about the difference between Tabby CAD Suite and the OSS CA
4950

5051
Many Linux distributions also provide Yosys binaries, some more up to date than others. Check with your package manager!
5152

53+
5254
Building from Source
5355
====================
5456

57+
For more details, and instructions for other platforms, check [building from
58+
source](https://yosyshq.readthedocs.io/projects/yosys/en/latest/getting_started/installation.html#building-from-source)
59+
on Read the Docs.
60+
61+
When cloning Yosys, some required libraries are included as git submodules. Make
62+
sure to call e.g.
63+
64+
$ git clone --recurse-submodules https://github.com/YosysHQ/yosys.git
65+
66+
or
67+
68+
$ git clone https://github.com/YosysHQ/yosys.git
69+
$ cd yosys
70+
$ git submodule update --init --recursive
71+
5572
You need a C++ compiler with C++17 support (up-to-date CLANG or GCC is
5673
recommended) and some standard tools such as GNU Flex, GNU Bison, and GNU Make.
5774
TCL, readline and libffi are optional (see ``ENABLE_*`` settings in Makefile).
@@ -65,58 +82,22 @@ prerequisites for building yosys:
6582
graphviz xdot pkg-config python3 libboost-system-dev \
6683
libboost-python-dev libboost-filesystem-dev zlib1g-dev
6784

68-
Similarily, on Mac OS X Homebrew can be used to install dependencies (from within cloned yosys repository):
69-
70-
$ brew tap Homebrew/bundle && brew bundle
71-
72-
or MacPorts:
73-
74-
$ sudo port install bison flex readline gawk libffi \
75-
git graphviz pkgconfig python36 boost zlib tcl
76-
77-
On FreeBSD use the following command to install all prerequisites:
78-
79-
# pkg install bison flex readline gawk libffi\
80-
git graphviz pkgconf python3 python36 tcl-wrapper boost-libs
81-
82-
On FreeBSD system use gmake instead of make. To run tests use:
83-
% MAKE=gmake CC=cc gmake test
84-
85-
For Cygwin use the following command to install all prerequisites, or select these additional packages:
86-
87-
setup-x86_64.exe -q --packages=bison,flex,gcc-core,gcc-g++,git,libffi-devel,libreadline-devel,make,pkg-config,python3,tcl-devel,boost-build,zlib-devel
88-
8985
The environment variable `CXX` can be used to control the C++ compiler used, or
90-
run one of the following:
86+
run one of the following to override it:
9187

9288
$ make config-clang
9389
$ make config-gcc
9490

95-
Note that these will result in `make` ignoring the `CXX` environment variable,
96-
unless `CXX` is assigned in the call to make, e.g.
97-
98-
$ make CXX=$CXX
99-
10091
The Makefile has many variables influencing the build process. These can be
101-
adjusted by modifying the Makefile.conf file which is created at the
102-
`make config-...` step (see above), or they can be set by passing an option
103-
to the make command directly.
104-
105-
For example, if you have clang, and (a compatible version of) `ld.lld`
106-
available in PATH, it's recommended to speed up incremental builds with
107-
lld by enabling LTO:
108-
109-
$ make ENABLE_LTO=1
110-
111-
On macOS, LTO requires using clang from homebrew which isn't in PATH
112-
rather than xcode clang.
92+
adjusted by modifying the Makefile.conf file which is created at the `make
93+
config-...` step (see above), or they can be set by passing an option to the
94+
make command directly:
11395

114-
$ make ENABLE_LTO=1 CXX=$(brew --prefix)/opt/llvm/bin/clang++
96+
$ make CXX=$CXX
11597

116-
For other compilers and build configurations it might be
117-
necessary to make some changes to the config section of the
118-
Makefile. It's also an alternative way to set the make variables
119-
mentioned above.
98+
For other compilers and build configurations it might be necessary to make some
99+
changes to the config section of the Makefile. It's also an alternative way to
100+
set the make variables mentioned above.
120101

121102
$ vi Makefile # ..or..
122103
$ vi Makefile.conf
@@ -126,10 +107,9 @@ To build Yosys simply type 'make' in this directory.
126107
$ make
127108
$ sudo make install
128109

129-
Note that this also downloads, builds and installs ABC (using yosys-abc
130-
as executable name).
131-
132-
Tests are located in the tests subdirectory and can be executed using the test target. Note that you need gawk as well as a recent version of iverilog (i.e. build from git). Then, execute tests via:
110+
Tests are located in the tests subdirectory and can be executed using the test
111+
target. Note that you need gawk as well as a recent version of iverilog (i.e.
112+
build from git). Then, execute tests via:
133113

134114
$ make test
135115

@@ -140,6 +120,7 @@ To use a separate (out-of-tree) build directory, provide a path to the Makefile.
140120

141121
Out-of-tree builds require a clean source tree.
142122

123+
143124
Getting Started
144125
===============
145126

@@ -289,68 +270,3 @@ From the root of the repository, run `make docs`. This will build/rebuild yosys
289270
as necessary before generating the website documentation from the yosys help
290271
commands. To build for pdf instead of html, call
291272
`make docs DOC_TARGET=latexpdf`.
292-
293-
Building for Windows
294-
====================
295-
296-
Creating the Visual Studio Template Project
297-
-------------------------------------------
298-
299-
1. Create an empty Visual C++ Win32 Console App project
300-
301-
Microsoft Visual Studio Express 2013 for Windows Desktop
302-
Open New Project Wizard (File -> New Project..)
303-
304-
Project Name: YosysVS
305-
Solution Name: YosysVS
306-
[X] Create directory for solution
307-
[ ] Add to source control
308-
309-
[X] Console applications
310-
[X] Empty Project
311-
[ ] SDL checks
312-
313-
2. Open YosysVS Project Properties
314-
315-
Select Configuration: All Configurations
316-
317-
C/C++ -> General -> Additional Include Directories
318-
Add: ..\yosys
319-
320-
C/C++ -> Preprocessor -> Preprocessor Definitions
321-
Add: _YOSYS_;_CRT_SECURE_NO_WARNINGS
322-
323-
3. Resulting file system tree:
324-
325-
YosysVS/
326-
YosysVS/YosysVS
327-
YosysVS/YosysVS/YosysVS.vcxproj
328-
YosysVS/YosysVS/YosysVS.vcxproj.filters
329-
YosysVS/YosysVS.sdf
330-
YosysVS/YosysVS.sln
331-
YosysVS/YosysVS.v12.suo
332-
333-
4. Zip YosysVS as YosysVS-Tpl-v1.zip
334-
335-
Compiling with Visual Studio
336-
----------------------------
337-
338-
Visual Studio builds are not directly supported by build scripts, but they are still possible.
339-
340-
1. Easy way
341-
342-
- Go to https://github.com/YosysHQ/yosys/actions/workflows/vs.yml?query=branch%3Amain
343-
- Click on the most recent completed run
344-
- In Artifacts region find vcxsrc and click on it to download
345-
- Unpack downloaded ZIP file
346-
- Open YosysVS.sln with Visual Studio
347-
348-
2. Using WSL or MSYS2
349-
350-
- Make sure to have make, python3 and git available
351-
- Git clone yosys repository
352-
- Execute ```make vcxsrc YOSYS_VER=latest```
353-
- File yosys-win32-vcxsrc-latest.zip will be created
354-
- Transfer that file to location visible by Windows application
355-
- Unpack ZIP
356-
- Open YosysVS.sln with Visual Studio

docs/source/getting_started/installation.rst

Lines changed: 101 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,21 @@ The `OSS CAD Suite`_ releases `nightly builds`_ for the following architectures:
6262
Building from source
6363
~~~~~~~~~~~~~~~~~~~~
6464

65-
Refer to the `readme`_ for the most up-to-date install instructions.
65+
.. TODO:: discuss release packages (and figure out what is/isn't included)
6666

67-
.. _readme: https://github.com/YosysHQ/yosys#building-from-source
67+
The Yosys source files can be obtained from the `YosysHQ/Yosys git repository`_.
68+
`ABC`_ and some of the other libraries used are included as git submodules. To
69+
clone these submodules at the same time, use e.g.:
70+
71+
.. code:: console
72+
73+
git clone --recurse-submodules https://github.com/YosysHQ/yosys.git # ..or..
74+
git clone https://github.com/YosysHQ/yosys.git
75+
cd yosys
76+
git submodule update --init --recursive
77+
78+
.. _YosysHQ/Yosys git repository: https://github.com/yosyshq/yosys/
79+
.. _ABC: https://github.com/berkeley-abc/abc
6880

6981
Supported platforms
7082
^^^^^^^^^^^^^^^^^^^
@@ -90,52 +102,119 @@ libffi, Tcl and zlib; are optional but enabled by default (see
90102
:makevar:`ENABLE_*` settings in Makefile). Graphviz and Xdot are used by the
91103
`show` command to display schematics.
92104

105+
.. TODO:: check there aren't any extra prereqs that are already installed on git images
106+
93107
Installing all prerequisites for Ubuntu 20.04:
94108

95109
.. code:: console
96110
97-
sudo sudo apt-get install build-essential clang lld bison flex \
98-
libreadline-dev gawk tcl-dev libffi-dev git make \
99-
graphviz xdot pkg-config python3 libboost-system-dev \
111+
sudo apt-get install gperf build-essential bison flex \
112+
libreadline-dev gawk tcl-dev libffi-dev git graphviz \
113+
xdot pkg-config python3 libboost-system-dev \
100114
libboost-python-dev libboost-filesystem-dev zlib1g-dev
101115
102-
Installing all prerequisites for macOS 11 (with Homebrew):
116+
Installing all prerequisites for macOS 13 (with Homebrew):
103117

104118
.. code:: console
105119
106-
brew install bison flex gawk libffi git graphviz \
107-
pkg-config python3 tcl-tk xdot bash boost-python3
120+
brew tap Homebrew/bundle && brew bundle
108121
109-
Running the build system
110-
^^^^^^^^^^^^^^^^^^^^^^^^
122+
.. TODO:: check these are still up to date
111123

112-
From the root ``yosys`` directory, call the following commands:
124+
or MacPorts:
113125

114126
.. code:: console
115-
116-
make
117-
sudo make install
118127
119-
This will build and then install Yosys, making it available on the command line
120-
as ``yosys``. Note that this also downloads, builds, and installs `ABC`_ (using
121-
:program:`yosys-abc` as the executable name).
128+
sudo port install bison flex readline gawk libffi graphviz \
129+
pkgconfig python36 boost zlib tcl
122130
123-
.. _ABC: https://github.com/berkeley-abc/abc
131+
.. todo:: Is there a console alternative that has the # prefix instead of $?
124132

125-
The default compiler is ``clang``, to change between ``clang`` and ``gcc``, use
126-
one of the following:
133+
On FreeBSD use the following command to install all prerequisites:
127134

128135
.. code:: console
129136
130-
make config-clang
137+
pkg install bison flex readline gawk libffi graphviz \
138+
pkgconf python3 python36 tcl-wrapper boost-libs
139+
140+
.. note:: On FreeBSD system use gmake instead of make. To run tests use:
141+
``MAKE=gmake CC=cc gmake test``
142+
143+
For Cygwin use the following command to install all prerequisites, or select these additional packages:
144+
145+
.. code::
146+
147+
setup-x86_64.exe -q --packages=bison,flex,gcc-core,gcc-g++,git,libffi-devel,libreadline-devel,make,pkg-config,python3,tcl-devel,boost-build,zlib-devel
148+
149+
Build configuration
150+
^^^^^^^^^^^^^^^^^^^
151+
152+
The Yosys build is based solely on Makefiles, and uses a number of variables
153+
which influence the build process. The recommended method for configuring
154+
builds is with a ``Makefile.conf`` file in the root ``yosys`` directory. The
155+
following commands will clean the directory and provide an initial configuration
156+
file:
157+
158+
.. code:: console
159+
160+
make config-clang # ..or..
131161
make config-gcc
132162
133-
To use a compiler different than the default, use:
163+
Check the root Makefile to see what other configuration targets are available.
164+
Other variables can then be added to the ``Makefile.conf`` as needed, for
165+
example:
166+
167+
.. code:: console
168+
169+
echo "ENABLE_ZLIB := 0" >> Makefile.conf
170+
171+
Using one of these targets will set the ``CONFIG`` variable to something other
172+
than ``none``, and will override the environment variable for ``CXX``. To use a
173+
different compiler than the default when building, use:
134174

135175
.. code:: console
136176
177+
make CXX=$CXX # ..or..
137178
make CXX="g++-11"
138179
180+
.. note::
181+
182+
Setting the compiler in this way will prevent some other options such as
183+
``ENABLE_CCACHE`` from working as expected.
184+
185+
If you have clang, and (a compatible version of) ``ld.lld`` available in PATH,
186+
it's recommended to speed up incremental builds with lld by enabling LTO with
187+
``ENABLE_LTO=1``. On macOS, LTO requires using clang from homebrew rather than
188+
clang from xcode. For example:
189+
190+
.. code:: console
191+
192+
make ENABLE_LTO=1 CXX=$(brew --prefix)/opt/llvm/bin/clang++
193+
194+
By default, building (and installing) yosys will build (and install) `ABC`_,
195+
using :program:`yosys-abc` as the executable name. To use an existing ABC
196+
executable instead, set the ``ABCEXTERNAL`` make variable to point to the
197+
desired executable.
198+
199+
Running the build system
200+
^^^^^^^^^^^^^^^^^^^^^^^^
201+
202+
From the root ``yosys`` directory, call the following commands:
203+
204+
.. code:: console
205+
206+
make
207+
sudo make install
208+
209+
To use a separate (out-of-tree) build directory, provide a path to the Makefile.
210+
211+
.. code:: console
212+
213+
mkdir build; cd build
214+
make -f ../Makefile
215+
216+
Out-of-tree builds require a clean source tree.
217+
139218
.. seealso::
140219

141220
Refer to :doc:`/yosys_internals/extending_yosys/test_suites` for details on
@@ -202,9 +281,6 @@ commands.
202281
Good starting points for reading example source code to learn how to write
203282
passes are :file:`passes/opt/opt_dff.cc` and :file:`passes/opt/opt_merge.cc`.
204283

205-
See the top-level README file for a quick Getting Started guide and build
206-
instructions. The Yosys build is based solely on Makefiles.
207-
208284
Users of the Qt Creator IDE can generate a QT Creator project file using make
209285
qtcreator. Users of the Eclipse IDE can use the "Makefile Project with Existing
210286
Code" project type in the Eclipse "New Project" dialog (only available after the

0 commit comments

Comments
 (0)