1 | require "json"
|
2 |
|
3 | package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
4 |
|
5 | new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
6 | platform = new_arch_enabled ? "11.0" : "9.0"
|
7 | source_files = new_arch_enabled ? 'ios/**/*.{h,m,mm,cpp}' : ["ios/**/*.{h,m,mm}", "cpp/**/*.{cpp,h}"]
|
8 |
|
9 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
10 |
|
11 |
|
12 | class RNScreensDependencyHelper
|
13 |
|
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 |
|
27 |
|
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
|
51 | end
|
52 |
|
53 | Pod::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"
|
67 | s.requires_arc = true
|
68 |
|
69 | if defined?(install_modules_dependencies()) != nil
|
70 | install_modules_dependencies(s)
|
71 |
|
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
|
77 | end
|