Skip to content

Commit

Permalink
Add support for C++17 in OSS
Browse files Browse the repository at this point in the history
Summary: changelog: Add support for C++17

Reviewed By: cortinico

Differential Revision: D34612257

fbshipit-source-id: 88a0307a750f2e0793a639b7a2b670a4571332fe
  • Loading branch information
sammy-SC authored and facebook-github-bot committed Mar 4, 2022
1 parent 4eef075 commit c2e4ae3
Show file tree
Hide file tree
Showing 25 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Libraries/Blob/React-RCTBlob.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTBlob"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Image/React-RCTImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTImage"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/LinkingIOS/React-RCTLinking.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTLinking"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/NativeAnimation/React-RCTAnimation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTAnimation"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Network/React-RCTNetwork.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTNetwork"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}
s.frameworks = "MobileCoreServices"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTPushNotification"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}
s.framework = "UserNotifications"
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Settings/React-RCTSettings.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTSettings"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/TypeSafety/RCTTypeSafety.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTTypeSafety"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/Libraries/TypeSafety\" \"$(PODS_ROOT)/RCT-Folly\""
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Vibration/React-RCTVibration.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTVibration"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}
s.frameworks = "AudioToolbox"
Expand Down
2 changes: 1 addition & 1 deletion React/CoreModules/React-CoreModules.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Pod::Spec.new do |s|
s.header_dir = "CoreModules"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/React/CoreModules\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\""
}

Expand Down
2 changes: 1 addition & 1 deletion React/FBReactNativeSpec/FBReactNativeSpec.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Pod::Spec.new do |s|

s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\""
}

Expand Down
2 changes: 1 addition & 1 deletion React/React-RCTFabric.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Pod::Spec.new do |s|
s.header_dir = "React"
s.framework = "JavaScriptCore"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Public/React-Codegen\"" }
s.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\"",
s.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\"", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags }

s.dependency "React-Core", version
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ NDK_MODULE_PATH := $(APP_MK_DIR)$(HOST_DIRSEP)$(THIRD_PARTY_NDK_DIR)$(HOST_DIRSE
APP_STL := c++_shared

APP_CFLAGS := -Wall -Werror -fexceptions -frtti -DWITH_INSPECTOR=1
APP_CPPFLAGS := -std=c++1y
APP_CPPFLAGS := -std=c++17
# Make sure every shared lib includes a .note.gnu.build-id header
APP_LDFLAGS := -Wl,--build-id

Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/first-party/fb/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ oss_cxx_library(
"-fexceptions",
"-Wall",
"-Werror",
"-std=c++14",
"-std=c++17",
"-DDISABLE_CPUCAP",
"-DDISABLE_XPLAT",
],
Expand Down
4 changes: 2 additions & 2 deletions ReactAndroid/src/main/jni/react/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)
# ./../ == react
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../..

LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture -std=c++17

LOCAL_LDLIBS += -landroid

Expand Down Expand Up @@ -79,7 +79,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)
# ./../ == react
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../..

LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture
LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture -std=c++17

LOCAL_LDLIBS += -landroid

Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/ReactCommon.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Pod::Spec.new do |s|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\"",
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }

# TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
# Note: Update this only when ready to minimize breaking changes.
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/tests/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jni_instrumentation_test_lib(
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-std=c++17",
],
soname = "libxplat-bridge.so",
visibility = [
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/microprofiler/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cxx_library(
compiler_flags = [
"-Wall",
"-Werror",
"-std=c++14",
"-std=c++17",
"-fexceptions",
"-fno-data-sections",
],
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/yoga/Yoga.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Pod::Spec.new do |spec|
'-fexceptions',
'-Wall',
'-Werror',
'-std=c++1y',
'-std=c++17',
'-fPIC'
]

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-codegen/DEFS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def rn_codegen_components(
compiler_flags = [
"-fexceptions",
"-frtti",
"-std=c++14",
"-std=c++17",
"-Wall",
],
contacts = ["oncall+react_native@xmail.facebook.com"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Pod::Spec.new do |s|
s.author = "Facebook, Inc. and its affiliates"
s.source = { :git => "https://github.com/facebook/my-native-view.git", :tag => "#{s.version}" }
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\""
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\"",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}

s.source_files = "ios/**/*.{h,m,mm,cpp}"
Expand Down
36 changes: 18 additions & 18 deletions packages/rn-tester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: b81a2b70c72d8b0aefb652cea22c11e9ffd02949
FBReactNativeSpec: 35cca37e6328d64b4e38c4adb1a28db74b60aeac
FBReactNativeSpec: 04dbf2a5d787706cace2f2af8ff3790333b761cd
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c
Expand All @@ -898,14 +898,14 @@ SPEC CHECKSUMS:
glog: 476ee3e89abb49e07f822b48323c51c57124b572
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 803a9cfd78114b2ec0f140cfa6fa2a6bafb2d685
RCT-Folly: 4d8508a426467c48885f1151029bc15fa5d7b3b8
RCTRequired: af2d6080a4b9ba0885b28ca78879a92066c71cab
RCTTypeSafety: c7a7f67ae5b1b986b78d817baa408fc984ab7c0c
RCTTypeSafety: 2d6c5149fd3b8f2ba89987b47169423efb740300
React: f64c9f6db5428717922a3292ba6a448615a2e143
React-callinvoker: c5d61e29df57793f0dc10ec2bc01c846f863e51f
React-Codegen: 2256e335ccce7326eeca6d7a668e05c4de259289
React-Codegen: c4ae835565487e494740b756ce953d8f635a76df
React-Core: 30784d0eacbd709a3a6a5ae7c02c928634a6247e
React-CoreModules: a8e2bdc1ebbf8d440478456197abd58d1691f61a
React-CoreModules: e784fdac1d0293963fc06646aa76cfdcd906a754
React-cxxreact: cfc1663dae1ea52b465bbf021ef7b1527c5dc80c
React-Fabric: 30b8fa96a0c56d1c11348f77607464eb87bb3f9f
React-graphics: 9a84942b49ea1375ce83844041fa2ba766cfe0b9
Expand All @@ -915,21 +915,21 @@ SPEC CHECKSUMS:
React-logger: 2009c0280c286a76200d6b7c5fe242fad51ddd7a
React-perflogger: fe66bd6d8b17ebcfdf0159bf41fe28d8035ac20c
React-RCTActionSheet: 3131a0b9280aa0e51bdf54b3d79aecd8503db62c
React-RCTAnimation: 0c0a35cd27c5005cfddcda59b612994f4ebdaa43
React-RCTBlob: 48cae62d905ef96ab10c84ab16163643a3c872a7
React-RCTFabric: c126a269f6279896e19e133d6b1e019fa2f0f028
React-RCTImage: 2ce3f1f72de91798eb31c9001b30cab8d1c71c4e
React-RCTLinking: 77300bd3cda2a613845ae0056b62ad330c2d319d
React-RCTNetwork: 8ef793740f893987384918e04382d37fac36960d
React-RCTPushNotification: 1845de920c2583f4541e13b3e9bd20a2ba896ffa
React-RCTSettings: 2beadc19336aa83a49e9ee9f704157c64799e840
React-RCTTest: 12bbd7fc2e72bd9920dc7286c5b8ef96639582b6
React-RCTAnimation: 218e2557f9803c1d8b4fd814b6c54b223ee18cda
React-RCTBlob: f94c621fa9851a5f81da471016ce5d91d29b2c7f
React-RCTFabric: 134127990b95158033ff22db25f5474d4aeecc96
React-RCTImage: 996407b090e9fa8bb2213b6887676b1541052cb5
React-RCTLinking: 6fcb5735f35935e0e53dc45e97f77234d7920232
React-RCTNetwork: 2d51ae6d31c26bbcaab9abd56e523f8010cc57ae
React-RCTPushNotification: c5dfa4ab4da2b5312223334a55b30527218197d4
React-RCTSettings: 9f897f32b7c4d0bc9a2718b7cb7d4f193889f5e3
React-RCTTest: 7cbcd615b1e74ad59c9ad4257e6c323482114173
React-RCTText: e9146b2c0550a83d1335bfe2553760070a2d75c7
React-RCTVibration: 50be9c390f2da76045ef0dfdefa18b9cf9f35cfa
React-rncore: d292b6c2196dcd555622a538e1b206aa2e0ad8a2
React-RCTVibration: 9a73a3550a0ee184530341f91f9b85ad9cf3465a
React-rncore: 69bf49af24eafcd61f1e352c0cbff5cf17e70ed4
React-runtimeexecutor: 4b0c6eb341c7d3ceb5e2385cb0fdb9bf701024f3
ReactCommon: 7a2714d1128f965392b6f99a8b390e3aa38c9569
ScreenshotManager: e8da2e62b3c08a87cece436776ce91555ecec77c
ReactCommon: 9607f2246289d573adcbd144c02c19ae5246d6a5
ScreenshotManager: 2e9d0bca1461f67405d21ca06a609cb844c3fb3c
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: c0d06f5380d34e939f55420669a60fe08b79bd75
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
Expand Down
2 changes: 1 addition & 1 deletion packages/rn-tester/RCTTest/React-RCTTest.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Pod::Spec.new do |s|
s.header_dir = "RCTTest"
s.pod_target_xcconfig = {
"USE_HEADERMAP" => "YES",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\""
}

Expand Down
4 changes: 2 additions & 2 deletions packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -925,7 +925,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down
2 changes: 1 addition & 1 deletion scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def get_react_codegen_spec(options={})
'homepage' => 'https://facebook.com/',
'license' => 'Unlicense',
'authors' => 'Facebook',
'compiler_flags' => "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness",
'compiler_flags' => "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++17",
'source' => { :git => '' },
'header_mappings_dir' => './',
'platforms' => {
Expand Down

0 comments on commit c2e4ae3

Please sign in to comment.