UNPKG

2.99 kBPlain TextView Raw
1require "json"
2
3package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
5new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
6platform = new_arch_enabled ? "11.0" : "9.0"
7source_files = new_arch_enabled ? 'ios/**/*.{h,m,mm,cpp}' : ["ios/**/*.{h,m,mm}", "cpp/**/*.{cpp,h}"]
8
9folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
10
11# Helper class to avoid clashing with Cocoapods install_dependencies function
12class RNScreensDependencyHelper
13 # Helper class to add the Common subspec
14 def self.add_common_subspec(s, new_arch_enabled)
15 unless new_arch_enabled
16 return
17 end
18
19 s.subspec "common" do |ss|
20 ss.source_files = ["common/cpp/**/*.{cpp,h}", "cpp/**/*.{cpp,h}"]
21 ss.header_dir = "rnscreens"
22 ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/common/cpp\"" }
23 end
24 end
25
26 # Function to support older versions of React Native which do not provide the
27 # install_modules_dependencies function
28 def self.install_dependencies(s, new_arch_enabled)
29 if new_arch_enabled
30 s.pod_target_xcconfig = {
31 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly"',
32 "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
33 }
34
35 s.compiler_flags = folly_compiler_flags + ' ' + '-DRCT_NEW_ARCH_ENABLED'
36
37 s.dependency "React"
38 s.dependency "React-RCTFabric"
39 s.dependency "React-Codegen"
40 s.dependency "RCT-Folly"
41 s.dependency "RCTRequired"
42 s.dependency "RCTTypeSafety"
43 s.dependency "ReactCommon/turbomodule/core"
44
45 self.add_common_subspec(s, new_arch_enabled)
46 else
47 s.dependency "React-Core"
48 s.dependency "React-RCTImage"
49 end
50 end
51end
52
53Pod::Spec.new do |s|
54 s.name = "RNScreens"
55 s.version = package["version"]
56 s.summary = package["description"]
57 s.description = <<-DESC
58 RNScreens - first incomplete navigation solution for your React Native app
59 DESC
60 s.homepage = "https://github.com/software-mansion/react-native-screens"
61 s.license = "MIT"
62 s.author = { "author" => "author@domain.cn" }
63 s.platforms = { :ios => platform, :tvos => "11.0", :visionos => "1.0" }
64 s.source = { :git => "https://github.com/software-mansion/react-native-screens.git", :tag => "#{s.version}" }
65 s.source_files = source_files
66 s.project_header_files = "cpp/**/*.h" # Don't expose C++ headers publicly to allow importing framework into Swift files
67 s.requires_arc = true
68
69 if defined?(install_modules_dependencies()) != nil
70 install_modules_dependencies(s)
71 # Add missing dependencies, that were not included in install_modules_dependencies
72 s.dependency "React-RCTImage"
73 RNScreensDependencyHelper.add_common_subspec(s, new_arch_enabled)
74 else
75 RNScreensDependencyHelper.install_dependencies(s, new_arch_enabled)
76 end
77end