[英]What is the best way to integrate a CMake project into Buck?
I am using Buck for my own C++ project, but I depend on a third-party library that is built using CMake. 我正在使用Buck作为我自己的C ++项目,但我依赖于使用CMake构建的第三方库。 The CMake file is complex, so I do not think it is practical to recreate their CMake file in Buck.
CMake文件很复杂,所以我认为在Buck中重新创建他们的CMake文件是不切实际的。 Instead, I would like to call CMake from Buck.
相反,我想打电话给巴克的CMake。
What is the best way to call CMake from Buck? 从巴克打电话给CMake的最佳方式是什么?
How should I structure my project to minimise headaches? 我应该如何构建我的项目以减少头痛?
My suggestion is using genrule and prebuilt_cxx_library. 我的建议是使用genrule和prebuilt_cxx_library。
This is my Buck study project using Google Test : https://github.com/ar90n/lab/tree/master/sandbox/buck-study/gtest 这是我使用Google Test的 Buck研究项目: https : //github.com/ar90n/lab/tree/master/sandbox/buck-study/gtest
This project contains two Buck files. 该项目包含两个Buck文件。 The one (
./gtest/BUCK
) is for fetching and building Google Test. 一个(
./gtest/BUCK
)用于获取和构建Google Test。 The another ( ./BUCK
) is for building and running test programs. 另一个(
./BUCK
)用于构建和运行测试程序。
If you want to build and run this project, please execute the following commands, 如果要构建和运行此项目,请执行以下命令,
$ buck fetch //gtest:googletest-src
$ buck build :sample1
$ buck run :sample1
Calling CMake will break reproducibility, so it isn't the best approach. 调用CMake会破坏可重复性,因此它不是最好的方法。 Instead, try the following:
相反,请尝试以下方法:
/cmake-generated
). /cmake-generated
)。 This is not as good as a true port to Buck, but you get most of the benefits for a one-time manual step. 这不如Buck的真正端口好,但是您可以获得一次性手动步骤的大部分好处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.