Gui*_*uig 13 c++ realm ios 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",
]),
)
Run Code Online (Sandbox Code Playgroud)
使用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.
Run Code Online (Sandbox Code Playgroud)
我也尝试手动指定要包含的文件和标题,从那些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",
]
)
Run Code Online (Sandbox Code Playgroud)