Skip to content

Commit

Permalink
Enable C++17 for cxxreact and jsiexecutor/inspector and ... (facebook…
Browse files Browse the repository at this point in the history
…#35435)

Summary:
Pull Request resolved: facebook#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
  • Loading branch information
christophpurrer authored and OlimpiaZurek committed May 22, 2023
1 parent c366193 commit 89de58c
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ReactAndroid/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif(CCACHE_FOUND)

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

function(add_react_android_subdir relative_path)
add_subdirectory(${REACT_ANDROID_DIR}/${relative_path} ReactAndroid/${relative_path})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ target_compile_options(
${HERMES_TARGET_NAME}
PRIVATE
$<$<CONFIG:Debug>:-DHERMES_ENABLE_DEBUGGER=1>
-std=c++17
-fexceptions
)
target_include_directories(${HERMES_TARGET_NAME} PRIVATE .)
Expand Down
1 change: 1 addition & 0 deletions ReactCommon/cxxreact/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(
-fexceptions
-frtti
-std=c++17
-Wno-unused-lambda-capture
-DLOG_TAG=\"ReactNative\")

Expand Down
3 changes: 2 additions & 1 deletion ReactCommon/cxxreact/React-cxxreact.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ Pod::Spec.new do |s|
s.source_files = "*.{cpp,h}"
s.exclude_files = "SampleCxxModule.*"
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\"" }
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
s.header_dir = "cxxreact"

s.dependency "boost", "1.76.0"
Expand Down
3 changes: 2 additions & 1 deletion ReactCommon/hermes/React-hermes.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Pod::Spec.new do |s|
s.public_header_files = "executor/HermesExecutorFactory.h"
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.pod_target_xcconfig = {
"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\""
"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\"",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}.merge!(build_type == :debug ? { "GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=1" } : {})
s.header_dir = "reacthermes"
s.dependency "React-cxxreact", version
Expand Down
2 changes: 2 additions & 0 deletions ReactCommon/hermes/executor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

add_compile_options(-std=c++17)

file(GLOB_RECURSE hermes_executor_SRC CONFIGURE_DEPENDS *.cpp)
add_library(
hermes-executor-common
Expand Down
1 change: 1 addition & 0 deletions ReactCommon/hermes/inspector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ target_compile_options(
PRIVATE
-DHERMES_ENABLE_DEBUGGER=1
-DHERMES_INSPECTOR_FOLLY_KLUDGE=1
-std=c++17
-fexceptions
)

Expand Down
6 changes: 5 additions & 1 deletion ReactCommon/jsiexecutor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

add_compile_options(-fexceptions -frtti -O3)
add_compile_options(
-fexceptions
-frtti
-std=c++17
-O3)

add_library(jsireact
STATIC
Expand Down
3 changes: 2 additions & 1 deletion ReactCommon/jsiexecutor/React-jsiexecutor.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "jsireact/*.{cpp,h}"
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\"" }
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
s.header_dir = "jsireact"

s.dependency "React-cxxreact", version
Expand Down
4 changes: 3 additions & 1 deletion ReactCommon/jsinspector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

add_compile_options(-fexceptions)
add_compile_options(
-fexceptions
-std=c++17)

file(GLOB jsinspector_SRC CONFIGURE_DEPENDS *.cpp)
add_library(jsinspector SHARED ${jsinspector_SRC})
Expand Down
1 change: 1 addition & 0 deletions ReactCommon/jsinspector/React-jsinspector.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "*.{cpp,h}"
s.header_dir = 'jsinspector'
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
end

0 comments on commit 89de58c

Please sign in to comment.