Skip to content

Commit

Permalink
feat: init webgpu
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz committed Jun 19, 2024
1 parent d5cd6fc commit 6043ca4
Show file tree
Hide file tree
Showing 190 changed files with 21,107 additions and 7,327 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ Thumbs.db
*.tgz
packages/**/angular/dist
apps/demo/times.html
rust-skia
rust-skia

/target
/**/*.rs.bk
/Cargo.lock
51 changes: 51 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ARCHS_IOS = x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
ARCHS_ANDROID = i686-linux-android x86_64-linux-android aarch64-linux-android armv7-linux-androideabi
# LIB = libcanvasative.dylib
XCFRAMEWORK = CanvasNative.xcframework
RUST_LIB = canvasnative

all:GENERATE_HEADERS ios android

ios: $(XCFRAMEWORK)

android: GENERATE_ANDROID

android_svg: GENERATE_ANDROID_SVG

ios_svg: GENERATE_IOS_SVG

.PHONY: GENERATE_HEADERS
GENERATE_HEADERS:
./tools/scripts/build-headers.sh

# PHONY keyword on make means this is not a file, just an identifier for a target
.PHONY: $(ARCHS_IOS)
$(ARCHS_IOS): %:
cargo +nightly build -Z build-std='std,panic_abort' -Z build-std-features=panic_immediate_abort --target $@ --release -p canvas-ios

$(XCFRAMEWORK): $(ARCHS_IOS)

.PHONY: $(ARCHS_ANDROID)
$(ARCHS_ANDROID): %:
./tools/scripts/build-android.sh $@ && ./tools/scripts/copy-android.sh $@

.PHONY: GENERATE_ANDROID
GENERATE_ANDROID: $(ARCHS_ANDROID)

# .PHONY: $(ARCHS_IOS)_SVG
# $(ARCHS_IOS)_SVG: %_svg:
# ./tools/scripts/build-svg-ios.sh $* && ./tools/scripts/copy-svg-ios.sh $*

# .PHONY: GENERATE_IOS_SVG
# GENERATE_IOS_SVG: $(addsuffix _svg,$(ARCHS_IOS))

# .PHONY: $(ARCHS_ANDROID)_SVG
# $(ARCHS_ANDROID)_SVG: %_svg:
# ./tools/scripts/build-svg-android.sh $* && ./tools/scripts/copy-svg-android.sh $*

# .PHONY: GENERATE_ANDROID_SVG
# GENERATE_ANDROID_SVG: $(addsuffix _svg,$(ARCHS_ANDROID))

.PHONY: clean
clean:
rm -rf target
2 changes: 1 addition & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@nativescript/canvas-svg": "file:../../packages/canvas-svg"
},
"devDependencies": {
"@nativescript/android": "8.6.2",
"@nativescript/android": "alpha",
"@nativescript/ios": "8.7.0",
"@nativescript/visionos": "8.6.0"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/references.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/// <reference path="../../references.d.ts" />
/// <reference path="../../references.d.ts" />
5 changes: 3 additions & 2 deletions apps/demo/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ Helpers.initialize();
require('@nativescript/canvas-polyfill');
*/
const TextDecoderO = TextDecoder;
require('@nativescript/canvas-polyfill');
import '@nativescript/canvas-polyfill';
// require('@nativescript/canvas-polyfill');
import { Svg } from '@nativescript/canvas-svg';
// import { Canvas } from '@nativescript/canvas';
import { Canvas } from '@nativescript/canvas';
declare const jp, GDPerformanceMonitor, android, java, UIColor;
let monitor;
import { Application, path as filePath, knownFolders, Utils, path as nsPath, ImageSource, Trace, Screen } from '@nativescript/core';
Expand Down
28 changes: 28 additions & 0 deletions crates/canvas-c/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "canvas-c"
version = "0.1.0"
edition = "2021"

[features]
2d = ["dep:canvas-2d"]
webgl = ["dep:canvas-webgl"]

[dependencies]
gl-bindings = { path = "../gl-bindings" }
canvas-core = { path = "../canvas-core", features = ["2d"] }
canvas-2d = { path = "../canvas-2d", optional = true, features = ["gl"] }
canvas-webgl = { path = "../canvas-webgl", optional = true }
parking_lot = "0.12.0"
ureq = { version = "2.9.6", features = ["gzip"] }
bytes = "1.5.0"
log = { version = "0.4.20"}
wgpu = "0.20.1"
futures = "0.3"

[target.'cfg(target_vendor="apple")'.dependencies]
display-link = "0.2.0"


[target.'cfg(target_os="android")'.dependencies]
ndk = { version = "0.7.0", features = ["bitmap"] }
once_cell = "1.14.0"
Loading

0 comments on commit 6043ca4

Please sign in to comment.