[英]How to make my project easy to set up?
For now, the repository of my application contains the Visual Studio 11 project files, my source and header files, library headers and their compiled *.lib files and some assets. 目前,我的应用程序的存储库包含Visual Studio 11项目文件,源文件和头文件,库头文件及其编译的* .lib文件和一些资源。
But it is a big effort to set up the project on every new platform to test compatibility or continue development. 但是,在每个新平台上设置项目以测试兼容性或继续开发是一项巨大的工作。 Each time I have to create a new project for the current IDE, and more important, download all the used third party libraries and compile the *.lib files for the current compiler.
每次我必须为当前IDE创建一个新项目,更重要的是,下载所有使用过的第三方库并编译当前编译器的* .lib文件。
Is there a way to automatedly fetch required libraries and compile them to *.lib files on all platforms? 有没有办法自动获取所需的库并将它们编译为所有平台上的* .lib文件? Moreover, it would be pleasant to cover project settings so that it is easier to set up projects for new compilers or IDEs.
此外,覆盖项目设置会很愉快,因此更容易为新的编译器或IDE设置项目。
I believe, CMake ( http://www.cmake.org/ ) is the best C++ has now. 我相信,CMake( http://www.cmake.org/ )是目前最好的C ++。 Like C++ itself, CMake is neither pretty nor simple to use, but, again, like C++, it's very powerful and versatile.
就像C ++本身一样,CMake既不漂亮又不易使用,但同样,就像C ++一样,它非常强大且功能多样。
It's currently used by a great number of projects, which need custom and/or complex configuration and building. 它目前被大量项目使用,需要定制和/或复杂的配置和构建。
Here's some of it's features, you may find useful: 以下是它的一些功能,您可能会觉得有用:
find_package
macro that helps finding installed libraries to make use of it in the project. find_package
宏,可帮助查找已安装的库以在项目中使用它。 Eg if you have the boost libraries installed, you can use something like the following code, which I believe is rather self-descriptive find_package( Boost COMPONENTS thread system) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) endif(Boost_FOUND)
include(ExternalProject) ExternalProject_Add( ZLIB URL http://zlib.net/zlib-1.2.8.tar.gz )
It will fetch the tarball from the given url, build zlib, and install it. curl
or git clone
to fetch the sources, and call building and installing commands manually. curl
或git clone
来获取源,并手动调用构建和安装命令。 Once again, it's not an out-of-the-box or just-works solution, but it gets the job done, which is acknowledged by a quite large user base. 再一次,它不是一个开箱即用或只是工作的解决方案,但它完成了工作,这得到了相当大的用户群的认可。 To paraphrase the known quote, 'CMake is the worst build tool, but others are even worse'
用已知的引用来解释,'CMake是最糟糕的构建工具,但其他工具更糟糕'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.