Skip to content

Commit

Permalink
Fixed podspec to support use_frameworks (#1400)
Browse files Browse the repository at this point in the history
When using the Firebase library we are required to add `use_frameworks! :linkage => :static` to the Pod file of the consuming app. This has until now caused some issues with building Skia on iOS (a workaround exists, but it shouldn't be necessary).

The reason for the problem is that RN Skia uses subspecs with header mappings (we are trying to preserve some of the file structure to make our external Skia includes build correctly) which isn't used when use_frameworks are set. This causes XCode to not find the include files.

This commit fixes this by removing the subspec and adding header search paths for the Skia pod. Only the pod file is changed, so this will not affect Android build.

fixes #652

Co-authored-by: William Candillon <[email protected]>
  • Loading branch information
chrfalch and wcandillon authored Mar 2, 2023
1 parent 2ba991a commit 9616857
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions package/react-native-skia.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SK_GL=1 SK_METAL=1',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
'DEFINES_MODULE' => 'YES'
'DEFINES_MODULE' => 'YES',
"HEADER_SEARCH_PATHS" => '"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/" ' +
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/api/" ' +
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/rnskia/" ' +
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/rnskia/dom/" ' +
'"$(PODS_ROOT)/../../node_modules/@shopify/react-native-skia/cpp/skia/"'
}

s.frameworks = 'GLKit', 'MetalKit'
Expand All @@ -40,33 +45,9 @@ Pod::Spec.new do |s|
# All iOS cpp/h files
s.source_files = [
"ios/**/*.{h,c,cc,cpp,m,mm,swift}",
"cpp/**/*.{h,cpp}"
]

s.subspec 'SkiaHeaders' do |ss|
ss.header_mappings_dir = 'cpp/skia'
ss.source_files = "cpp/skia/**/*.{h,cpp}"
end

s.subspec 'Utils' do |ss|
ss.header_mappings_dir = 'cpp/utils'
ss.source_files = "cpp/utils/**/*.{h,cpp}"
end

s.subspec 'Jsi' do |ss|
ss.header_mappings_dir = 'cpp/jsi'
ss.source_files = "cpp/jsi/**/*.{h,cpp}"
end

s.subspec 'Api' do |ss|
ss.header_mappings_dir = 'cpp/api'
ss.source_files = "cpp/api/**/*.{h,cpp}"
end

s.subspec 'RNSkia' do |ss|
ss.header_mappings_dir = 'cpp/rnskia'
ss.source_files = "cpp/rnskia/**/*.{h,cpp}"
end

s.dependency "React"
s.dependency "React-callinvoker"
s.dependency "React-Core"
Expand Down

0 comments on commit 9616857

Please sign in to comment.