XCode C++,如何使用 cocoapods 的 boost 依赖?

XCode C++, how to use boost dependency from cocoapods?

我正在为 iOS 和 React-Native 创建一个 C++ 库。我需要从 boost 框架访问一些帮助程序代码,React-Native 本身已经作为依赖项。

但是,当我尝试包含 header 时,Xcode 告诉我找不到它:

我的库本身打算打包为 Cocoapods 依赖项,因此,我尝试将 boost 依赖项添加到 .podspec 但这似乎没有做任何事情来暴露 headers.

require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

Pod::Spec.new do |s|
  s.name         = "react-native-wallet-core"
  s.version      = package["version"]
  s.summary      = package["description"]
  s.homepage     = package["homepage"]
  s.license      = package["license"]
  s.authors      = package["author"]

  s.platforms    = { :ios => "14.0" }
  s.source       = { :git => "---.git", :tag => "#{s.version}" }


  s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{h,cpp}"

  s.dependency "React-Core"
  s.dependency "TrustWalletCore", '~>2.7.2'
  # Doesn't seem to do anything
  s.dependency "boost"
  # doesn't work cannot use path in a podspec
  # s.dependency "boost", path: "../node_modules/react-native/third-party-podspecs/boost.podspec" 
end

知道我需要做什么才能在我自己的 C++ 代码中使用 boost 代码吗?

我让它工作了,显然即使声明了依赖关系并且它是 react-native 的一部分,header 路径也不是立即可用的,需要添加 header 搜索路径作为 podspec 本身的一部分:

  s.pod_target_xcconfig = {
    "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/libevent/include/\""
  }
  s.user_target_xcconfig = {
    "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\""
  }