Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ FROM ubuntu:24.04

RUN apt-get update && \
apt-get install -y build-essential clang clang-format clang-tidy git python3-pip \
libssl-dev ninja-build && \
pip3 install conan
libssl-dev ninja-build curl && \
pip3 install conan && \
curl -L https://ziglang.org/builds/zig-linux-x86_64-0.14.1.tar.xz \
| tar -xJ && \
mv zig-linux-x86_64-0.14.1 /opt/zig && \
ln -s /opt/zig/zig /usr/local/bin/zig

WORKDIR /workspace
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,11 @@ g++ -std=c++23 ouro_lang.cc -o ouro_lang
./ouro_lang
```

Legacy CMake files remain for compatibility and can be used instead of Zig:

```bash
mkdir build && cd build
cmake ..
cmake --build . -- -j\$(nproc)
```
A Zig build script is also included (`build.zig`) for environments with the Zig compiler installed. It compiles the C portions of the project using the C23 standard and links against LLVM in addition to `libc`. The script mirrors the old CMake setup and exposes tasks for running the module example and its unit tests. If Zig is missing locally, run `scripts/install_zig.sh` to download version `0.14.1`.

## Repository Structure

The source tree contains C and C++ code alongside a `build.zig` script.
Zig's build system is used to compile the interpreter and modules. A
CMake configuration is kept in `cmake/` for environments that still
depend on it.

The project includes tests, a development container, and extensive documentation.
## Zig Build with Modules

The `ouro_mod` directory showcases a minimal C++23 module setup. Build and run the modular example with:
Expand Down
32 changes: 32 additions & 0 deletions scripts/install_zig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail

ZIG_VERSION="0.14.1"
ZIG_DIR="zig-x86_64-linux-${ZIG_VERSION}"
ARCHIVE="zig-linux-x86_64-${ZIG_VERSION}.tar.xz"
DOWNLOAD_URL="https://ziglang.org/builds/${ARCHIVE}"

if command -v zig >/dev/null 2>&1; then
INSTALLED=$(zig version)
if [ "$INSTALLED" = "$ZIG_VERSION" ]; then
echo "Zig ${ZIG_VERSION} already installed"
exit 0
fi
fi

rm -f "$ARCHIVE"

if [ ! -d "$ZIG_DIR" ]; then
echo "Downloading Zig ${ZIG_VERSION}..."
curl -L -o "$ARCHIVE" "$DOWNLOAD_URL"
mkdir -p "$ZIG_DIR"
tar -xf "$ARCHIVE" -C "$ZIG_DIR" --strip-components=1
fi

cat <<SH > zig
#!/usr/bin/env bash
"$(pwd)/${ZIG_DIR}/zig" "$@"
SH
chmod +x zig

echo "Zig ${ZIG_VERSION} installed in $(pwd)/${ZIG_DIR}"
Loading