Skip to content

Commit

Permalink
Add compiler flag for the new Arch when enabled. (#35672)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cipolleschi authored and Riccardo Cipolleschi committed Dec 19, 2022
1 parent aaa795b commit 5b32348
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions scripts/cocoapods/__tests__/new_architecture-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths
assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\"")
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
assert_equal(
spec.dependencies,
[
Expand Down
5 changes: 4 additions & 1 deletion scripts/cocoapods/new_architecture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version)
spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}"
current_config["HEADER_SEARCH_PATHS"] = current_headers.empty? ? boost_search_path : "#{current_headers} #{boost_search_path}"
current_config["CLANG_CXX_LANGUAGE_STANDARD"] = @@cplusplus_version
spec.pod_target_xcconfig = current_config


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

if new_arch_enabled
current_config["OTHER_CPLUSPLUSFLAGS"] = @@new_arch_cpp_flags
spec.dependency "React-RCTFabric" # This is for Fabric Component
spec.dependency "React-Codegen"

Expand All @@ -90,6 +91,8 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version)
spec.dependency "ReactCommon/turbomodule/bridging"
spec.dependency "ReactCommon/turbomodule/core"
end

spec.pod_target_xcconfig = current_config
end

def self.folly_compiler_flags
Expand Down

0 comments on commit 5b32348

Please sign in to comment.