因为阅读chromium的需要,也熟悉了一下chromium使用的GYP构建系统,其实这个系统和我原来所在的一个公司的构建系统非常相似,因此学习起来也比较容易。
首先看一下gyp的安装,如果你使用ubuntu系统那么安装可以通过下面的命令完成:
sudo apt-get install gyp
下面我们就通过一个例子来看看gyp的使用,假设我们编写三个文件hello_world.cc, my_class.h, my_class.cc这三个文件内容如下:
hello_world.cc
#include <stdio.h>
#include "my_class.h"
int main(int argc, char** argv) {
printf("hello world\n");
MyClass my_class(100);
my_class.Fun1();