Building & Installation

Instructions for building and installing the slang library and tools.

Getting the Source

All source code is hosted on GitHub

git clone

git submodules are used for some dependencies, so they need to be pulled as well:

git submodule update --init --recursive


slang requires the following dependencies in order to build:

Quick Start

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 /usr/local/bin.

mkdir build && cd build
make -j8

Tests are built by default. You can run them via ctest:


Or run the unit tests directly:



make install


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:

SLANG_INCLUDE_TESTSInclude tests in the buildON
SLANG_INCLUDE_DOCSInclude docs in the buildOFF
SLANG_INCLUDE_LLVMInclude LLVM in the build for generating simulation binariesOFF
BUILD_SHARED_LIBSBuild a shared library instead of staticOFF
SLANG_COVERAGEEnable Clang code coverageOFF
SLANG_SANITIZERSA list of Clang sanitizers to include in the build""
FUZZ_TARGETTurn on to enable some changes to make binaries easier to fuzz testOFF
CI_BUILDEnable additional longer-running tests for automated buildsOFF
DOXYGENPY_PATHWhen building docs, the path to the tool""
SLANG_USE_SYSTEM_LIBSConfigures the build to use dependencies already installed on the system (such as fmt and xxhash) instead of the ones included in the repoOFF

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 script.

Diagnostic generation

Diagnostics, similarly to syntax nodes, are expressed in the scripts/diagnostics.txt file and processed into C++ definitions by the script.

Building Documentation

This section contains instructions for building the documentation.



Run cmake with docs enabled and the path to the script in the m.css checkout:

cmake -DSLANG_INCLUDE_DOCS=ON -DDOXYGENPY_PATH=/path/to/m.css/documentation/

Run the build:

make docs

The output website is located at docs/html/