如何使用具有多个具有相同名称的文件的Pod进行BUCK构建?

时间:2018-12-19 07:11:10

标签: 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.

我还尝试手动指定要包括的文件和头,从那些存储库中查看PodSpec,但由于当时缺少一些文件以便在Xcode中进行编译,因此我无法使其工作。

1 个答案:

答案 0 :(得分:0)

作为一种解决方法,我能够通过迦太基通过以下方式安装预构建的框架:

# 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",
    ]
)