c++ - 如何将 BUCK 构建与具有多个同名文件的 pod 一起使用?

标签 c++ ios realm cocoapods buck

我正在尝试将 BUCK 与 Realm pod 一起使用.

我已将我的 buck 文件设置为:

apple_pod_lib(
    name = "Realm",
    visibility = ["PUBLIC"],
    exported_headers = glob([
        "Realm/**/*.h",
        "Realm/**/*.hpp",
    ]),
    srcs = glob([
        "Realm/**/.{m,mm,cpp}",
    ]),
)

apple_pod_lib(
    name = "RealmSwift",
    visibility = ["PUBLIC"],
    swift_version = "4",
    deps = [
        "//Pods:Realm"
    ],
    srcs = glob([
        "RealmSwift/**/*.swift",
    ]),
)

使用 Airbnb 中的 pod 宏.

但是我无法构建我的项目,因为这失败了

In target '//Pods:Realm', 'Realm/history.hpp' maps to the following header files:
- /BuckSample/Pods/Realm/include/core/realm/sync/history.hpp
- /BuckSample/Pods/Realm/include/core/realm/history.hpp

Please rename one of them or export one of them to a different path.

我还尝试手动指定要包含的文件和 header ,查看这些 repos 中的 PodSpec,但我无法让它工作,因为我丢失了一些要在 Xcode 中编译的项目文件。

最佳答案

作为一种解决方法,我能够通过 Carthage 安装预构建的框架:

# Cartfile
github "realm/realm-cocoa"

# Carthage/BUCK
prebuilt_apple_framework(
    name = "Realm",
    framework = "Build/iOS/Realm.framework",
    preferred_linkage = "shared",
    visibility = ["PUBLIC"],
)

prebuilt_apple_framework(
    name = "RealmSwift",
    framework = "Build/iOS/RealmSwift.framework",
    preferred_linkage = "shared",
    visibility = ["PUBLIC"],
    deps = [
      ":Realm",
    ]
)

# Where my library is
apple_library(
    name = "LibraryWithRealm",
    visibility = ["PUBLIC"],
    swift_version = "5.0",
    modular = True,
    deps = [
        "//Carthage:RealmSwift",
    ]
)

关于c++ - 如何将 BUCK 构建与具有多个同名文件的 pod 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53846223/

相关文章:

c++ - 在 CvSVM 上需要帮助

c++ - fork 和传递套接字 c++

c++ - 使用 MSVC++ 编译器打包枚举

iphone - 核心数据 : sorting before saving

iphone - 核心数据 : Not able to add persistent store to coordinator

react-native - Realm :用户必须是 'object' 类型,得到(未定义)

java - 没有虚方法 getTable()Lio/realm/internal/TableOrView

android - 查询 realmObject,其中 realmList 等于另一个 realmList

c++ - 如何使用C++中的插槽图/对象池模式管理数百万个游戏对象?

iphone - 在 UITableView 中对大量行/节进行动画处理性能不佳