From a98624a7292014db2054a525e5970d0b4cbb1140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bas=20du=20Pr=C3=A9?= Date: Tue, 8 Oct 2024 21:30:28 +0200 Subject: [PATCH] changes --- .github/workflows/build-mingw.yml | 4 +-- README.md | 56 +++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-mingw.yml b/.github/workflows/build-mingw.yml index 2b8f459..7344aea 100644 --- a/.github/workflows/build-mingw.yml +++ b/.github/workflows/build-mingw.yml @@ -25,7 +25,7 @@ jobs: cd skia python3 tools/git-sync-deps python3 bin/fetch-ninja - bin/gn gen out/lib --platform=mingw --args=' + bin/gn gen ../out/lib --platform=mingw --args=' is_debug=false is_official_build=true clang_win="C:/Program Files/LLVM" @@ -41,7 +41,7 @@ jobs: skia_use_expat=false ' third_party/ninja/ninja -C out/lib skia - cp --recursive include out/include + cp --recursive include ../out/include - name: Archive the build uses: actions/upload-artifact@v4 with: diff --git a/README.md b/README.md index 5e1054d..ec20970 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,54 @@ -# skia-zig -Skia Bindings for Zig +# Skia Zig Bindings + +This repository provides Zig bindings to the Skia C API. It builds Skia for multiple platforms and exposes the raw C headers to be used directly in Zig projects. **No wrappers** are provided—this is a low-level binding to the C layer only. + +## Features + +- Builds Skia for multiple platforms (Linux, macOS, Windows, etc.) +- Exposes the raw Skia C API headers +- Compatible with Zig's `@cImport` for easy integration + +## Getting Started + +### Prerequisites + +Before building, ensure you have the following dependencies installed: + +- Zig (v0.10.0 or higher) +- CMake +- Ninja +- Python 3 +- Clang (for compiling Skia) + +### Building + +To build Skia and set up the bindings for use in Zig, follow these steps: + +1. Clone the repository: + + ```bash + git clone https://github.com/yourusername/skia-zig-bindings.git + cd skia-zig-bindings + ``` + +2. Build Skia for your platform: + + ```bash + ./build_skia.sh + ``` + + This will download Skia, build it for your platform, and place the compiled libraries and headers in the `build/` directory. + +3. Link the Skia libraries and include the C headers in your Zig project. + +### Usage + +After building, you can import the Skia C API headers in your Zig code as follows: + +```zig +const skia = @cImport({ + @cInclude("skia/c/sk_canvas.h"); + @cInclude("skia/c/sk_paint.h"); + @cInclude("skia/c/sk_surface.h"); + // Add other Skia headers as needed +}); \ No newline at end of file