Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.

Commit 9fd0a9e

Browse files
author
Riccardo Cipolleschi
committed
[TurboModule] Set up podspec file
1 parent 1c13c75 commit 9fd0a9e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [[TurboModule] Add the JavaScript specs](#js-spec)
99
* [[TurboModule] Set up CodeGen](#codegen)
1010
* [[TurboModule] Set up build.gradle](#android-gradle)
11+
* [[TurboModule] Set up podspec file](#ios-autolinking)
1112

1213
## Steps
1314

@@ -322,3 +323,28 @@ end
322323
dependencies {
323324
implementation 'com.facebook.react:react-native:+'
324325
}
326+
327+
### <a name="ios-autolinking" />[[TurboModule] Set up `podspec` file](https://github.com/cipolleschi/RNNewArchitectureLibraries/commit/)
328+
329+
1. Open the `calculator/calculator.podspec` file
330+
1. Before the `Pod::Spec.new do |s|` add the following code:
331+
```ruby
332+
folly_version = '2021.07.22.00'
333+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
334+
```
335+
1. Before the `end ` tag, add the following code
336+
```ruby
337+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
338+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
339+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
340+
s.pod_target_xcconfig = {
341+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
342+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
343+
}
344+
345+
s.dependency "React-Codegen"
346+
s.dependency "RCT-Folly", folly_version
347+
s.dependency "RCTRequired"
348+
s.dependency "RCTTypeSafety"
349+
s.dependency "ReactCommon/turbomodule/core"
350+
end

calculator/calculator.podspec

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
44

5+
folly_version = '2021.07.22.00'
6+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
7+
58
Pod::Spec.new do |s|
69
s.name = "calculator"
710
s.version = package["version"]
@@ -16,4 +19,19 @@ Pod::Spec.new do |s|
1619
s.source_files = "ios/**/*.{h,m,mm,swift}"
1720

1821
s.dependency "React-Core"
22+
23+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
24+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
25+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
26+
s.pod_target_xcconfig = {
27+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
28+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
29+
}
30+
31+
s.dependency "React-Codegen"
32+
s.dependency "RCT-Folly", folly_version
33+
s.dependency "RCTRequired"
34+
s.dependency "RCTTypeSafety"
35+
s.dependency "ReactCommon/turbomodule/core"
36+
end
1937
end

0 commit comments

Comments
 (0)