Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions packages/canvas-svg/nativescript.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { NativeScriptConfig } from '@nativescript/core';

export default {
ios: {
SPMPackages: [
{
name: 'CanvasNative',
libs: ['NativeScriptV8'],
// Header-only SwiftPM shim (V8 headers + empty stub) shipped inside
// this npm package — same shim @nativescript/canvas ships, so the SVG
// sources compile without @nativescript/canvas installed. The CLI
// dedupes same-name packages across plugins, so installing both
// plugins adds it only once. Referenced by local path on purpose: a
// repositoryURL reference makes SwiftPM clone the canvas repo's
// entire multi-GB git history just to read Package.swift.
path: 'node_modules/@nativescript/canvas-svg/platforms/ios/NativeScriptV8',
},
],
},
visionos: {
SPMPackages: [
{
name: 'CanvasNative',
libs: ['NativeScriptV8'],
path: 'node_modules/@nativescript/canvas-svg/platforms/ios/NativeScriptV8',
},
],
},
tvos: {
SPMPackages: [
{
name: 'CanvasNative',
libs: ['NativeScriptV8'],
path: 'node_modules/@nativescript/canvas-svg/platforms/ios/NativeScriptV8',
},
],
},
} as NativeScriptConfig;
19 changes: 18 additions & 1 deletion packages/canvas-svg/platforms/ios/build.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,21 @@ OTHER_LDFLAGS[sdk=xros*] = $(inherited) -framework Foundation -framework CanvasS
OTHER_LDFLAGS[sdk=xrsimulator*] = $(inherited) -framework Foundation -framework CanvasSVG
OTHER_LDFLAGS[sdk=appletvos*] = $(inherited) -framework Foundation -framework CanvasSVG
OTHER_LDFLAGS[sdk=appletvsimulator*] = $(inherited) -framework Foundation -framework CanvasSVG
OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Foundation -framework CanvasSVG
OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Foundation -framework CanvasSVG

// V8 14.9's headers use C++20 concepts/requires-clauses (e.g. v8-internal.h).
CLANG_CXX_LANGUAGE_STANDARD = c++20

// The NativeScriptV8 SwiftPM shim (nativescript.config.ts) puts its Headers dir on the
// search path, which resolves "include/v8.h". The V8 headers then include each other by
// bare name (cppgc/common.h -> "v8config.h"), which needs Headers/include itself on the
// path too - the same reason @nativescript/canvas's build.xcconfig adds it. Passed as -I
// flags rather than HEADER_SEARCH_PATHS, which the CLI's xcconfig merge would let drop
// the CocoaPods paths, and named apart from canvas's so both plugins' flags are kept.
// Two roots, as in canvas: an installed plugin, and this monorepo's demo apps (whose
// node_modules link packages/canvas-svg, where the shim isn't materialised).
CANVAS_SVG_V8_HEADERS_NPM = $(SRCROOT)/../../node_modules/@nativescript/canvas-svg/platforms/ios/NativeScriptV8/Headers/include
CANVAS_SVG_V8_HEADERS_MONOREPO = $(SRCROOT)/../../../../nativescript-v8/Headers/include
CANVAS_SVG_V8_HEADER_FLAGS = -I"$(CANVAS_SVG_V8_HEADERS_NPM)" -I"$(CANVAS_SVG_V8_HEADERS_MONOREPO)"
OTHER_CFLAGS = $(inherited) $(CANVAS_SVG_V8_HEADER_FLAGS)
OTHER_CPLUSPLUSFLAGS = $(inherited) $(CANVAS_SVG_V8_HEADER_FLAGS)
17 changes: 17 additions & 0 deletions packages/canvas-svg/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,28 @@
"assets": [
"packages/canvas-svg/*.md",
"packages/canvas-svg/index.d.ts",
"packages/canvas-svg/nativescript.config.ts",
"LICENSE",
{
"glob": "**/*",
"input": "packages/canvas-svg/platforms/",
"output": "./platforms/"
},
{
"glob": "Package.swift",
"input": "nativescript-v8/",
"output": "./platforms/ios/NativeScriptV8/"
},
{
"glob": "**/*",
"input": "nativescript-v8/Headers/",
"output": "./platforms/ios/NativeScriptV8/Headers/",
"ignore": ["**/.gitignore"]
},
{
"glob": "**/*",
"input": "nativescript-v8/Sources/",
"output": "./platforms/ios/NativeScriptV8/Sources/"
}
],
"dependsOn": [
Expand Down
Loading