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
Build QuickJS as a shared library instead of static library.
QJS_BUILD_LIBC
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
Build a static qjs executable with all dependencies linked statically.
QJS_BUILD_CLI_WITH_MIMALLOC
Build the qjs executable with mimalloc allocator (dynamically linked).
QJS_BUILD_CLI_WITH_STATIC_MIMALLOC
Build the qjs executable with mimalloc allocator (statically linked).
Feature Options
QJS_DISABLE_PARSER
Disable JavaScript source code parser. Useful for environments that only execute bytecode.
Examples and Tests
QJS_BUILD_EXAMPLES
Build example programs including:
hello- Simple hello worldhello_module- Module exampletest_fib- Fibonacci testfib.so/point.so- Native module examples
Compiler Options
QJS_BUILD_WERROR
Build with
-Werror flag, treating all warnings as errors.Sanitizer Options
QuickJS-ng supports multiple sanitizers for development and debugging:QJS_ENABLE_ASAN
Enable AddressSanitizer (ASan) for detecting memory errors.
QJS_ENABLE_MSAN
Enable MemorySanitizer (MSan) for detecting uninitialized memory reads.
MSan only works with Clang at the time of writing.
QJS_ENABLE_TSAN
Enable ThreadSanitizer (TSan) for detecting data races.
QJS_ENABLE_UBSAN
Enable UndefinedBehaviorSanitizer (UBSan) for detecting undefined behavior.
WASI Options
QJS_WASI_REACTOR
Build WASI reactor module that exports library functions without Only available when
_start entry point.CMAKE_SYSTEM_NAME is set to WASI.Meson Build Options
Core Options
libc
Build qjs standard library modules as part of the library.
parser
Enable JavaScript source code parser.
CLI Options
cli_mimalloc
Build qjs CLI with mimalloc allocator.Options:
enabled, disabled, autoDevelopment Options
tests
Build tests including Test262 runner and benchmarks.
examples
Build example programs.
docdir
Documentation installation directory.
Common Build Configurations
Development Build
- CMake
- Meson
Production Build
- CMake
- Meson
Static Library Build
- CMake
- Meson
Bytecode-Only Build
- CMake
- Meson
Environment Variables
All CMake options can also be set via environment variables:Build Type Options
CMake Build Types
Debug- No optimization, full debug symbolsRelease- Full optimization, no debug symbolsRelWithDebInfo- Optimization with debug symbolsMinSizeRel- Optimize for size
Meson Build Types
debug- No optimization, full debug inforelease- Full optimizationdebugoptimized- Optimization with debug infominsize- Optimize for size
Installation Prefix
- CMake
- Meson
Using Makefile Wrapper
The included Makefile provides convenient shortcuts for common operations:Parallel Builds
Both build systems support parallel builds:- CMake
- Meson
- Makefile