Cmake 学习记录

https://cmake.org/documentation/ 官网有相关的文档,可以以官方的文档进行了解。
首先我们先了解一下Cmake的大致使用目的,以前使用过qt,qt有Qmake这个文件,让我大致了解了过程,就是有这么一份文件,配置了相关属性,然后利用工具,将目标工程编译打包。
引用下官网的简介:
CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as ITK and VTK.

注意到这里是 generate native makefiles,这里的makefiles 指的是 makefile?
https://opensource.com/article/18/8/what-how-makefile
看看大佬的描述
makefile 就是类似构建脚本一样的东西,里面描述的是构建的时候需要运行的一系列命令。同时又引出了make 这个工具。跟着这个文章先简单了解一下makefile的语法,再了解make到底是什么,make太多八股了,也许直接使用cmake这个工具会更好,这里暂时先略过。
https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#guide:User Interaction Guide
简单了解一下cmake的概念,camke的文件最好不要手动修改,运行cmake会覆盖修改。
再者是configure configure 是脚本,

configure 将 Makefile.in 转成当前平台构建环境的makefile

cofnigure脚本又需要当前的环境,所以出现了Autotools, 这个工具查询当前系统的环境变量、平台架构、当前所依赖的库以及他们的位置,然后根据这些信息去make,这样就能实现同一套代码仅需configure一下就可以在不同的unix/linux系统中编译运行。

简单了解构建系统之后开始ffmpeg的编译。
由于手上的环境是macos,所以以mac的环境去编译

posted @ 2023-04-14 12:34  J0K3Rzz  阅读(22)  评论(0编辑  收藏  举报