# Building quick-lint-js from source

## For contributors

quick-lint-js contributors should use the CMake meta build system.

Recommended process:

1. Run CMake to create a build directory containing project files.
2. Run your build tool to compile quick-lint-js and its tests.
3. Run quick-lint-js' tests directly.

The exact commands you need to run differs depending on your preferred development environment and build tool:

- Linux
- macOS
- Windows
- Nix

If you are cross-compiling, see how to cross-compile quick-lint-js.

## Single-command build (not recommended)

If you want to quickly compile quick-lint-js to try it out, and don't want to install CMake or Ninja, run the following commands (macOS and Linux only):

>     c++ -o quick-lint-js -std=gnu++17 -I src -I vendor/simdjson/include -I vendor/simdjson/src -D_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT=1 -D_LIBCPP_INLINE_VISIBILITY="__attribute__((internal_linkage))" src/quick-lint-js/*.cpp src/quick-lint-js/*/*.cpp vendor/simdjson/src/simdjson.cpp -pthread
>     ./quick-lint-js path/to/my-file.js

## Build requirements

All of the following are required:

CMake
  Version 3.13.4 or newer (per Debian 10 Buster)
C++ compiler
  See below

### Supported compilers

quick-lint-js is written in C++17/C++20 and thus requires a compatible compiler. One of the following is required:

GCC
  Version 8.3.0 or newer (per Debian 10 Buster)
Clang
  Version 9 or newer
MSVC
  Version 14.30 (Visual Studio 2022) or newer
Emscripten
  emsdk version 2.0.4 or newer

(Older versions may work.)

### Supported operating systems

One of the following is required:

- Linux: Arch Linux
- Linux: Debian 10 Buster (and newer)
- Linux: Fedora 36 (and newer)
- Linux: Ubuntu 20.04 LTS Focal (and newer)
- macOS: macOS Big Sur 11.7.4
- Windows: Windows 10

(Older versions may work.)

### Optional dependencies

Each of the following are optional:

Google Benchmark
  Vendored by default; used only for testing; use your own version by setting the `QUICK_LINT_JS_USE_BUNDLED_GOOGLE_BENCHMARK` CMake variable to `NO`
Google Test
  Vendored by default; used only for testing; use your own version by setting the `QUICK_LINT_JS_USE_BUNDLED_GOOGLE_TEST` CMake variable to `NO`
simdjson
  Vendored by default; use your own version by setting the `QUICK_LINT_JS_USE_BUNDLED_SIMDJSON` CMake variable to `NO`
Python
  Version 3.7 or newer
clang-format
  Used only during development; see the coding standards and style guide
GNU gettext
  Used only during development
Go
  Version 1.16 or newer; used only during development