Skip to content

Commit 40ad31e

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Set C++ version for libs (facebook#35160)
Summary: Pull Request resolved: facebook#35160 With the simplified migration to the new arch, we are offering a function in cocoapods that takes care of configuring all the dependencies for libraries. That function was not setting the proper version of C++ for the library. This could lead to build problems. This Diff make sure that the libraries that are created with this function call have the proper C++ version. NOTE: we already have a post install hook that was setting the the proper C++ version, but that was only working for the project. Plus, we can't read that version from the React-Core podspec because at the podspec definition time, cocoapods has not read that yet. Therefore, I just hardcoded the C++ version on top of the file, so it will be easier to update if we decide to change it. ## Changelog [iOS][Fixed] - Make sure that libraries created with `install_modules_dependencies` has the right C++ version. Reviewed By: dmytrorykun Differential Revision: D40894561 fbshipit-source-id: a5187be2d85888a335d4c033f16fdacaf2c945f9
1 parent 1e6945e commit 40ad31e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

scripts/cocoapods/__tests__/new_architecture-test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPaths
124124
# Assert
125125
assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)
126126
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\"")
127+
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
127128
assert_equal(
128129
spec.dependencies,
129130
[
@@ -152,6 +153,7 @@ def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompiler
152153
# Assert
153154
assert_equal(spec.compiler_flags, "-Wno-nullability-completeness #{NewArchitectureHelper.folly_compiler_flags}")
154155
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\"")
156+
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
155157
assert_equal(
156158
spec.dependencies,
157159
[

scripts/cocoapods/new_architecture.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class NewArchitectureHelper
1010

1111
@@new_arch_cpp_flags = "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 #{@@shared_flags}"
1212

13+
@@cplusplus_version = "c++17"
14+
1315
def self.set_clang_cxx_language_standard_if_needed(installer)
1416
language_standard = nil
1517

@@ -73,6 +75,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version)
7375

7476
spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}"
7577
current_config["HEADER_SEARCH_PATHS"] = current_headers.empty? ? boost_search_path : "#{current_headers} #{boost_search_path}"
78+
current_config["CLANG_CXX_LANGUAGE_STANDARD"] = @@cplusplus_version
7679
spec.pod_target_xcconfig = current_config
7780

7881
spec.dependency "React-Core"

0 commit comments

Comments
 (0)