diff --git a/packages/webgpu/Package.swift b/packages/webgpu/Package.swift index 1793b97bb..54780446f 100644 --- a/packages/webgpu/Package.swift +++ b/packages/webgpu/Package.swift @@ -128,6 +128,7 @@ if let skiaPath = nodePackage("react-native-skia"), // cpp/rnwgpu), so every directory that's the target of one of those bare // includes has to be listed explicitly here. The "webgpu/..." and "dawn/..." // includes resolve through the Dawn xcframework's embedded headers. +// Keep in sync with header_dirs in react-native-webgpu.podspec. let internalHeaderDirs = [ "apple", "cpp", diff --git a/packages/webgpu/react-native-webgpu.podspec b/packages/webgpu/react-native-webgpu.podspec index 49d84612f..09beace03 100644 --- a/packages/webgpu/react-native-webgpu.podspec +++ b/packages/webgpu/react-native-webgpu.podspec @@ -95,8 +95,14 @@ Pod::Spec.new do |s| s.frameworks = "AVFoundation", "CoreMedia", "CoreVideo", "ImageIO" end + # Under use_frameworks!, bare includes across folders (e.g. "GPU.h") + # resolve only through these paths. Keep in sync with internalHeaderDirs + # in Package.swift. + header_dirs = %w[apple cpp cpp/jsi cpp/rnwgpu cpp/rnwgpu/api cpp/rnwgpu/api/descriptors cpp/rnwgpu/async] + header_search_paths = header_dirs.map { |dir| "\"$(PODS_TARGET_SRCROOT)/#{dir}\"" } + s.pod_target_xcconfig = { - 'HEADER_SEARCH_PATHS' => "$(PODS_TARGET_SRCROOT)/cpp \"#{dawn_include}\"", + 'HEADER_SEARCH_PATHS' => (header_search_paths + ["\"#{dawn_include}\""]).join(' '), # Xcode's all-target headermaps let same-named headers leak across pods # (e.g. @shopify/react-native-skia keeps a jsi/ helper layer with # identical relative header paths). Resolve includes strictly through our