Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9a26184
Harden the parser; add an error API; add web builds and a sample view…
Ronsor Aug 20, 2026
92fec63
Tests: remove `opendir` dependency; move variable declarations before…
Ronsor Aug 20, 2026
b8b6122
Viewer: DRY for initializing default options
Ronsor Aug 20, 2026
b1a7144
Build: set up distribution workflow for web builds; add warning that …
Ronsor Aug 20, 2026
4a5b612
CI: don't swallow errors during raylib 6.0 unpacking
Ronsor Aug 20, 2026
df30ba7
CI: make unpacking less verbose; fix accidental 'SDKINFO' in build-di…
Ronsor Aug 20, 2026
df18c98
CI: build raylib in src/, not at the source tree root
Ronsor Aug 20, 2026
320cead
CI: only create build/ directory, not build/raylib-web/ subdirectory
Ronsor Aug 20, 2026
fb66ecd
Building (web): use purismcore.js as the basename for Core-v5 to avoi…
Ronsor Aug 20, 2026
333e665
docs: update README; add basic write-up of the viewer
Ronsor Aug 20, 2026
da76ebe
docs: update README again
Ronsor Aug 20, 2026
a600c80
docs: add "MIT License" header to LICENSE file
Ronsor Aug 20, 2026
fa9b056
docs: update file names to reflect build system changes
Ronsor Aug 20, 2026
4d8807b
CI: fix release job to match wasm job
Ronsor Aug 20, 2026
a50d9e3
viewer, web: display version information; increase status line bottom…
Ronsor Aug 20, 2026
209f6a5
viewer: fix source formatting issue
Ronsor Aug 20, 2026
f4d94af
refactor: clean up remains of old runtime checks
Ronsor Aug 20, 2026
a460628
docs: update the README to explain what competition means
Ronsor Aug 20, 2026
6c35ee7
docs: revise error reporting in PurismCore.h
Ronsor Aug 21, 2026
d7d76be
docs: revise error reporting in PurismCore.h
Ronsor Aug 21, 2026
c27d076
CI: fix release job
Ronsor Aug 21, 2026
906ad32
CI, hooks: update clang-format notes
Ronsor Aug 21, 2026
c682054
MOC3 parsing: always verify buffer size and pointer validity
Ronsor Aug 21, 2026
af151d8
Formatting: remove pointless line-splitting
Ronsor Aug 21, 2026
872520e
verify.c: use PSM__FAIL instead of manual if + LOGF + return
Ronsor Aug 21, 2026
c80584e
update: return a proper error for resolve_params instead of bool
Ronsor Aug 21, 2026
0cc07e5
samples/viewer: update comment headers
Ronsor Aug 21, 2026
a43e369
Add Purism Core viewer screenshot
Ronsor Aug 21, 2026
241e339
tests: adjust for the new resolve_params API
Ronsor Aug 21, 2026
e65309e
docs: add second Purism Core viewer screenshot
Ronsor Aug 21, 2026
a30e130
refactor: more formatting and comment updates
Ronsor Aug 21, 2026
4f0b437
build: don't automatically clean before fuzz-malloc because it destro…
Ronsor Aug 21, 2026
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
31 changes: 31 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Purism Core house style: BSD KNF / OpenBSD style(9)-ish.
# - return type on its own line for function definitions
# - column-aligned declarations and #define values
# - 2-space indent, control-statement braces attached, function braces on own line
# - preprocessor directives indented after the '#'
# Function-like "statement" macros (control-flow bodies) are hand-aligned and
# fenced with `// clang-format off/on` where this config would reflow them.
Language: Cpp
BasedOnStyle: LLVM
IndentWidth: 2
UseTab: Never
ContinuationIndentWidth: 4
ColumnLimit: 0
AlignAfterOpenBracket: DontAlign
BreakBeforeBraces: Linux
AlwaysBreakAfterReturnType: AllDefinitions
PointerAlignment: Right
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: false
SpaceBeforeParens: ControlStatements
Cpp11BracedListStyle: false
IndentCaseLabels: false
KeepEmptyLinesAtTheStartOfBlocks: false
SortIncludes: Never
AlignEscapedNewlines: DontAlign
AlignTrailingComments:
Kind: Leave
IndentPPDirectives: AfterHash
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
23 changes: 23 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
# Pre-commit: reject staged C sources that aren't clang-format-clean.
#
# Enable once per clone: git config core.hooksPath .githooks (or: make hooks)
# Override the binary: CLANG_FORMAT=clang-format-19 git commit ...

CLANG_FORMAT="${CLANG_FORMAT:-clang-format}"

files=$(git diff --cached --name-only --diff-filter=ACM -- '*.c' '*.h')
[ -z "$files" ] && exit 0

if ! command -v "$CLANG_FORMAT" >/dev/null 2>&1; then
echo "pre-commit: $CLANG_FORMAT not found; skipping format check" >&2
exit 0
fi

