Getting Started

Requirements

To build and run Scrii from source you need:

  • A C++23 compiler — GCC 13+, Clang 16+, or MSVC.
  • CMake 3.20+.

Optional native backends are detected and enabled automatically when the
corresponding library is available:

  • OpenSSL — crypto (std.crypto) and TLS.
  • zstd and lz4 — compression (std.compression).
  • libpng, libjpeg, and zlib — image and data handling.

If a backend is absent, the matching module still compiles but its functions
throw UNSUPPORTED at runtime.

Building Scrii

git clone https://codefloe.com/okina/scrii.git
cd scrii
cmake -S . -B build
cmake --build build -j

By default this produces two things:

  • build/interpreter/scrii_repl — the interpreter / REPL.
  • libScrii.a — the static language library for embedding.

Both are built with Release (-O3) out of the box, so the interpreter
runs at full speed — no extra flags needed. (If you want a debug build, set
-DCMAKE_BUILD_TYPE=Debug yourself.)

Optional build components

The super-build controls what gets built. Everything is off by default except
the interpreter and the core library:

Option Default Build Purpose
PACKAGE_INTERPRETER ON cmake --build build --target scrii_repl Interpreter / REPL
PACKAGE_TESTS OFF cmake -S . -B build -DPACKAGE_TESTS=ON Unit test suite
PACKAGE_BENCHMARKS OFF -DPACKAGE_BENCHMARKS=ON Micro-benchmark tools

Examples:

# build and run the tests
cmake --build build --target test

# build the micro-benchmarks
cmake -S . -B build -DPACKAGE_BENCHMARKS=ON
cmake --build build --target benchmarks

# interpreter-only build (skip tests)
cmake -S . -B build -DPACKAGE_TESTS=OFF

Tooling

Editor tooling ships in separate repositories and is built independently of
the interpreter:

  • Tooling — scrii_fmt, scrii_ls, and tree-sitter-scrii.

Using Scrii as a dependency

Embed the Scrii core into your own C++ project. See Embedding
for the full host API.

CMake

The core ships an integration helper, ScriiCore.cmake, that builds the
Scrii static library with the optional native backends (OpenSSL, zlib, zstd,
lz4, libpng, libjpeg) auto-detected. Pull the repo and add the core library to
your project:

include(FetchContent)

FetchContent_Declare(scrii
  GIT_REPOSITORY https://codefloe.com/okina/scrii.git
  GIT_TAG        v0.2.1  # or main for the latest development snapshot
)
FetchContent_MakeAvailable(scrii)

include(${scrii_SOURCE_DIR}/cmake/ScriiCore.cmake)
scrii_add_core_library()

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE Scrii)

Notes:

  • scrii_add_core_library() is a no-op if a Scrii target already exists,
    so a superproject and a standalone component can coexist without conflict.
  • Scrii compiles with C++23 and carries its public include directory
    (src/) and the compile definitions SCRII_VERSION / SCRII_BUILD_DATE.
  • Backends are optional: OpenSSL, ZLIB, PNG, and JPEG are detected via
    find_package; zstd and lz4 via find_path/find_library. When a backend is
    absent the corresponding std module still compiles, but its functions
    throw status::UNSUPPORTED at runtime. See the build messages from
    ScriiCore.cmake to see which were enabled.

Meson

Scrii’s build is CMake-based, and its top-level CMakeLists.txt builds the
interpreter, tests, and benchmarks around the core. For Meson the simplest
reliable route is to compile the core directly — it is a small static
library whose sources are all .cpp files under src/ (the two entry points
are src/scrii.cpp and src/plugin.cpp, plus the parser/, thread/,
std/, etc. trees that make up the interpreter). Add a
subprojects/scrii.wrap:

[wrap-git]
url = https://codefloe.com/okina/scrii.git
revision = v0.2.1
depth = 1

Then a subprojects/scrii/meson.build that globs the sources and exposes a
dependency:

project('scrii', 'cpp')

scrii_inc = include_directories('src')

src = run_command(
  'sh', '-c', 'find src -name "*.cpp" | sort',
  check: true,
).stdout().strip().split('\n')

scrii_lib = static_library('scrii',
  src,
  include_directories: scrii_inc,
  cpp_args: ['-DSCRII_VERSION="' + meson.project_version() + '"',
             '-DSCRII_BUILD_DATE="' + run_command('date', '+%Y-%m-%d').stdout().strip() + '"'],
)

scrii_dep = declare_dependency(
  include_directories: scrii_inc,
  link_with: scrii_lib,
)

Use it from your project’s meson.build:

project('my_app', 'cpp', default_options: ['cpp_std=c++23'])

scrii_dep = subproject('scrii').get_variable('scrii_dep')

executable('my_app', 'main.cpp', dependencies: scrii_dep)

Notes for the direct-compile route:

  • Backends. The CMake route auto-detects OpenSSL/zlib/libpng/libjpeg via
    find_package, and zstd/lz4 via find_path/find_library. In Meson you must
    add the equivalent dependency() calls yourself and define the matching
    SCRII_HAVE_* macros, or skip them — the correlating std module then throws
    UNSUPPORTED at runtime. See cmake/ScriiCore.cmake for the exact macro
    names and link libraries.
  • Include path. scrii_inc points at src/ so #include "scrii.hpp" and
    the private headers under src/ resolve directly.

For how to run scripts, the REPL, and your first program, see
First Program.