Skip to content

Commit 9517320

Browse files
Enable C++17 for cxxreact and jsiexecutor/inspector and ... (#35435)
Summary: Pull Request resolved: #35435 This raises the C++ language standard to C++17 which is needed to remove some folly:: dependencies changelog: [Internal] Reviewed By: cortinico Differential Revision: D41482821 fbshipit-source-id: 62af6e95e6e78378112a4ce4e9c3ab7df0587218
1 parent e6cba99 commit 9517320

File tree

11 files changed

+21
-6
lines changed

11 files changed

+21
-6
lines changed

ReactAndroid/src/main/jni/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif(CCACHE_FOUND)
1717

1818
# Make sure every shared lib includes a .note.gnu.build-id header
1919
add_link_options(-Wl,--build-id)
20-
add_compile_options(-Wall -Werror -std=c++1y)
20+
add_compile_options(-Wall -Werror -std=c++17)
2121

2222
function(add_react_android_subdir relative_path)
2323
add_subdirectory(${REACT_ANDROID_DIR}/${relative_path} ReactAndroid/${relative_path})

ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ target_compile_options(
2525
${HERMES_TARGET_NAME}
2626
PRIVATE
2727
$<$<CONFIG:Debug>:-DHERMES_ENABLE_DEBUGGER=1>
28+
-std=c++17
2829
-fexceptions
2930
)
3031
target_include_directories(${HERMES_TARGET_NAME} PRIVATE .)

ReactCommon/cxxreact/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(CMAKE_VERBOSE_MAKEFILE on)
99
add_compile_options(
1010
-fexceptions
1111
-frtti
12+
-std=c++17
1213
-Wno-unused-lambda-capture
1314
-DLOG_TAG=\"ReactNative\")
1415

ReactCommon/cxxreact/React-cxxreact.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ Pod::Spec.new do |s|
3333
s.source_files = "*.{cpp,h}"
3434
s.exclude_files = "SampleCxxModule.*"
3535
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
36-
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
36+
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
37+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
3738
s.header_dir = "cxxreact"
3839

3940
s.dependency "boost", "1.76.0"

ReactCommon/hermes/React-hermes.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Pod::Spec.new do |s|
4040
s.public_header_files = "executor/HermesExecutorFactory.h"
4141
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
4242
s.pod_target_xcconfig = {
43-
"HEADER_SEARCH_PATHS" => "\"${PODS_ROOT}/hermes-engine/destroot/include\" \"$(PODS_TARGET_SRCROOT)/..\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include\""
43+
"HEADER_SEARCH_PATHS" => "\"${PODS_ROOT}/hermes-engine/destroot/include\" \"$(PODS_TARGET_SRCROOT)/..\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include\"",
44+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
4445
}.merge!(build_type == :debug ? { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } : {})
4546
s.header_dir = "reacthermes"
4647
s.dependency "React-cxxreact", version

ReactCommon/hermes/executor/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
cmake_minimum_required(VERSION 3.13)
77
set(CMAKE_VERBOSE_MAKEFILE on)
88

9+
add_compile_options(-std=c++17)
10+
911
file(GLOB_RECURSE hermes_executor_SRC CONFIGURE_DEPENDS *.cpp)
1012
add_library(
1113
hermes-executor-common

ReactCommon/hermes/inspector/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ target_compile_options(
1717
PRIVATE
1818
-DHERMES_ENABLE_DEBUGGER=1
1919
-DHERMES_INSPECTOR_FOLLY_KLUDGE=1
20+
-std=c++17
2021
-fexceptions
2122
)
2223

ReactCommon/jsiexecutor/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
cmake_minimum_required(VERSION 3.13)
77
set(CMAKE_VERBOSE_MAKEFILE on)
88

9-
add_compile_options(-fexceptions -frtti -O3)
9+
add_compile_options(
10+
-fexceptions
11+
-frtti
12+
-std=c++17
13+
-O3)
1014

1115
add_library(jsireact
1216
STATIC

ReactCommon/jsiexecutor/React-jsiexecutor.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ Pod::Spec.new do |s|
3131
s.source = source
3232
s.source_files = "jsireact/*.{cpp,h}"
3333
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
34-
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
34+
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
35+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
3536
s.header_dir = "jsireact"
3637

3738
s.dependency "React-cxxreact", version

ReactCommon/jsinspector/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
cmake_minimum_required(VERSION 3.13)
77
set(CMAKE_VERBOSE_MAKEFILE on)
88

9-
add_compile_options(-fexceptions)
9+
add_compile_options(
10+
-fexceptions
11+
-std=c++17)
1012

1113
file(GLOB jsinspector_SRC CONFIGURE_DEPENDS *.cpp)
1214
add_library(jsinspector SHARED ${jsinspector_SRC})

0 commit comments

Comments
 (0)