Make
As different systems started to emerged in the Industry, developers needed to compile the same source code in different systems. This came with a problem as the Makefile need different parameters for different systems. Developers had to edit the Makefile to compile the source code on a specific system.
CMake
There were several intermediate solutions that came with Make but the final fix was in 2000 with the introduction of Build Generator CMake.
cmake --build
equals make
but you can config ninjra or other Generators.
Ninja
One problem remained that Make was too slow to build large projects.
The solution to this came in 2012 with the introduction of a new Build tool named Ninja. There were key differences like it had to be used wth CMake which was a good practice.
Differences between Make and Ninja
- For incremental builds, Make is significantly slow. Ninja is faster and helps developers spend less time on building software. This becomes a driving force for large projects such as Google Chrome. In general, performance of Ninja is much better than Make.
- Ninja build files are not meant to be implemented manually so Build generators like CMake are compulsory for Ninja. On the other hand, Build generators are optional for Make.
Conan
Conan is a package manager for C++, generating conanbuildinfo.cmake
for Cmake.
一个包是由一个conanfile.py文件定义的,该文件定义了包的依赖关系、源文件、从源码构建二进制文件的方式等。一个包的conanfile.py食谱可以生成任意个二进制文件,每个二进制文件适配于不同的平台和配置:操作系统、arch架构、编译器、构建类型等。
Conan可以工作在:Windows、Linux(Ubuntu、Debian、RedHat、ArchLinux、Raspbian)、OSX、FreeBSD和SunOS,由于它是可移植的,它可以工作在任何可以运行Python的其他平台上。它可以针对任何现有的平台,从裸机到桌面、移动、嵌入式、服务器和交叉构建。
Conan可以使用任意构建系统。已经内建集成了多数当前最流行的有:CMake、Visual Studio(MSBuild)、Autotools、Makefiles和SCons等。但并不一定得必须使用其中的一种。甚至不一定所有的包都得使用相同的构建系统,每个包可以使用不同的构建系统,并可以依赖于其他使用不同构建系统的包。
同样地,Conan可以管理任意版本的任意编译器。默认定义了当前最流行的有:gcc、cl.exe、clang、apple-clang、intel,同时支持不同的版本配置、运行时、C++标准库等。该模型同样可扩展为任意的配置。