Skip to content

Commit

Permalink
Set RN version
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jan 13, 2025
1 parent febed96 commit 609945f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,7 @@ SPEC CHECKSUMS:
glog: 08b301085f15bcbb6ff8632a8ebaf239aae04e6a
hermes-engine: 1949ca944b195a8bde7cbf6316b9068e19cf53c6
NitroImage: ff97c5986ea4619abd3d6399b886eac84f5a4b65
NitroModules: a34f99b308a3bb5d4fc37cdb532d9ea44899442c
NitroModules: 9d5bc0172f6d9b098eb29e8cd9891e16881cd4b6
RCT-Folly: 84578c8756030547307e4572ab1947de1685c599
RCTDeprecation: 063fc281b30b7dc944c98fe53a7e266dab1a8706
RCTRequired: 8eda2a5a745f6081157a4f34baac40b65fe02b31
Expand Down
23 changes: 17 additions & 6 deletions packages/react-native-nitro-modules/NitroModules.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require "json"
require_relative './nitro_pod_utils'

package = JSON.parse(File.read(File.join(__dir__, "package.json")))
react_native_version = get_react_native_version()

Pod::UI.puts "[NitroModules] 🔥 Your app is boosted by nitro modules!"

Expand Down Expand Up @@ -55,18 +54,30 @@ Pod::Spec.new do |s|
"ios/utils/SwiftClosure.hpp",
]

compiler_flags = "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES"
if has_react_native()
react_native_version = get_react_native_version()
compiler_flags += " HAS_REACT_NATIVE REACT_NATIVE_VERSION=#{react_native_version}"
end

s.pod_target_xcconfig = {
# Use C++ 20
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
# Enables C++ <-> Swift interop (by default it's only C)
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
# Enables stricter modular headers
"DEFINES_MODULE" => "YES",
# C++ compiler flags, mainly for folly.
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES REACT_NATIVE_VERSION=#{react_native_version}"
# C++ compiler flags, mainly for RN version and folly.
"GCC_PREPROCESSOR_DEFINITIONS" => compiler_flags
}

s.dependency 'React-jsi'
s.dependency 'React-callinvoker'
install_modules_dependencies(s)
if has_react_native()
# Using Nitro in react-native
s.dependency 'React-jsi'
s.dependency 'React-callinvoker'
install_modules_dependencies(s)
else
# Using Nitro somewhere else (NativeScript? Bare iOS?)
raise "Couldn't find react-native - are you trying to use Nitro outside of React Native?"
end
end

0 comments on commit 609945f

Please sign in to comment.