if ! "$CLANG_FORMAT" --dry-run --Werror $files; then
echo >&2
echo "pre-commit: staged C sources need formatting." >&2
echo " fix with: make format (then re-stage)" >&2
exit 1
fi
exit 0
163 changes: 152 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ on:
branches: [master]

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install clang-format
run: pip install clang-format==19.1.7

- name: Check formatting
run: make format-check

build-and-test:
runs-on: ubuntu-latest
steps:
Expand All @@ -28,63 +43,189 @@ jobs:
cross-build:
runs-on: ubuntu-latest
needs: build-and-test
# The release job rebuilds the whole matrix itself (and it is the only job
# that can lipo a universal Viewer.app / dylib), so on a tag push the 7
# cross-build targets + their artifact uploads are pure duplication -- skip
# them and let release be the single build. (PR and branch pushes keep the
# matrix, which uploads per-target artifacts for inspection.)
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v')
strategy:
matrix:
target:
- linux-x64
- linux-arm64
- macos-x64
- macos-arm64
- win-x64
- win-x86
- win-arm64
- zig-cross-linux-x86_64
- zig-cross-linux-arm64
- zig-cross-macos-x86_64
- zig-cross-macos-arm64
- zig-cross-windows-x86_64
- zig-cross-windows-x86
- zig-cross-windows-arm64
steps:
- uses: actions/checkout@v4

- uses: mlugg/setup-zig@v2
with:
version: 0.16.0

# raylib v6.0 release archive for this target (viewer-in-dist is opt-in
# via RAYLIB_DIR_<PRESET> env vars; if a target has no archive -- e.g.
# zig-cross-windows-arm64 only ships MSVC-built raylib -- the viewer is skipped and
# the library still builds). Pinned to v6.0; bump here + in the release
# job together when upgrading.
- name: Fetch raylib v6.0 for ${{ matrix.target }}
shell: bash
run: |
case "${{ matrix.target }}" in
zig-cross-linux-x86_64) url=raylib-6.0_linux_amd64.tar.gz; var=RAYLIB_DIR_LINUX_AMD64; ext=tar.gz ;;
zig-cross-linux-arm64) url=raylib-6.0_linux_arm64.tar.gz; var=RAYLIB_DIR_LINUX_ARM64; ext=tar.gz ;;
zig-cross-macos-x86_64) url=raylib-6.0_macos.tar.gz; var=RAYLIB_DIR_MACOS; ext=tar.gz ;;
zig-cross-macos-arm64) url=raylib-6.0_macos.tar.gz; var=RAYLIB_DIR_MACOS; ext=tar.gz ;;
zig-cross-windows-x86_64) url=raylib-6.0_win64_mingw-w64.zip; var=RAYLIB_DIR_WINDOWS_AMD64; ext=zip ;;
zig-cross-windows-x86) url=raylib-6.0_win32_mingw-w64.zip; var=RAYLIB_DIR_WINDOWS_X86; ext=zip ;;
zig-cross-windows-arm64) echo "no raylib archive for windows-arm64"; exit 0 ;;
esac
mkdir -p build/raylib
base="${url%.$ext}"
if [ "$ext" = tar.gz ]; then
curl -sL "https://github.com/raysan5/raylib/releases/download/6.0/$url" \
-o "build/raylib/$url"
tar -C build/raylib -xzf "build/raylib/$url"
else
curl -sL "https://github.com/raysan5/raylib/releases/download/6.0/$url" \
-o "build/raylib/$url"
( cd build/raylib && unzip -q "$url" )
fi
# Expose the extracted tree path to subsequent steps via GITHUB_ENV.
echo "$var=$PWD/build/raylib/$base" >> "$GITHUB_ENV"

