This is a python script and github actions workflow to manage building static libraries for SKIA.
The script automates the process of building the libraries for various platforms (macOS, iOS, Windows, WASM). It handles the setup of the build environment, cloning of the Skia repository, configuration of build parameters, and compilation. The script also includes functionality for creating universal binaries for macOS and an XCFramework for apple platforms.
The GN Args are supplied in constants which you will need to tweak if you want to modify the build.
Skia's build scripts requires ninja and python3 to be installed on all platforms. Emscripten is installed via skia.
There is a Makefile with helper commands to build the libraries for each platform (from macOS). On windows you can use the build-win.sh
script.
make example-mac # Build example for macOS (will also build libSkia etc)
./example/build-mac/example
Image saved as output.png
Other options:
make skia-mac # Build libraries for macOS
make skia-ios # Build libraries for iOS
make skia-wasm # Build libraries for WASM
make skia-xcframework # Build XCFramework
make example-mac # Build example for macOS
make example-wasm # Build example for WASM
make serve-wasm # Serve the WASM example
The script is called as follows
build-skia.py [-h] [-config {Debug,Release}] [-archs ARCHS] [-branch BRANCH] [--shallow] {mac,ios,win,spm,wasm}
Note: you may need to call
ulimit -n 2048
in order to increase the number of files that can be opened at once.
python3 build-skia.py -config Release -branch chrome/m129 mac
python3 build-skia.py -config Release -branch chrome/m129 ios
python3 build-skia.py -config Release -branch chrome/m129 xcframework
On Windows, you need to install LLVM in order to compile Skia with clang, as recommened by the authors.
LLVM should be installed in C:\Program Files\LLVM\
py -3 build-skia.py -config Release -branch chrome/m129 win