diff --git a/Libraries/AppDelegate/React-RCTAppDelegate.podspec b/Libraries/AppDelegate/React-RCTAppDelegate.podspec index 98dd9428135..fff87118479 100644 --- a/Libraries/AppDelegate/React-RCTAppDelegate.podspec +++ b/Libraries/AppDelegate/React-RCTAppDelegate.podspec @@ -23,6 +23,22 @@ new_arch_enabled_flag="RCT_NEW_ARCH_ENABLED" is_new_arch_enabled = ENV[new_arch_enabled_flag] == "1" other_cflags = "$(inherited) -DRN_FABRIC_ENABLED " + folly_flags + (is_new_arch_enabled ? " -D"+"RCT_NEW_ARCH_ENABLED" : "") +use_hermes = ENV['USE_HERMES'] == '1' + +header_search_paths = [ + "$(PODS_TARGET_SRCROOT)/ReactCommon", + "$(PODS_ROOT)/Headers/Private/React-Core", + "$(PODS_ROOT)/boost", + "$(PODS_ROOT)/DoubleConversion", + "$(PODS_ROOT)/RCT-Folly", + "${PODS_ROOT}/Headers/Public/FlipperKit", + "$(PODS_ROOT)/Headers/Public/ReactCommon", + "$(PODS_ROOT)/Headers/Public/React-RCTFabric" +].concat(use_hermes ? [ + "$(PODS_ROOT)/Headers/Public/React-hermes", + "$(PODS_ROOT)/Headers/Public/hermes-engine" +] : []).map{|p| "\"#{p}\""}.join(" ") + Pod::Spec.new do |s| s.name = "React-RCTAppDelegate" s.version = version @@ -38,7 +54,7 @@ Pod::Spec.new do |s| # This guard prevent to install the dependencies when we run `pod install` in the old architecture. s.compiler_flags = other_cflags s.pod_target_xcconfig = { - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"", + "HEADER_SEARCH_PATHS" => header_search_paths, "OTHER_CPLUSPLUSFLAGS" => other_cflags, "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" } diff --git a/React-Core.podspec b/React-Core.podspec index 5f8304882b6..6997029a839 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -20,6 +20,8 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 folly_version = '2021.07.22.00' boost_compiler_flags = '-Wno-documentation' +use_hermes = ENV['USE_HERMES'] == '1' + header_subspecs = { 'CoreModulesHeaders' => 'React/CoreModules/**/*.h', 'RCTActionSheetHeaders' => 'Libraries/ActionSheetIOS/*.h', @@ -34,6 +36,19 @@ header_subspecs = { 'RCTVibrationHeaders' => 'Libraries/Vibration/*.h', } +header_search_paths = [ + "$(PODS_TARGET_SRCROOT)/ReactCommon", + "$(PODS_ROOT)/boost", + "$(PODS_ROOT)/DoubleConversion", + "$(PODS_ROOT)/RCT-Folly", + "${PODS_ROOT}/Headers/Public/FlipperKit", + "$(PODS_ROOT)/Headers/Public/ReactCommon", + "$(PODS_ROOT)/Headers/Public/React-RCTFabric" +].concat(use_hermes ? [ + "$(PODS_ROOT)/Headers/Public/React-hermes", + "$(PODS_ROOT)/Headers/Public/hermes-engine" +] : []).map{|p| "\"#{p}\""}.join(" ") + Pod::Spec.new do |s| s.name = "React-Core" s.version = version @@ -48,12 +63,13 @@ 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/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"", - "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"", - "DEFINES_MODULE" => "YES", - "GCC_PREPROCESSOR_DEFINITIONS" => "RCT_METRO_PORT=${RCT_METRO_PORT}", - "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", - } + "HEADER_SEARCH_PATHS" => header_search_paths, + "DEFINES_MODULE" => "YES", + "GCC_PREPROCESSOR_DEFINITIONS" => "RCT_METRO_PORT=${RCT_METRO_PORT}", + "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", + }.merge!(use_hermes ? { + "FRAMEWORK_SEARCH_PATHS" => "\"$(PODS_CONFIGURATION_BUILD_DIR)/React-hermes\"" + } : {}) s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""} s.default_subspec = "Default" diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 3157a42e0be..983e7c5763d 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -67,6 +67,7 @@ def use_react_native! ( # Better to rely and enable this environment flag if the new architecture is turned on using flags. ENV['RCT_NEW_ARCH_ENABLED'] = new_arch_enabled ? "1" : "0" fabric_enabled = fabric_enabled || new_arch_enabled + ENV['USE_HERMES'] = hermes_enabled ? "1" : "0" prefix = path