Building & Installation
Instructions for building and installing the slang library and tools.
Getting the Source
All source code is hosted on GitHub
git clone https://github.com/MikePopoloski/slang.git
git submodules are used for some dependencies, so they need to be pulled as well:
git submodule update --init --recursive
Dependencies
slang requires the following dependencies in order to build:
Quick Start
Instructions on quickly getting a build going for common platforms.
Linux
On many common systems, a modern C++ compiler is not configured as the default. This assumes you've installed GCC 9 and that it's available on your path, and that you want a release build that will be installed to /usr/local/bin
.
mkdir build && cd build cmake -DCMAKE_CXX_COMPILER=g++-9 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/bin .. make -j8
Tests are built by default. You can run them via ctest:
ctest
Or run the unit tests directly:
bin/unittests
Installation:
make install
Windows
VisualStudio 2019 has built-in support for cmake; simply open the slang root folder and press build.
Build Options
Besides the built-in cmake options, there are slang-specific options that may be set to customize the build:
Option | Description | Default |
---|---|---|
SLANG_INCLUDE_TESTS | Include tests in the build | ON |
SLANG_INCLUDE_DOCS | Include docs in the build | OFF |
SLANG_INCLUDE_LLVM | Include LLVM in the build for generating simulation binaries | OFF |
BUILD_SHARED_LIBS | Build a shared library instead of static | OFF |
SLANG_COVERAGE | Enable Clang code coverage | OFF |
SLANG_SANITIZERS | A list of Clang sanitizers to include in the build | "" |
FUZZ_TARGET | Turn on to enable some changes to make binaries easier to fuzz test | OFF |
CI_BUILD | Enable additional longer-running tests for automated builds | OFF |
DOXYGENPY_PATH | When building docs, the path to the doxygen.py tool | "" |
SLANG_USE_SYSTEM_LIBS | Configures the build to use dependencies already installed on the system (such as fmt and xxhash) instead of the ones included in the repo | OFF |
Build Scripts
This section documents scripts that are invoked during the build that may be of general interest or useful to know if you're modifying how the build works.
Version info
On every build, the current git revision hash is queried and included in the Version.cpp
header to expose to the rest of the library. If the revision is unchanged from the last build no additional work will be done.
Syntax generation
Syntax nodes in slang are expressed in the scripts/syntax.txt
file and processed during the build into generated C++ classes by the syntax_gen.py
script.
Diagnostic generation
Diagnostics, similarly to syntax nodes, are expressed in the scripts/diagnostics.txt
file and processed into C++ definitions by the diagnostic_gen.py
script.
Building Documentation
This section contains instructions for building the documentation.
Dependencies
- doxygen - at least 1.8.17
- doc build environment
Steps
Run cmake with docs enabled and the path to the doxygen.py
script in the m.css
checkout:
cmake -DSLANG_INCLUDE_DOCS=ON -DDOXYGENPY_PATH=/path/to/m.css/documentation/doxygen.py
Run the build:
make docs
The output website is located at docs/html/