-
Notifications
You must be signed in to change notification settings - Fork 35
/
react-native-ios-context-menu.podspec
142 lines (115 loc) · 5.88 KB
/
react-native-ios-context-menu.podspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
reactNativeVersion = '0.0.0'
begin
reactNativeVersion = `node --print "require('react-native/package.json').version"`
rescue
reactNativeVersion = '0.0.0'
end
reactNativeTargetVersion = reactNativeVersion.split('.')[1].to_i
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
fabric_compiler_flags = '-DRN_FABRIC_ENABLED -DRCT_NEW_ARCH_ENABLED'
folly_version = '2022.05.16.00'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32'
linkage = ENV['USE_FRAMEWORKS']
puts "react-native-ios-context-menu"
puts " - reactNativeTargetVersion: #{reactNativeVersion}"
puts " - fabric_enabled: #{fabric_enabled}"
puts " - linkage: #{linkage}"
Pod::Spec.new do |s|
s.name = "react-native-ios-context-menu"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]
s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/dominicstop/react-native-ios-context-menu.git", :tag => "#{s.version}" }
s.swift_version = '5.4'
s.static_framework = true
s.header_dir = 'react-native-ios-context-menu'
header_search_paths = [
'"$(PODS_ROOT)/boost"',
'"$(PODS_ROOT)/DoubleConversion"',
'"$(PODS_ROOT)/RCT-Folly"',
'"${PODS_ROOT}/Headers/Public/React-hermes"',
'"${PODS_ROOT}/Headers/Public/hermes-engine"',
'"${PODS_ROOT}/Headers/Private/React-Core"',
'"${PODS_CONFIGURATION_BUILD_DIR}/React-rendererconsistency/React_rendererconsistency.framework/Headers"',
#'"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"',
#'"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-context-menu/Swift Compatibility Header"',
#'"${PODS_ROOT}/Headers/Public/react-native-ios-utilities"',
#'"${PODS_ROOT}/Headers/Private/react-native-ios-utilities"',
#'"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"',
]
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'USE_HEADERMAP' => 'YES',
'DEFINES_MODULE' => 'YES',
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
'SWIFT_COMPILATION_MODE' => 'wholemodule',
'HEADER_SEARCH_PATHS' => header_search_paths.join(' '),
"FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"",
'OTHER_SWIFT_FLAGS' => "$(inherited) #{fabric_enabled ? fabric_compiler_flags : ''}"
}
user_header_search_paths = [
'"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/**"',
'"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"',
'"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-context-menu/Swift Compatibility Header"',
#'"$(PODS_ROOT)/Headers/Private/react-native-ios-utilities"',
#'"$(PODS_ROOT)/Headers/Public/react-native-ios-utilities"',
'"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging"',
'"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers"',
'"$(PODS_ROOT)/Headers/Private/Yoga"',
]
if fabric_enabled && ENV['USE_FRAMEWORKS']
user_header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""
end
s.user_target_xcconfig = {
"HEADER_SEARCH_PATHS" => user_header_search_paths,
}
# s.xcconfig = {
# 'HEADER_SEARCH_PATHS' => [
# '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"',
# '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/**"',
# ],
# }
compiler_flags = folly_compiler_flags + ' ' + "-DREACT_NATIVE_TARGET_VERSION=#{reactNativeTargetVersion}"
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
compiler_flags += ' -DUSE_HERMES'
end
s.dependency 'React-Core'
s.dependency 'ReactCommon/turbomodule/core'
s.dependency 'React-RCTAppDelegate' if reactNativeTargetVersion >= 71
s.dependency 'React-NativeModulesApple' if reactNativeTargetVersion >= 72
s.dependency 'react-native-ios-utilities'
s.dependency 'DGSwiftUtilities'
s.dependency 'ContextMenuAuxiliaryPreview', '~> 0.5'
if fabric_enabled
compiler_flags << ' ' << fabric_compiler_flags
s.dependency 'React-RCTFabric'
s.dependency 'RCT-Folly', folly_version
end
unless defined?(install_modules_dependencies)
# `install_modules_dependencies` is defined from react_native_pods.rb.
# when running with `pod ipc spec`, this method is not defined and we have to require manually.
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
end
install_modules_dependencies(s)
s.source_files = 'ios/**/*.{h,m,mm,swift,cpp}', 'common/cpp/**/*.{h,cpp}'
exclude_files = ['ios/Tests/']
if !fabric_enabled
exclude_files.append('ios/Fabric/')
exclude_files.append('common/cpp/fabric/')
end
s.public_header_files = 'ios/**/*.h'
s.exclude_files = exclude_files
s.compiler_flags = compiler_flags
s.private_header_files = ['ios/**/*+Private.h', 'ios/**/Swift.h']
end