From 5d897c74fd4e379c48b10a8fd780fd3179743a4a Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 13 Oct 2021 14:12:37 +0200 Subject: [PATCH 1/2] fix: Fix "folly" header not found by including the header search path --- VisionCamera.podspec | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/VisionCamera.podspec b/VisionCamera.podspec index 8cfe1c6df6..d11bafdf7a 100644 --- a/VisionCamera.podspec +++ b/VisionCamera.podspec @@ -2,6 +2,24 @@ require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) +reactVersion = '0.0.0' +begin + reactVersion = JSON.parse(File.read(File.join(__dir__, "..", "react-native", "package.json")))["version"] +rescue + reactVersion = '0.66.0' +end +rnVersion = reactVersion.split('.')[1] + +folly_prefix = "" +if rnVersion.to_i >= 64 + folly_prefix = "RCT-" +end + +folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=' + rnVersion +folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32' +folly_version = '2021.04.26.00' +boost_compiler_flags = '-Wno-documentation' + Pod::Spec.new do |s| s.name = "VisionCamera" s.version = package["version"] @@ -13,11 +31,16 @@ Pod::Spec.new do |s| s.platforms = { :ios => "11.0" } s.source = { :git => "https://github.com/mrousavy/react-native-vision-camera.git", :tag => "#{s.version}" } - s.pod_target_xcconfig = { - "DEFINES_MODULE" => "YES", + s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Public/React-hermes\" \"$(PODS_ROOT)/Headers/Public/hermes-engine\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" " } + s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags + s.xcconfig = { + "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"", + "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags } + s.requires_arc = true # All source files that should be publicly visible From bbef3d9d5c83f405f7cdc4cc5605c99d5173cc6f Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 13 Oct 2021 14:13:52 +0200 Subject: [PATCH 2/2] cleanup --- VisionCamera.podspec | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/VisionCamera.podspec b/VisionCamera.podspec index d11bafdf7a..3f588c3f56 100644 --- a/VisionCamera.podspec +++ b/VisionCamera.podspec @@ -10,11 +10,6 @@ rescue end rnVersion = reactVersion.split('.')[1] -folly_prefix = "" -if rnVersion.to_i >= 64 - folly_prefix = "RCT-" -end - folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=' + rnVersion folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32' folly_version = '2021.04.26.00' @@ -31,15 +26,16 @@ Pod::Spec.new do |s| s.platforms = { :ios => "11.0" } s.source = { :git => "https://github.com/mrousavy/react-native-vision-camera.git", :tag => "#{s.version}" } - s.pod_target_xcconfig = { + s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" " + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" " } s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags - s.xcconfig = { + s.xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"", - "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags } + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"", + "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + } s.requires_arc = true