Build configuration
Quick start covers the default build. This page explains the options that change what the interpreter can do.
CMake options
Pass options when configuring the build:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DPK_BUILD_STATIC_MAIN=ON -DPK_BUILD_MODULE_LZ4=ON
cmake --build build --config Release
When embedding with add_subdirectory(pocketpy), set cache options before
adding the subdirectory, or pass them on the CMake command line.
Select at most one library-only option. With both off, the root build creates
the standalone main executable and a library.
The following modules are optional and default to OFF:
Initialize the required Git submodules before enabling a module that uses them:
git submodule update --init --recursive
The exact options are defined in CMakeOptions.txt.
Compiling without the project CMake target
Compile the interpreter as C11, even when your application uses C++. Use an
optimized build with NDEBUG for deployment. For MSVC, include /utf-8 and
/experimental:c11atomics.
The defaults in
config.h
differ from CMake: PK_ENABLE_THREADS, PK_ENABLE_DLL, and
PK_ENABLE_DETERMINISM default to 0 unless explicitly enabled.
Do not assume a manually compiled interpreter has the same features as a CMake
build.
Match the platform libraries and feature definitions in
CMakeLists.txt.
For example, Windows uses ws2_32; enabled thread support needs the platform
thread library, and supported Unix dynamic loading uses dl.
Optional modules also need their native sources and libraries; defining a
module macro alone is insufficient.
Inspect the running build
import pkpy
print(pkpy.configmacros)
print(pkpy.currentvm()) # 0 in the default VM
This is useful when a script runs on the desktop but a module or feature is unavailable in an embedded or browser build. Disabling OS access reduces the exposed facilities; it does not turn the interpreter into a security sandbox.