Building & Installation
Instructions for building and installing the slang library and tools.
All source code is hosted on GitHub
slang requires the following dependencies in order to build:
Instructions on quickly getting a build going for common platforms.
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
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:
Or run the unit tests directly:
VisualStudio 2019 has built-in support for cmake; simply open the slang root folder and press build.
Besides the built-in cmake options, there are slang-specific options that may be set to customize the build:
|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|
|SLANG_MSVC_W4||Enable /W4 for MSVC builds||ON|
|SLANG_MSVC_STATIC_RUNTIME||Enable linking to the MSVC static runtime||ON|
|LLVM_DIR||When building with LLVM, a path to where the LLVM cmake system lives||""|
|DOXYGENPY_PATH||When building docs, the path to the doxygen.py tool||""|
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.
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 nodes in slang are expressed in the
scripts/syntax.txt file and processed during the build into generated C++ classes by the
Diagnostics, similarly to syntax nodes, are expressed in the
scripts/diagnostics.txt file and processed into C++ definitions by the
This section contains instructions for building the documentation.
Run cmake with docs enabled and the path to the
doxygen.py script in the
cmake -DSLANG_INCLUDE_DOCS=ON -DDOXYGENPY_PATH=/path/to/m.css/documentation/doxygen.py
Run the build:
The output website is located at