diff --git a/README.md b/README.md index c2a1eaf..f53edad 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,37 @@ deno run --allow-ffi --allow-env --unstable deno run -A --unstable ``` +## API + +Check the +[API reference here](https://doc.deno.land/https/deno.land/x/skia_canvas@0.1.0/mod.ts). + +Since this module implements the Canvas Web API, you can also refer to the +[MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D). + +For non-standard APIs (such as `Canvas#save`, `Image.load`, `Fonts.*`), refer to +the API docs mentioned above. + +## Building + +First you need to +[setup depot_tools](https://www.chromium.org/developers/how-tos/install-depot-tools/). + +Then, clone the repository with submodules. + +And run the following commands: + +```sh +deno task build-skia +deno task build +``` + +By default, the module will download and cache the prebuilt binaries for your +platform. However this is not intended behavior when developing locally. To use +locally built binaries, set `DENO_SKIA_LOCAL` environment variable to `1`. Or +you can also set `DENO_SKIA_PATH` to a complete path to dynamic library built +from the `native` directory. + ## License [Apache-2.0](./LICENSE) licensed. diff --git a/scripts/build_skia.ts b/scripts/build_skia.ts index 31c4265..11c7ad1 100644 --- a/scripts/build_skia.ts +++ b/scripts/build_skia.ts @@ -86,10 +86,10 @@ if (Deno.build.os === "windows") { BUILD_ARGS["target_cpu"] = `"arm64"`; BUILD_ARGS["target_os"] = `"mac"`; BUILD_ARGS["extra_cflags_cc"] += ', "--target=arm64-apple-macos"'; - BUILD_ARGS["extra_ldflags"] = '"--target=arm64-apple-macos"'; - BUILD_ARGS["extra_asmflags"] = '"--target=arm64-apple-macos"'; - BUILD_ARGS["extra_cflags"] = '"--target=arm64-apple-macos"'; - BUILD_ARGS["extra_cflags_c"] = '"--target=arm64-apple-macos"'; + BUILD_ARGS["extra_ldflags"] = '["--target=arm64-apple-macos"]'; + BUILD_ARGS["extra_asmflags"] = '["--target=arm64-apple-macos"]'; + BUILD_ARGS["extra_cflags"] = '["--target=arm64-apple-macos"]'; + BUILD_ARGS["extra_cflags_c"] = '["--target=arm64-apple-macos"]'; } } @@ -108,7 +108,12 @@ const $ = (cmd: string | URL, ...args: string[]) => { }); }; -if (!Deno.args.includes("fast")) $("python", "./tools/git-sync-deps"); +if (!Deno.args.includes("skip-sync-deps")) { + $( + Deno.build.os === "windows" ? "python" : "python3", + "./tools/git-sync-deps", + ); +} if (Deno.build.os === "windows") { const SkLoadICU = new URL(