Skip to content

Building

Building from Source

slang-server requires the following tools in order to build: - python 3 - CMake (3.28 or later) - C++20 compatible compiler. Minimum supported compiler versions: - GCC 11 - clang 17 - Xcode 16 - MSVC support is tested only against the most recent update of VS 2022

# Clone the repository
git clone https://github.com/hudson-trading/slang-server.git
cd slang-server

# Pull direct submodules (slang and reflect-cpp)
git submodule update --init

# Build with cmake using a C++20 compliant compiler
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j --target slang_server

Only direct submodules are needed. Leave out --recursive to skip reflect-cpp's optional vcpkg submodule; slang-server uses its bundled JSON support with REFLECTCPP_USE_VCPKG=OFF by default.

CMake downloads the remaining dependencies, including uriparser, during configuration. Network access is required unless those dependencies are already available locally.

To use an installed uriparser instead of downloading it, configure with -DSLANG_SERVER_USE_SYSTEM_URIPARSER=ON. This requires uriparser 1.0.3 or later with char support and its CMake package configuration. Set CMAKE_PREFIX_PATH if the package is installed outside CMake's default search paths.

The binary will be at build/bin/slang-server.

For developer hovers and document/repository coverage scans, enable -DSLANG_SERVER_DEBUG=ON. See Debug hovers and feature scans.

Nix Development Shell

If you use Nix with flakes enabled, the repository provides a development shell for x86-64 Linux, ARM64 Linux, and Apple Silicon macOS. It includes the compiler, CMake, Ninja, Python, uv, and build and test dependencies.

After cloning the repository and initializing its submodules, run from the repository root:

nix develop
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j8 --target slang_server

The shell supplies the tools; the CMake commands build build/bin/slang-server. Use a separate build directory if an existing one was configured with a different compiler.