Skip to content

Commit 5b32348

Browse files
cipolleschiRiccardo Cipolleschi
authored and
Riccardo Cipolleschi
committed
Add compiler flag for the new Arch when enabled. (#35672)
Summary: Pull Request resolved: #35672 While working on some example, I discovered that the helper function `install_module_dependencies` was not adding the proper `-DRCT_NEW_ARCH_ENABLED=1` flag to the compiler flags. ## Changelog: [iOS][Fixed] - Make sure to add the New Arch flag to libraries Reviewed By: jacdebug Differential Revision: D42131287 fbshipit-source-id: 68c492150ba4e4a2ec726b3e8b8a9c7842b543bc
1 parent aaa795b commit 5b32348

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

scripts/cocoapods/__tests__/new_architecture-test.rb

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths
125125
assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)
126126
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\"")
127127
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
128+
assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
128129
assert_equal(
129130
spec.dependencies,
130131
[

scripts/cocoapods/new_architecture.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,13 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version)
7676
spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}"
7777
current_config["HEADER_SEARCH_PATHS"] = current_headers.empty? ? boost_search_path : "#{current_headers} #{boost_search_path}"
7878
current_config["CLANG_CXX_LANGUAGE_STANDARD"] = @@cplusplus_version
79-
spec.pod_target_xcconfig = current_config
79+
8080

8181
spec.dependency "React-Core"
8282
spec.dependency "RCT-Folly", '2021.07.22.00'
8383

8484
if new_arch_enabled
85+
current_config["OTHER_CPLUSPLUSFLAGS"] = @@new_arch_cpp_flags
8586
spec.dependency "React-RCTFabric" # This is for Fabric Component
8687
spec.dependency "React-Codegen"
8788

@@ -90,6 +91,8 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version)
9091
spec.dependency "ReactCommon/turbomodule/bridging"
9192
spec.dependency "ReactCommon/turbomodule/core"
9293
end
94+
95+
spec.pod_target_xcconfig = current_config
9396
end
9497

9598
def self.folly_compiler_flags

0 commit comments

Comments
 (0)