- name: Cross-build (${{ matrix.target }})
run: ./scripts/zig-build.sh ${{ matrix.target }} --both
run: ./scripts/build-dist.sh ${{ matrix.target }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: build/${{ matrix.target }}/
path: dist/sdk/

wasm:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@v4

- uses: emscripten-core/setup-emsdk@v15
with:
version: 5.0.3

- name: Fetch and build raylib v6.0 (webassembly)
run: |
mkdir -p build/
curl -sL https://github.com/raysan5/raylib/archive/refs/tags/6.0.zip \
-o build/raylib-6.0.zip
( cd build && unzip -q raylib-6.0.zip && mv raylib-6.0 raylib-web )
( cd build/raylib-web/src && make PLATFORM=PLATFORM_WEB GRAPHICS=GRAPHICS_API_OPENGL_ES3 RAYLIB_BUILD_MODE=RELEASE )
echo "RAYLIB_WEB_DIR=$PWD/build/raylib-web/src" >> "$GITHUB_ENV"

- name: Build for web
run: ./scripts/build-dist-web.sh

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wasm
path: dist/sdk-web/

release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: cross-build
# Cross-build is skipped on tag pushes, so depend on build-and-test (which
# always runs) rather than the matrix; release rebuilds the full matrix
# itself anyway.
needs: build-and-test
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Check tag matches PSM_TRUE_VERSION
shell: bash
run: |
tag="${GITHUB_REF#refs/tags/}"; tag="${tag#v}"
ver_hex=$(sed -n 's/^#define PSM_TRUE_VERSION[[:space:]]*\(0x[0-9A-Fa-f]*\).*/\1/p' include/PurismCore.h)
[ -n "$ver_hex" ] || { echo "error: PSM_TRUE_VERSION not found in include/PurismCore.h" >&2; exit 1; }
v_major=$(( ($ver_hex >> 24) & 0xFF ))
v_minor=$(( ($ver_hex >> 16) & 0xFF ))
v_patch=$(( $ver_hex & 0xFFFF ))
version="$v_major.$v_minor.$v_patch"
if [ "$tag" != "$version" ]; then
echo "error: tag v$tag does not match PSM_TRUE_VERSION ($version)" >&2
exit 1
fi
echo "ok: tag v$tag matches PSM_TRUE_VERSION ($version)"

- uses: mlugg/setup-zig@v2
with:
version: 0.16.0

- uses: emscripten-core/setup-emsdk@v15
with:
version: 5.0.3

- name: Install lipo (Linux)
run: |
curl -sL https://github.com/konoui/lipo/releases/download/v0.9.4/lipo_linux_amd64 \
-o /usr/local/bin/lipo
chmod +x /usr/local/bin/lipo

# Download every raylib v6.0 archive the dist matrix needs (viewer-in-dist
# is opt-in via RAYLIB_DIR_<PRESET>; without these env vars, build-dist.sh
# silently skips the viewer and ships the libraries only).
- name: Fetch raylib v6.0 (all targets)
shell: bash
run: |
mkdir -p build/raylib
fetch() { # <url> <top-dir-name> <ext> <env-var>
url="$1"; top="$2"; ext="$3"; var="$4"
curl -sL "https://github.com/raysan5/raylib/releases/download/6.0/$url" \
-o "build/raylib/$url"
if [ "$ext" = tar.gz ]; then
tar -C build/raylib -xzf "build/raylib/$url"
else
( cd build/raylib && unzip -q "$url" )
fi
echo "$var=$PWD/build/raylib/$top" >> "$GITHUB_ENV"
}
fetch raylib-6.0_linux_amd64.tar.gz raylib-6.0_linux_amd64 tar.gz RAYLIB_DIR_LINUX_AMD64
fetch raylib-6.0_linux_arm64.tar.gz raylib-6.0_linux_arm64 tar.gz RAYLIB_DIR_LINUX_ARM64
fetch raylib-6.0_macos.tar.gz raylib-6.0_macos tar.gz RAYLIB_DIR_MACOS
fetch raylib-6.0_win64_mingw-w64.zip raylib-6.0_win64_mingw-w64 zip RAYLIB_DIR_WINDOWS_AMD64
fetch raylib-6.0_win32_mingw-w64.zip raylib-6.0_win32_mingw-w64 zip RAYLIB_DIR_WINDOWS_X86

- name: Fetch and build raylib v6.0 (webassembly)
run: |
mkdir -p build/
curl -sL https://github.com/raysan5/raylib/archive/refs/tags/6.0.zip \
-o build/raylib-6.0.zip
( cd build && unzip -q raylib-6.0.zip && mv raylib-6.0 raylib-web )
( cd build/raylib-web/src && make PLATFORM=PLATFORM_WEB GRAPHICS=GRAPHICS_API_OPENGL_ES3 RAYLIB_BUILD_MODE=RELEASE )
echo "RAYLIB_WEB_DIR=$PWD/build/raylib-web/src" >> "$GITHUB_ENV"

- name: Build distribution
run: ./scripts/build-dist.sh

- name: Build distribution for web
run: ./scripts/build-dist-web.sh

- name: Generate bundle
run: make bundle

- name: Package
run: |
tag="${GITHUB_REF#refs/tags/}"
mv dist/sdk "dist/PurismCore-${tag}"
mv dist/sdk-web "dist/PurismCore-${tag}-Web"
cp dist/PurismCoreBundle.h "dist/PurismCoreBundle-${tag}.h"
cd dist && zip -r "PurismCore-${tag}.zip" "PurismCore-${tag}"
( cd dist && zip -r "PurismCore-${tag}.zip" "PurismCore-${tag}" )
( cd dist && zip -r "PurismCore-${tag}-Web.zip" "PurismCore-${tag}-Web" )

- name: Create release
uses: softprops/action-gh-release@v2
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ testdata/*
# OS
.DS_Store
Thumbs.db
/shot.png

# Non-vendored dependencies
third_party/local/
Loading
Loading