@shopify/react-native-skia 2.12.0-next.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +2 -1
- package/Package.swift +117 -0
- package/android/CMakeLists.txt +23 -179
- package/android/build.gradle +40 -209
- package/android/cpp/jni/JniSkiaManager.cpp +3 -45
- package/android/cpp/jni/include/JniPlatformContext.h +1 -1
- package/android/cpp/jni/include/JniSkiaBaseView.h +18 -11
- package/android/cpp/jni/include/JniSkiaManager.h +3 -4
- package/android/cpp/jni/include/JniSkiaPictureView.h +5 -5
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +0 -10
- package/android/cpp/rnskia-android/RNSkAndroidView.h +6 -6
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +4 -4
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/PlatformContext.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkVideo.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/RNSkiaModule.java +1 -8
- package/android/src/main/java/com/reactnative/skia/RNSkiaPackage.java +57 -0
- package/android/src/main/java/com/reactnative/skia/SkiaBaseView.java +185 -0
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaBaseViewManager.java +20 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaManager.java +11 -6
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureView.java +3 -3
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaPictureViewManager.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaSurfaceView.java +13 -3
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaTextureView.java +5 -3
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/SkiaViewAPI.java +1 -1
- package/android/src/main/java/com/{shopify/reactnative → reactnative}/skia/ViewScreenshotService.java +10 -13
- package/apple/MetalContext.mm +1 -1
- package/apple/RNSkApplePlatformContext.h +0 -3
- package/apple/RNSkApplePlatformContext.mm +0 -11
- package/apple/RNSkiaModule.h +1 -10
- package/apple/RNSkiaModule.mm +2 -10
- package/apple/SkiaManager.h +0 -2
- package/apple/SkiaManager.mm +4 -6
- package/apple/SkiaPictureView.h +2 -2
- package/apple/SkiaPictureView.mm +0 -4
- package/apple/SkiaUIView.h +3 -18
- package/apple/SkiaUIView.mm +0 -30
- package/cpp/api/CustomBlendModes.h +17 -0
- package/cpp/api/JsiSkApi.h +0 -6
- package/cpp/api/JsiSkCanvas.h +19 -10
- package/cpp/api/JsiSkFont.h +5 -10
- package/cpp/api/JsiSkMatrix.h +4 -2
- package/cpp/api/JsiSkSVGFactory.h +4 -0
- package/cpp/api/recorder/Convertor.h +5 -2
- package/cpp/api/recorder/Drawings.h +13 -3
- package/cpp/api/recorder/ImageFilters.h +15 -1
- package/cpp/api/recorder/Paint.h +8 -1
- package/cpp/jsi/JSICache.cpp +99 -0
- package/cpp/jsi/JSICache.h +90 -0
- package/cpp/jsi/NativeObject.h +38 -87
- package/cpp/jsi/ViewProperty.h +0 -28
- package/cpp/rnskia/RNDawnContext.h +2 -1
- package/cpp/rnskia/RNDawnWindowContext.h +22 -0
- package/cpp/rnskia/RNSkManager.cpp +0 -6
- package/cpp/rnskia/RNSkPlatformContext.h +0 -3
- package/cpp/skia/include/core/RasterContext.h +25 -0
- package/cpp/skia/include/core/SkCanvas.h +0 -1
- package/cpp/skia/include/core/SkContext.h +62 -0
- package/cpp/skia/include/core/SkContextOptions.h +15 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPicture.h +36 -18
- package/cpp/skia/include/core/SkRecorder.h +8 -0
- package/cpp/skia/include/core/SkSerialProcs.h +2 -6
- package/cpp/skia/include/effects/SkImageFilters.h +15 -2
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +73 -47
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +7 -4
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +12 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +11 -0
- package/cpp/skia/include/gpu/ganesh/mtl/GrMtlDirectContext.h +11 -0
- package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +13 -0
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +6 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +5 -4
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +9 -1
- package/cpp/skia/include/gpu/graphite/Recorder.h +0 -2
- package/cpp/skia/include/gpu/graphite/Recording.h +3 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +8 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +11 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteContext.h +11 -0
- package/cpp/skia/include/private/SkLog.h +1 -19
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +2 -1
- package/cpp/skia/include/utils/SkLogHandler.h +53 -0
- package/cpp/skia/include/utils/SkNWayCanvas.h +1 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +9 -10
- package/cpp/skia/modules/skcms/src/skcms_internals.h +8 -3
- package/cpp/skia/modules/skottie/include/SkottieProperty.h +2 -0
- package/cpp/skia/modules/skottie/include/TextShaper.h +1 -0
- package/cpp/skia/modules/skshaper/include/SkShaper.h +23 -1
- package/include/ReactNativeSkia.h +6 -0
- package/lib/commonjs/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/commonjs/external/reanimated/useVideo.js +8 -2
- package/lib/commonjs/external/reanimated/useVideo.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +11 -3
- package/lib/commonjs/renderer/Canvas.js +8 -6
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/components/Mask.js +3 -9
- package/lib/commonjs/renderer/components/Mask.js.map +1 -1
- package/lib/commonjs/skia/types/JsiInstance.d.ts +1 -0
- package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.js +7 -2
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +1 -6
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +12 -7
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -3
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkPathBuilder.js +2 -2
- package/lib/commonjs/skia/web/JsiSkPathBuilder.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextStyle.js +5 -5
- package/lib/commonjs/skia/web/JsiSkTextStyle.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +0 -3
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js +8 -8
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/commonjs/sksg/Recorder/DrawingContext.js +15 -0
- package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js +6 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +12 -9
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +15 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Shaders.js +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js +3 -0
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.js +2 -12
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +247 -57
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +19 -8
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -1
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/useVideo.js +8 -2
- package/lib/module/external/reanimated/useVideo.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +11 -3
- package/lib/module/renderer/Canvas.js +7 -5
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/components/Mask.js +3 -9
- package/lib/module/renderer/components/Mask.js.map +1 -1
- package/lib/module/skia/types/JsiInstance.d.ts +1 -0
- package/lib/module/skia/types/JsiInstance.js.map +1 -1
- package/lib/module/skia/types/Matrix4.js +7 -2
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +1 -6
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +12 -7
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/module/skia/web/JsiSkPathBuilder.js +2 -2
- package/lib/module/skia/web/JsiSkPathBuilder.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextStyle.js +5 -5
- package/lib/module/skia/web/JsiSkTextStyle.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +0 -3
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/web/JsiSkottieAnimation.js +8 -8
- package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -1
- package/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/module/sksg/Recorder/DrawingContext.js +15 -0
- package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +1 -1
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +6 -1
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.js +12 -9
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js +15 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.js +3 -0
- package/lib/module/specs/SkiaPictureViewNativeComponent.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +2 -12
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +247 -57
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/views/types.d.ts +19 -8
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +0 -1
- package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/typescript/lib/module/mock/index.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/typescript/react-native.config.d.ts +3 -0
- package/lib/typescript/src/renderer/Canvas.d.ts +11 -3
- package/lib/typescript/src/skia/types/JsiInstance.d.ts +1 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +1 -6
- package/lib/typescript/src/skia/web/JsiSkPathBuilder.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +1 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -0
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.web.d.ts +3 -1
- package/lib/typescript/src/views/types.d.ts +19 -8
- package/package.json +15 -12
- package/react-native-skia.podspec +4 -10
- package/react-native.config.js +5 -0
- package/src/dom/nodes/datatypes/Rect.ts +6 -1
- package/src/external/reanimated/useVideo.ts +7 -2
- package/src/mock/index.ts +0 -1
- package/src/renderer/Canvas.tsx +23 -5
- package/src/renderer/components/Mask.tsx +10 -3
- package/src/skia/types/JsiInstance.ts +2 -0
- package/src/skia/types/Matrix4.ts +6 -2
- package/src/skia/types/Skia.ts +1 -7
- package/src/skia/web/JsiSkCanvas.ts +22 -12
- package/src/skia/web/JsiSkImage.ts +6 -3
- package/src/skia/web/JsiSkPathBuilder.ts +2 -2
- package/src/skia/web/JsiSkTextStyle.ts +20 -15
- package/src/skia/web/JsiSkia.ts +0 -4
- package/src/skia/web/JsiSkottieAnimation.ts +8 -8
- package/src/sksg/Recorder/DrawingContext.ts +15 -0
- package/src/sksg/Recorder/Player.ts +1 -1
- package/src/sksg/Recorder/Visitor.ts +9 -6
- package/src/sksg/Recorder/commands/Drawing.ts +12 -9
- package/src/sksg/Recorder/commands/ImageFilters.ts +20 -1
- package/src/sksg/Recorder/commands/Shaders.ts +1 -1
- package/src/specs/SkiaPictureViewNativeComponent.ts +5 -0
- package/src/specs/SkiaPictureViewNativeComponent.web.ts +5 -0
- package/src/views/SkiaPictureView.tsx +2 -10
- package/src/views/SkiaPictureView.web.tsx +245 -57
- package/src/views/types.ts +23 -10
- package/android/src/latest/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -11
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +0 -79
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaAHBView.java +0 -113
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +0 -136
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +0 -41
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerInterface.java +0 -20
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerDelegate.java +0 -35
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaWebGPUViewManagerInterface.java +0 -17
- package/android/src/paper/java/com/shopify/reactnative/skia/NativeSkiaModuleSpec.java +0 -38
- package/android/src/reactnative74/java/com/shopify/reactnative/skia/ReactNativeCompatible.java +0 -14
- package/apple/SkiaPictureViewManager.h +0 -8
- package/apple/SkiaPictureViewManager.mm +0 -60
- package/apple/SkiaWebGPUView.h +0 -20
- package/apple/WebGPUMetalView.h +0 -12
- package/cpp/api/JsiSkiaContext.h +0 -94
- package/cpp/dawn/include/dawn/dawn_proc.h +0 -53
- package/cpp/dawn/include/dawn/dawn_proc_table.h +0 -330
- package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +0 -47
- package/cpp/dawn/include/dawn/dawn_version.h +0 -41
- package/cpp/dawn/include/dawn/native/D3D11Backend.h +0 -65
- package/cpp/dawn/include/dawn/native/D3D12Backend.h +0 -103
- package/cpp/dawn/include/dawn/native/D3DBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/DawnNative.h +0 -368
- package/cpp/dawn/include/dawn/native/MetalBackend.h +0 -56
- package/cpp/dawn/include/dawn/native/NullBackend.h +0 -39
- package/cpp/dawn/include/dawn/native/OpenGLBackend.h +0 -89
- package/cpp/dawn/include/dawn/native/VulkanBackend.h +0 -183
- package/cpp/dawn/include/dawn/native/WebGPUBackend.h +0 -49
- package/cpp/dawn/include/dawn/native/dawn_native_export.h +0 -49
- package/cpp/dawn/include/dawn/platform/DawnPlatform.h +0 -207
- package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +0 -49
- package/cpp/dawn/include/dawn/replay/Replay.h +0 -99
- package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +0 -49
- package/cpp/dawn/include/dawn/webgpu_cpp_print.h +0 -2856
- package/cpp/dawn/include/tint/tint.h +0 -91
- package/cpp/dawn/include/webgpu/webgpu.h +0 -5029
- package/cpp/dawn/include/webgpu/webgpu_cpp.h +0 -10353
- package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +0 -57
- package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +0 -162
- package/cpp/dawn/include/webgpu/webgpu_glfw.h +0 -88
- package/cpp/jsi/RuntimeAwareCache.cpp +0 -7
- package/cpp/jsi/RuntimeAwareCache.h +0 -117
- package/cpp/jsi/RuntimeLifecycleMonitor.cpp +0 -72
- package/cpp/jsi/RuntimeLifecycleMonitor.h +0 -32
- package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +0 -45
- package/cpp/skia/src/gpu/graphite/ResourceTypes.h +0 -360
- package/cpp/skia/src/gpu/graphite/TextureProxyView.h +0 -105
- package/libs/.graphite +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
Copyright
|
|
1
|
+
Copyright 2026-present, William Candillon
|
|
2
|
+
Copyright 2021-2026, Shopify Inc.
|
|
2
3
|
|
|
3
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
5
|
|
package/Package.swift
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// swift-tools-version: 6.0
|
|
2
|
+
//
|
|
3
|
+
// SwiftPM manifest for @shopify/react-native-skia. iOS, Ganesh.
|
|
4
|
+
// Additive: the CocoaPods podspec remains the supported default.
|
|
5
|
+
//
|
|
6
|
+
// React Native 0.87+ references a library that ships its own Package.swift
|
|
7
|
+
// through a symlink at <app>/ios/build/generated/autolinking/libs/<name>, and
|
|
8
|
+
// resolves the relative paths below against that symlink. They are the same
|
|
9
|
+
// for every standard app, because the symlink location is.
|
|
10
|
+
|
|
11
|
+
import Foundation
|
|
12
|
+
import PackageDescription
|
|
13
|
+
|
|
14
|
+
// Skia's xcframeworks are ~200MB and are not carried in this package. They come
|
|
15
|
+
// from the react-native-skia-apple-ios npm package, which @shopify/react-native-skia
|
|
16
|
+
// depends on, so a checkout that has installed its dependencies builds offline.
|
|
17
|
+
// Xcode passes the symlink as the package directory, hence resolvingSymlinks.
|
|
18
|
+
let packageRoot = URL(fileURLWithPath: Context.packageDirectory)
|
|
19
|
+
.resolvingSymlinksInPath().path
|
|
20
|
+
|
|
21
|
+
let binariesPath = [
|
|
22
|
+
"../../react-native-skia-apple-ios", // consumer: sibling in node_modules
|
|
23
|
+
"../../node_modules/react-native-skia-apple-ios", // this monorepo
|
|
24
|
+
]
|
|
25
|
+
.map { "\(packageRoot)/\($0)" }
|
|
26
|
+
.first { FileManager.default.fileExists(atPath: "\($0)/Package.swift") }
|
|
27
|
+
|
|
28
|
+
guard let binariesPath else {
|
|
29
|
+
// Reached when the package was skipped at install time (`--omit=optional`,
|
|
30
|
+
// or a non-Apple `os` filter), which SwiftPM would otherwise report as an
|
|
31
|
+
// unresolvable dependency path.
|
|
32
|
+
fatalError(
|
|
33
|
+
"""
|
|
34
|
+
react-native-skia-apple-ios was not found next to @shopify/react-native-skia. \
|
|
35
|
+
It ships the prebuilt Skia binaries this package links against. Reinstall \
|
|
36
|
+
dependencies without --omit=optional, on macOS.
|
|
37
|
+
""")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let package = Package(
|
|
41
|
+
name: "ReactNativeSkia",
|
|
42
|
+
platforms: [.iOS(.v15)],
|
|
43
|
+
products: [
|
|
44
|
+
// Autolinking looks this name up verbatim; react-native.config.js pins it.
|
|
45
|
+
.library(name: "ReactNativeSkia", targets: ["ReactNativeSkia"])
|
|
46
|
+
],
|
|
47
|
+
dependencies: [
|
|
48
|
+
.package(name: "React-GeneratedCode", path: "../../../ios"),
|
|
49
|
+
.package(name: "ReactNative", path: "../../../../xcframeworks"),
|
|
50
|
+
.package(path: binariesPath),
|
|
51
|
+
],
|
|
52
|
+
targets: [
|
|
53
|
+
.target(
|
|
54
|
+
name: "ReactNativeSkia",
|
|
55
|
+
dependencies: [
|
|
56
|
+
.product(name: "ReactHeaders", package: "ReactNative"),
|
|
57
|
+
.product(name: "ReactNativeHeaders", package: "ReactNative"),
|
|
58
|
+
.product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
|
|
59
|
+
.product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
|
|
60
|
+
.product(name: "react-native-skia-apple-ios", package: "react-native-skia-apple-ios"),
|
|
61
|
+
],
|
|
62
|
+
// apple/ and cpp/ have no common ancestor below the package root, and
|
|
63
|
+
// .headerSearchPath cannot escape the target path.
|
|
64
|
+
path: ".",
|
|
65
|
+
exclude: [
|
|
66
|
+
"cpp/rnskia/RNDawnWindowContext.cpp", // Graphite only
|
|
67
|
+
"cpp/rnskia/RNDawnInterop.cpp", // Graphite only
|
|
68
|
+
],
|
|
69
|
+
// Explicit, so SwiftPM never walks node_modules, lib, android, or the
|
|
70
|
+
// headers-only cpp/skia — which carries x86 AVX skcms sources that
|
|
71
|
+
// cannot build for arm64.
|
|
72
|
+
sources: [
|
|
73
|
+
"apple",
|
|
74
|
+
"cpp/api",
|
|
75
|
+
"cpp/jsi",
|
|
76
|
+
"cpp/rnskia",
|
|
77
|
+
"cpp/utils",
|
|
78
|
+
// libskottie.a needs skjson and Apple builds no libskjson archive.
|
|
79
|
+
// CocoaPods compiles this via its cpp/**/*.cpp glob.
|
|
80
|
+
"cpp/skia/modules/jsonreader/SkJSONReader.cpp",
|
|
81
|
+
],
|
|
82
|
+
cxxSettings: [
|
|
83
|
+
// Replaces the podspec's recursive cpp/** glob, which expands to 90.
|
|
84
|
+
.headerSearchPath("cpp"), // "api/…", "jsi/…", "utils/…"
|
|
85
|
+
.headerSearchPath("cpp/skia"), // "include/core/…", "modules/…", "src/…"
|
|
86
|
+
.headerSearchPath("cpp/rnskia"), // apple/ uses bare "RNSkView.h"
|
|
87
|
+
.headerSearchPath("cpp/utils"), // apple/ uses bare "RNSkLog.h"
|
|
88
|
+
|
|
89
|
+
// CocoaPods defines both project-wide for a New Architecture app; the
|
|
90
|
+
// SwiftPM path defines neither. Skia's own sources no longer gate on
|
|
91
|
+
// them, but React's headers do (RCT_REMOVE_LEGACY_ARCH hides the
|
|
92
|
+
// legacy bridge API), so mirror what CocoaPods does.
|
|
93
|
+
.define("RCT_NEW_ARCH_ENABLED", to: "1"),
|
|
94
|
+
.define("RCT_REMOVE_LEGACY_ARCH", to: "1"),
|
|
95
|
+
|
|
96
|
+
.define("SK_METAL", to: "1"),
|
|
97
|
+
.define("SK_GANESH", to: "1"),
|
|
98
|
+
.define("SK_IMAGE_READ_PIXELS_DISABLE_LEGACY_API", to: "1"),
|
|
99
|
+
.define("SK_DISABLE_LEGACY_SHAPER_FACTORY", to: "1"),
|
|
100
|
+
|
|
101
|
+
// React's prebuilt C++ ABI is NDEBUG-gated, and Skia derives
|
|
102
|
+
// SK_RELEASE from it. Omitting either breaks the Release link.
|
|
103
|
+
.define("DEBUG", .when(configuration: .debug)),
|
|
104
|
+
.define("NDEBUG", .when(configuration: .release)),
|
|
105
|
+
],
|
|
106
|
+
linkerSettings: [
|
|
107
|
+
.linkedFramework("MetalKit"),
|
|
108
|
+
.linkedFramework("AVFoundation"),
|
|
109
|
+
.linkedFramework("AVKit"),
|
|
110
|
+
.linkedFramework("CoreMedia"),
|
|
111
|
+
]
|
|
112
|
+
)
|
|
113
|
+
],
|
|
114
|
+
// React Native's headers need C++20, and so does Skia m152: SkMathPriv.h
|
|
115
|
+
// calls std::countl_zero, std::countr_zero and std::popcount.
|
|
116
|
+
cxxLanguageStandard: .cxx20
|
|
117
|
+
)
|
package/android/CMakeLists.txt
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
project(RNSkia)
|
|
2
2
|
cmake_minimum_required(VERSION 3.4.1)
|
|
3
3
|
|
|
4
|
-
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
5
4
|
set (CMAKE_CXX_STANDARD 20)
|
|
6
5
|
|
|
7
6
|
# SKIA_LIBS_PATH is passed from Gradle (pointing at the prebuilt Skia binaries,
|
|
@@ -48,20 +47,7 @@ set (SKIA_SKSG_LIB "sksg")
|
|
|
48
47
|
set (SKIA_JSONREADER_LIB "jsonreader")
|
|
49
48
|
|
|
50
49
|
|
|
51
|
-
# Clear some variables
|
|
52
|
-
unset(LIBRN_DIR CACHE)
|
|
53
|
-
unset(libfbjni_link_DIRS CACHE)
|
|
54
|
-
unset(libfbjni_include_DIRS CACHE)
|
|
55
|
-
|
|
56
|
-
set(build_DIR ${CMAKE_SOURCE_DIR}/build)
|
|
57
|
-
file(GLOB LIBRN_DIR "${PREBUILT_DIR}/${ANDROID_ABI}")
|
|
58
|
-
file(GLOB libfbjni_link_DIRS "${build_DIR}/fbjni*.aar/jni/${ANDROID_ABI}")
|
|
59
|
-
file(GLOB libfbjni_include_DIRS "${build_DIR}/fbjni-*-headers.jar/")
|
|
60
|
-
|
|
61
50
|
message("-- ABI : " ${ANDROID_ABI})
|
|
62
|
-
message("-- PREBUILT: " ${PREBUILT_DIR})
|
|
63
|
-
message("-- BUILD : " ${build_DIR})
|
|
64
|
-
message("-- LIBRN : " ${LIBRN_DIR})
|
|
65
51
|
|
|
66
52
|
link_directories(${SKIA_LIBS_PATH}/)
|
|
67
53
|
|
|
@@ -80,14 +66,6 @@ else()
|
|
|
80
66
|
)
|
|
81
67
|
endif()
|
|
82
68
|
|
|
83
|
-
if(${REACT_NATIVE_VERSION} LESS 66)
|
|
84
|
-
file(
|
|
85
|
-
TO_CMAKE_PATH
|
|
86
|
-
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
|
|
87
|
-
INCLUDE_JSI_CPP
|
|
88
|
-
)
|
|
89
|
-
endif()
|
|
90
|
-
|
|
91
69
|
add_library(
|
|
92
70
|
${PACKAGE_NAME}
|
|
93
71
|
SHARED
|
|
@@ -100,8 +78,7 @@ add_library(
|
|
|
100
78
|
"${PROJECT_SOURCE_DIR}/cpp/rnskia-android/AHardwareBufferUtils.cpp"
|
|
101
79
|
"${PROJECT_SOURCE_DIR}/cpp/rnskia-android/RNSkAndroidVideo.cpp"
|
|
102
80
|
|
|
103
|
-
"${PROJECT_SOURCE_DIR}/../cpp/jsi/
|
|
104
|
-
"${PROJECT_SOURCE_DIR}/../cpp/jsi/RuntimeAwareCache.cpp"
|
|
81
|
+
"${PROJECT_SOURCE_DIR}/../cpp/jsi/JSICache.cpp"
|
|
105
82
|
"${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiPromises.cpp"
|
|
106
83
|
"${PROJECT_SOURCE_DIR}/../cpp/jsi/Promise.cpp"
|
|
107
84
|
|
|
@@ -146,8 +123,6 @@ target_include_directories(
|
|
|
146
123
|
|
|
147
124
|
# Shared JSI infrastructure (cpp/jsi) via prefix-qualified includes
|
|
148
125
|
../cpp
|
|
149
|
-
|
|
150
|
-
${libfbjni_include_DIRS}
|
|
151
126
|
)
|
|
152
127
|
|
|
153
128
|
add_library(svg STATIC IMPORTED)
|
|
@@ -190,113 +165,9 @@ find_library(
|
|
|
190
165
|
)
|
|
191
166
|
message("-- LOG : " ${LOG_LIB})
|
|
192
167
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
find_package(ReactAndroid REQUIRED CONFIG)
|
|
197
|
-
endif()
|
|
198
|
-
|
|
199
|
-
unset(JSI_LIB CACHE)
|
|
200
|
-
if(${REACT_NATIVE_VERSION} LESS 66)
|
|
201
|
-
# JSI lib didn't exist on RN 0.65 and before. Simply omit it.
|
|
202
|
-
set (JSI_LIB "")
|
|
203
|
-
elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
|
|
204
|
-
# RN 0.71 distributes prebuilt binaries.
|
|
205
|
-
set (JSI_LIB ReactAndroid::jsi)
|
|
206
|
-
else()
|
|
207
|
-
# RN 0.66 distributes libjsi.so, can be used instead of compiling jsi.cpp manually.
|
|
208
|
-
find_library(
|
|
209
|
-
JSI_LIB
|
|
210
|
-
jsi
|
|
211
|
-
PATHS ${LIBRN_DIR}
|
|
212
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
213
|
-
)
|
|
214
|
-
endif()
|
|
215
|
-
message("-- JSI : " ${JSI_LIB})
|
|
216
|
-
|
|
217
|
-
unset(REACT_LIB CACHE)
|
|
218
|
-
if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
|
|
219
|
-
# RN 0.76 packs react_nativemodule_core into ReactAndroid::reactnative
|
|
220
|
-
set (REACT_LIB ReactAndroid::reactnative)
|
|
221
|
-
elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
|
|
222
|
-
# RN 0.71 distributes prebuilt binaries.
|
|
223
|
-
set (REACT_LIB ReactAndroid::react_nativemodule_core)
|
|
224
|
-
else()
|
|
225
|
-
find_library(
|
|
226
|
-
REACT_LIB
|
|
227
|
-
react_nativemodule_core
|
|
228
|
-
PATHS ${LIBRN_DIR}
|
|
229
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
230
|
-
)
|
|
231
|
-
endif()
|
|
232
|
-
message("-- REACT : " ${REACT_LIB})
|
|
233
|
-
|
|
234
|
-
unset(FBJNI_LIBRARY CACHE)
|
|
235
|
-
if(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
|
|
236
|
-
# RN 0.71 distributes prebuilt binaries.
|
|
237
|
-
set (FBJNI_LIBRARY fbjni::fbjni)
|
|
238
|
-
else()
|
|
239
|
-
find_library(
|
|
240
|
-
FBJNI_LIBRARY
|
|
241
|
-
fbjni
|
|
242
|
-
PATHS ${libfbjni_link_DIRS}
|
|
243
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
244
|
-
)
|
|
245
|
-
endif()
|
|
246
|
-
message("-- FBJNI : " ${FBJNI_LIBRARY})
|
|
247
|
-
|
|
248
|
-
unset(REACTNATIVEJNI_LIB CACHE)
|
|
249
|
-
if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
|
|
250
|
-
# RN 0.76 doesn't have reactnativejni
|
|
251
|
-
# DO NOTHING, we'll not link these libraries
|
|
252
|
-
elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
|
|
253
|
-
# RN 0.71 distributes prebuilt binaries.
|
|
254
|
-
set (REACTNATIVEJNI_LIB "ReactAndroid::reactnativejni")
|
|
255
|
-
else()
|
|
256
|
-
find_library(
|
|
257
|
-
REACTNATIVEJNI_LIB
|
|
258
|
-
reactnativejni
|
|
259
|
-
PATHS ${LIBRN_DIR}
|
|
260
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
261
|
-
)
|
|
262
|
-
endif()
|
|
263
|
-
message("-- REACTNATIVEJNI : " ${REACTNATIVEJNI_LIB})
|
|
264
|
-
|
|
265
|
-
unset(RUNTIMEEXECUTOR_LIB CACHE)
|
|
266
|
-
if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
|
|
267
|
-
# RN 0.76 doesn't have runtimeexecutor
|
|
268
|
-
# DO NOTHING, we'll not link these libraries
|
|
269
|
-
elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
|
|
270
|
-
# RN 0.71 distributes prebuilt binaries.
|
|
271
|
-
set (RUNTIMEEXECUTOR_LIB "ReactAndroid::runtimeexecutor")
|
|
272
|
-
else()
|
|
273
|
-
find_library(
|
|
274
|
-
RUNTIMEEXECUTOR_LIB
|
|
275
|
-
runtimeexecutor
|
|
276
|
-
PATHS ${LIBRN_DIR}
|
|
277
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
278
|
-
)
|
|
279
|
-
endif()
|
|
280
|
-
message("-- RUNTIMEEXECUTOR : " ${RUNTIMEEXECUTOR_LIB})
|
|
281
|
-
|
|
282
|
-
unset(TURBOMODULES_LIB CACHE)
|
|
283
|
-
if(${REACT_NATIVE_VERSION} GREATER_EQUAL 76)
|
|
284
|
-
# RN 0.76 doesn't have turbomodulejsijni
|
|
285
|
-
# DO NOTHING, we'll not link these libraries
|
|
286
|
-
elseif(${REACT_NATIVE_VERSION} GREATER_EQUAL 71)
|
|
287
|
-
# RN 0.71 distributes prebuilt binaries.
|
|
288
|
-
set (TURBOMODULES_LIB "ReactAndroid::turbomodulejsijni")
|
|
289
|
-
else()
|
|
290
|
-
find_library(
|
|
291
|
-
TURBOMODULES_LIB
|
|
292
|
-
turbomodulejsijni
|
|
293
|
-
PATHS ${LIBRN_DIR}
|
|
294
|
-
NO_CMAKE_FIND_ROOT_PATH
|
|
295
|
-
)
|
|
296
|
-
endif()
|
|
297
|
-
message("-- TURBO : " ${TURBOMODULES_LIB})
|
|
298
|
-
|
|
299
|
-
add_definitions(-DREACT_NATIVE_VERSION=${REACT_NATIVE_VERSION})
|
|
168
|
+
# React Native distributes prebuilt binaries via prefab.
|
|
169
|
+
find_package(fbjni REQUIRED CONFIG)
|
|
170
|
+
find_package(ReactAndroid REQUIRED CONFIG)
|
|
300
171
|
|
|
301
172
|
# Set RN_SERIALIZABLE_STATE and C++ flags for React Native 0.81+
|
|
302
173
|
if(${REACT_NATIVE_VERSION} GREATER_EQUAL 80)
|
|
@@ -308,50 +179,25 @@ else()
|
|
|
308
179
|
endif()
|
|
309
180
|
|
|
310
181
|
# Link
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
)
|
|
331
|
-
else()
|
|
332
|
-
set(COMMON_LIBS
|
|
333
|
-
${LOG_LIB}
|
|
334
|
-
${FBJNI_LIBRARY}
|
|
335
|
-
${REACT_LIB}
|
|
336
|
-
${JSI_LIB}
|
|
337
|
-
${REACTNATIVEJNI_LIB}
|
|
338
|
-
${RUNTIMEEXECUTOR_LIB}
|
|
339
|
-
${TURBOMODULES_LIB}
|
|
340
|
-
${SKIA_SVG_LIB}
|
|
341
|
-
${SKIA_SKSHAPER_LIB}
|
|
342
|
-
${SKIA_SKPARAGRAPH_LIB}
|
|
343
|
-
${SKIA_SKUNICODE_CORE_LIB}
|
|
344
|
-
${SKIA_SKUNICODE_ICU_LIB}
|
|
345
|
-
${SKIA_SKOTTIE_LIB}
|
|
346
|
-
${SKIA_SKSG_LIB}
|
|
347
|
-
${SKIA_JSONREADER_LIB}
|
|
348
|
-
${SKIA_LIB}
|
|
349
|
-
-ljnigraphics
|
|
350
|
-
-lGLESv2
|
|
351
|
-
-lEGL
|
|
352
|
-
-landroid
|
|
353
|
-
)
|
|
354
|
-
endif()
|
|
182
|
+
set(COMMON_LIBS
|
|
183
|
+
${LOG_LIB}
|
|
184
|
+
ReactAndroid::reactnative
|
|
185
|
+
fbjni::fbjni
|
|
186
|
+
ReactAndroid::jsi
|
|
187
|
+
${SKIA_SVG_LIB}
|
|
188
|
+
${SKIA_SKSHAPER_LIB}
|
|
189
|
+
${SKIA_SKPARAGRAPH_LIB}
|
|
190
|
+
${SKIA_SKUNICODE_CORE_LIB}
|
|
191
|
+
${SKIA_SKUNICODE_ICU_LIB}
|
|
192
|
+
${SKIA_SKOTTIE_LIB}
|
|
193
|
+
${SKIA_SKSG_LIB}
|
|
194
|
+
${SKIA_JSONREADER_LIB}
|
|
195
|
+
${SKIA_LIB}
|
|
196
|
+
-ljnigraphics
|
|
197
|
+
-lGLESv2
|
|
198
|
+
-lEGL
|
|
199
|
+
-landroid
|
|
200
|
+
)
|
|
355
201
|
|
|
356
202
|
if(SK_GRAPHITE)
|
|
357
203
|
target_link_libraries(${PACKAGE_NAME}
|
|
@@ -361,8 +207,6 @@ if(SK_GRAPHITE)
|
|
|
361
207
|
else()
|
|
362
208
|
target_link_libraries(${PACKAGE_NAME}
|
|
363
209
|
${COMMON_LIBS}
|
|
364
|
-
-lGLESv2
|
|
365
|
-
-lEGL
|
|
366
210
|
)
|
|
367
211
|
endif()
|
|
368
212
|
|