From 392635aaa005977c6d72a98e064f56defc2da0b9 Mon Sep 17 00:00:00 2001 From: Osei Fortune Date: Fri, 9 Oct 2026 14:46:01 -0400 Subject: [PATCH] fix(audio-context): build on iOS without @nativescript/canvas AudioModule.mm includes the runtime's Runtime.h, whose headers include V8 by bare name ("v8.h"), so an app with only audio-context failed to build ('v8.h' file not found). It only worked when @nativescript/canvas was installed too, since canvas's build.xcconfig puts Headers/include on the search path. audio-context already ships the NativeScriptV8 SwiftPM shim; as in #180 for canvas-svg, add the shim's Headers/include to the search path and build as C++20 for V8 14.9. --- .../audio-context/platforms/ios/build.xcconfig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/audio-context/platforms/ios/build.xcconfig b/packages/audio-context/platforms/ios/build.xcconfig index 10bfdb5c5..a9cb162ee 100644 --- a/packages/audio-context/platforms/ios/build.xcconfig +++ b/packages/audio-context/platforms/ios/build.xcconfig @@ -1 +1,17 @@ OTHER_LDFLAGS = $(inherited) -framework "AVFoundation" -framework "Accelerate" -framework "MediaToolbox" -framework "AudioToolbox" -framework "CoreMedia" -framework "AudioContextNative" + +// V8 14.9's headers use C++20 concepts/requires-clauses (e.g. v8-internal.h). +CLANG_CXX_LANGUAGE_STANDARD = c++20 + +// AudioModule.mm includes the runtime's Runtime.h, whose headers include V8 by bare name +// ("v8.h", "v8config.h"), so the NativeScriptV8 shim's Headers/include must be on the path +// itself - the same reason @nativescript/canvas's build.xcconfig adds it, which used to +// mask this when both plugins were installed. 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 (where the shim isn't materialised). +AUDIO_CONTEXT_V8_HEADERS_NPM = $(SRCROOT)/../../node_modules/@nativescript/audio-context/platforms/ios/NativeScriptV8/Headers/include +AUDIO_CONTEXT_V8_HEADERS_MONOREPO = $(SRCROOT)/../../../../nativescript-v8/Headers/include +AUDIO_CONTEXT_V8_HEADER_FLAGS = -I"$(AUDIO_CONTEXT_V8_HEADERS_NPM)" -I"$(AUDIO_CONTEXT_V8_HEADERS_MONOREPO)" +OTHER_CFLAGS = $(inherited) $(AUDIO_CONTEXT_V8_HEADER_FLAGS) +OTHER_CPLUSPLUSFLAGS = $(inherited) $(AUDIO_CONTEXT_V8_HEADER_FLAGS)