Skip to main content
QuickJS-ng provides extensive build configuration options through both CMake and Meson build systems. This guide covers all available options and their usage.

Build Systems

QuickJS-ng supports two build systems:

CMake

Industry-standard build system with broad platform support

Meson

Modern, fast build system with excellent cross-compilation support

CMake Build Options

Library Options

BUILD_SHARED_LIBS

boolean
default:"OFF"
Build QuickJS as a shared library instead of static library.

QJS_BUILD_LIBC

boolean
default:"OFF"
Build standard library modules as part of the library. When enabled, quickjs-libc.c is compiled into the main library.

CLI Options

QJS_BUILD_CLI_STATIC

boolean
default:"OFF"
Build a static qjs executable with all dependencies linked statically.

QJS_BUILD_CLI_WITH_MIMALLOC

boolean
default:"OFF"
Build the qjs executable with mimalloc allocator (dynamically linked).

QJS_BUILD_CLI_WITH_STATIC_MIMALLOC

boolean
default:"OFF"
Build the qjs executable with mimalloc allocator (statically linked).

Feature Options

QJS_DISABLE_PARSER

boolean
default:"OFF"
Disable JavaScript source code parser. Useful for environments that only execute bytecode.
When QJS_DISABLE_PARSER is enabled, you can only execute pre-compiled bytecode. The qjsc compiler and qjs REPL will not be built.

Examples and Tests

QJS_BUILD_EXAMPLES

boolean
default:"OFF"
Build example programs including:
  • hello - Simple hello world
  • hello_module - Module example
  • test_fib - Fibonacci test
  • fib.so / point.so - Native module examples

Compiler Options

QJS_BUILD_WERROR

boolean
default:"OFF"
Build with -Werror flag, treating all warnings as errors.

Sanitizer Options

QuickJS-ng supports multiple sanitizers for development and debugging:

QJS_ENABLE_ASAN

boolean
default:"OFF"
Enable AddressSanitizer (ASan) for detecting memory errors.

QJS_ENABLE_MSAN

boolean
default:"OFF"
Enable MemorySanitizer (MSan) for detecting uninitialized memory reads.
MSan only works with Clang at the time of writing.

QJS_ENABLE_TSAN

boolean
default:"OFF"
Enable ThreadSanitizer (TSan) for detecting data races.
TSan is currently incompatible with other sanitizers.

QJS_ENABLE_UBSAN

boolean
default:"OFF"
Enable UndefinedBehaviorSanitizer (UBSan) for detecting undefined behavior.

WASI Options

QJS_WASI_REACTOR

boolean
default:"OFF"
Build WASI reactor module that exports library functions without _start entry point.
Only available when CMAKE_SYSTEM_NAME is set to WASI.

Meson Build Options

Core Options

libc

boolean
default:"false"
Build qjs standard library modules as part of the library.

parser

boolean
default:"true"
Enable JavaScript source code parser.

CLI Options

cli_mimalloc

feature
default:"disabled"
Build qjs CLI with mimalloc allocator.Options: enabled, disabled, auto

Development Options

tests

feature
default:"auto"
Build tests including Test262 runner and benchmarks.

examples

feature
default:"auto"
Build example programs.

docdir

string
default:""
Documentation installation directory.

Common Build Configurations

Development Build

Production Build

Static Library Build

Bytecode-Only Build

Environment Variables

All CMake options can also be set via environment variables:

Build Type Options

CMake Build Types

  • Debug - No optimization, full debug symbols
  • Release - Full optimization, no debug symbols
  • RelWithDebInfo - Optimization with debug symbols
  • MinSizeRel - Optimize for size

Meson Build Types

  • debug - No optimization, full debug info
  • release - Full optimization
  • debugoptimized - Optimization with debug info
  • minsize - Optimize for size

Installation Prefix

Using Makefile Wrapper

The included Makefile provides convenient shortcuts for common operations:

Parallel Builds

Both build systems support parallel builds: