Ninja Build

NinjaBuild

Using the Ninja build system

build

Updated Mar 28, 2014 by [email protected]

Ninja is a build system written with the specific goal of improving the edit-compile cycle time. It is used by default everywhere except when building for iOS.

Ninja是致力于节约编译周期的编译系统,除ios外,其余地方都可用。

Ninja behaves very similar to Make -- the major feature is that it starts building files nearly instantly. (It has a number of minor user interface improvements to make as well.)

Ninja和Make表现方式类似--主要的特诊是立即编译

Read more about Ninja at the Ninja home page.

Using it

Configure your system to use Ninja

Install

Ninja is included in depot_tools as well as gyp, so there‘s nothing to install.

Build instructions

To build Chrome:

cd /path/to/chrome/src
ninja -C out/Debug chrome

Specify out/Release for a release build. I recommend setting
up an alias so that you don‘t need to type out that build directory path.

If you want to build all targets, use ninja -C out/Debug all.
It‘s faster to build only the target you‘re working on, like ‘chrome‘ or ‘unit_tests‘.

Android

Identical to Linux, just make sure OS=android is in your GYP_DEFINES.
You want to build one of the apk targets, e.g. content_shell_apk.

Windows

Similar to Linux. It uses MSVS‘s cl.exelink.exe,
etc. so you still need to have VS installed. To use it, open cmd.exe, go to your chrome checkout, and
run:

和Linux类似,其用MSVS‘s cl.exe,link.exe,因此,你需要安装VS,具体使用方式如下,使用cmd,目录切换至chrome

set GYP_DEFINES=component=shared_library
python build\gyp_chromium
ninja -C out\Debug chrome.exe

component=shared_library optional but recommended for faster
links.

可选,但建议设置上,这样可以更快地进行链接

You can also set GYP_GENERATORS=ninja,msvs to get both VS
projects generated if you want to use VS just to browse/edit (but then gyp takes twice as long to run).

GYP_GENERATORS=ninja,msvs用于获取ninja和VS工程,可以选择其中一个

If you‘re using Express or the Windows SDK by itself (rather than using a Visual Studio install), you‘ll need to run from a vcvarsall command prompt.

如果你使用Express版或者Windows SDK(没有安装Vs),你需要从vcvarsall命令提示符下运行

Debugging

Miss VS for debugging?

devenv.com /debugexe chrome.exe --my-great-args "go here" --single-process etc

Miss Xcode for debugging? Read http://dev.chromium.org/developers/debugging-on-os-x/building-with-ninja-debugging-with-xcode

Without Visual Studio

That is, building with just the WinDDK. This is documented in the regular
build instructions
.

Tweaks

Building through errors

Pass a flag like -k3 to make Ninja build until it hits three
errors instead of stopping at the first.

Parallelism

Pass a flag like -j8 to use 8 parallel processes, or -j1 to
compile just one at a time (helpful if you‘re getting weird compiler errors). By default Ninja tries to use all your processors.

More options

There are more options. Run ninja --help to see them all.

Custom build configs

You can write a specific build config to a specific output directory via the -G flags
to gyp. Here‘s an example from jamesr: build/gyp_chromium -Gconfig=Release -Goutput_dir=out_profiling -Dprofiling=1
-Dlinux_fpic=0

Bugs

If you encounter any problems, please file a bug at http://crbug.com/new with label ninja and
cc [email protected] or [email protected].
Assume that it is a bug in Ninja before you bother anyone about e.g. link problems.

时间: 2024-10-06 06:05:29

Ninja Build的相关文章

Android7.0 Ninja编译原理

############################################# 本文为极度寒冰原创,转载请注明出处 ############################################# 引言 使在Android N的系统上,初次使用了Ninja的编译系统.对于Ninja,最初的印象是用在了Chromium open source code的编译中,在chromium的编译环境中,使用ninja -C out/Default chrome命令,就可以利用源码编译出

Ninja - chromium核心构建工具

转自:http://guiquanz.me/2014/07/28/a_intro_to_Ninja/ Ninja - chromium核心构建工具Jul 28, 2014 [在线编辑] 缘由 经过上次对chromium核心代码的初步了解之后,我转头去研究了一番ninja,并对其进行了一些改造(爱折腾的,都是小NB).今天就来简单介绍一下ninja及其使用.(BTW: 细节的内容,大家阅读ninja 的手册就好了,我这里不会关注.) ninja是一个专注于速度的小型构建系统(Ninja is a

Build aosp for Nexus 5X - brunch:7.1.1 (N4F26U)

Build aosp for Nexus 5X 前言:在编译AOSP时, 多次遇到问题, 下载和编译时间较长,最终编译成功后flash到Nexus 5X时也遇到了各种各样的问题.为了避免大家走同样的湾路,整理如下Build AOSP的步骤,仅供参考. ----- 2018.11.19 Eric Y 开始之前,请先浏览下面的官网熟悉一下思路.准备好大硬盘(250G).电脑要好的配置速度才能嗖嗖的.https://source.android.com/setup/build/requirements

使用 Ninja 代替 make

使用 Ninja 代替 make 摘自:https://www.jianshu.com/p/d118615c1943 22017.01.14 11:41:44字数 1408阅读 26336 前言 在传统的 C/C++ 等项目构建时,通常会采用 make 系统使用 Makefile 文件来进行整个项目的编译构建,通过 Makefile 中指定的编译所依赖的规则使得程序的构建非常简单,并且在复杂项目中可以避免由于少部分源码修改而造成的很多不必要的重编译.但是它仍然不够好,因为其大而且复杂,有时候我们

编译Android系统常见错误

ninja: build stopped: subcommand failed. build/core/ninja.mk:153: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1 #### make failed to build some targets (13:40 (mm:ss)) #### 修改文件 prebuilts/sdk/tools/jack-admin 然后运行 prebuild

AOSP android7.1.1-r16源码编译

编译环境配置 Ubuntu17.04 安装openjdk(7/8/9) sudo apt-get install openjdk-8-jdk 安装git sudo apt-get install git git config --global user.name "accout" git config --global user.email "accout @qq.com" sudo apt-get install repo 添加依赖 sudo apt-get in

ubuntu配置px4编译环境

一.主要参考的内容 px4的开发者手册 https://dev.px4.io/zh/setup/dev_env_linux.html 其中有的shell指令 权限设置 警告:永远不要使用sudo来修复权限问题,否则会带来更多的权限问题,需要重装系统来解决. 把用户添加到用户组 "dialout": sudo usermod -a -G dialout $USER 然后注销后,重新登录,因为重新登录后所做的改变才会有效. 安装 更新包列表,安装下面编译PX4的依赖包.PX4主要支持的系列

jack报错

[ 29% 17593/59326] Ensure Jack server is installed and startedFAILED: /bin/bash -c "(prebuilts/sdk/tools/jack-admin install-server prebuilts/sdk/tools/jack-launcher.jar prebuilts/sdk/tools/jack-server-4.8.ALPHA.jar 2>&1 || (exit 0) ) &&

Windows下从源代码编译Skia

在PPAPI里面画图,能够结合第三方的图形库.比方Cairo.Skia. Google Chrome.Chromium和Android都使用Skia作为画图引擎.我也来试试Skia,先过编译关. foruok原创.如需转载请关注foruok的微信订阅号"程序视界"联系foruok. CEF编译出的Skia不可单独用 Chromium使用Skia.Windows下从源代码编译CEF说明了怎么编译CEF,它会捎带着编译Chromium.里面有Skia,但它编译出来的skia_library