Skip to content

Commit 972d6a6

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Add compiler flag for the new Arch when enabled.
Summary: 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 Differential Revision: D42131287 fbshipit-source-id: f6eb077b38c3e55af75ef771a1aa09ca2f498cdc
1 parent 76a1445 commit 972d6a6

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/cocoapods/__tests__/new_architecture-test.rb

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 1 deletion
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)