5 Copyright The SCons Foundation
7 Permission is hereby granted, free of charge, to any person obtaining
8 a copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sublicense, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
15 The above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 This file is processed by the bin/SConsDoc.py module.
28 See its __doc__ string for a discussion of the format.
32 <!ENTITY % scons SYSTEM '../../../doc/scons.mod'>
34 <!ENTITY % builders-mod SYSTEM '../../../doc/generated/builders.mod'>
36 <!ENTITY % functions-mod SYSTEM '../../../doc/generated/functions.mod'>
38 <!ENTITY % tools-mod SYSTEM '../../../doc/generated/tools.mod'>
40 <!ENTITY % variables-mod SYSTEM '../../../doc/generated/variables.mod'>
44 <sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0"
45 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
46 xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
51 Sets up the &b-link-Ninja; builder, which generates a &ninja; build file, and then optionally runs &ninja;.
54 <para>This is an experimental feature.
55 This functionality is subject to change and/or removal without a deprecation cycle.
61 <item>NINJA_DISABLE_AUTO_RUN</item>
62 <item>NINJA_ALIAS_NAME</item>
63 <item>NINJA_DIR</item>
64 <item>NINJA_COMPDB_EXPAND</item>
65 <item>NINJA_ENV_VAR_CACHE</item>
66 <item>NINJA_FILE_NAME</item>
67 <item>NINJA_GENERATED_SOURCE_SUFFIXES</item>
68 <item>NINJA_GENERATED_SOURCE_ALIAS_NAME</item>
69 <item>NINJA_MSVC_DEPS_PREFIX</item>
70 <item>NINJA_DEPFILE_PARSE_FORMAT</item>
71 <item>NINJA_POOL</item>
72 <item>NINJA_REGENERATE_DEPS</item>
73 <item>NINJA_SYNTAX</item>
74 <item>NINJA_FORCE_SCONS_BUILD</item>
75 <item>_NINJA_REGENERATE_DEPS_FUNC</item>
76 <!-- <item>__NINJA_NO</item>-->
77 <item>IMPLICIT_COMMAND_DEPENDENCIES</item>
78 <item>NINJA_SCONS_DAEMON_KEEP_ALIVE</item>
79 <item>NINJA_SCONS_DAEMON_PORT</item>
80 <item>NINJA_CMD_ARGS</item>
82 <!-- TODO: Document these -->
83 <!-- <item>NINJA_RULES</item>-->
84 <!-- <item>NINJA_POOLS</item>-->
85 <!-- <item>NINJA</item>-->
86 <!-- <item>GENERATING_NINJA</item>-->
87 <!-- <item>NINJA_DIR</item>-->
97 <item>CCDEPFLAGS</item>
104 <item>PLATFORM</item>
106 <item>RANLIBCOM</item>
108 <item>SHCXXCOM</item>
110 <item>SHLINKCOM</item>
111 <item>PROGSUFFIX</item>
112 <item>PRINT_CMD_LINE_FUNC</item>
113 <!--<item>TEMPFILE</item>-->
115 <!-- TODO: Document these -->
116 <!-- <item>NINJA_MAX_JOBS</item> -->
117 <!-- <item>NINJA_SKIP</item> -->
118 <!-- <item>NINJA_CUSTOM_HANDLERS</item> -->
123 <builder name="Ninja">
126 A special builder which
127 adds a target to create a Ninja build file.
128 The builder does not require any source files to be specified.
131 <para>This is an experimental feature. To enable it you must use one of the following methods
134 <!-- NOTE DO NOT INDENT example_commands CONTENTS AS IT WILL ALTER THE FORMATTING-->
136 # On the command line
139 # Or in your SConstruct
140 SetOption('experimental', 'ninja')
143 <para>This functionality is subject to change and/or removal without deprecation cycle.</para>
146 To use this tool you need to install the &Python; &ninja; package,
147 as the tool by default depends on being able to do an
148 <systemitem>import</systemitem> of the package
149 <!-- (although see &cv-link-__NINJA_NO;).-->
150 This can be done via:
152 python -m pip install ninja
159 If called with no arguments,
160 the builder will default to a target name of
161 <filename>ninja.build</filename>.
164 If called with a single positional argument,
165 &scons; will "deduce" the target name from that source
166 argument, giving it the same name, and then
168 This is the usual way to call the builder if a
169 non-default target name is wanted.
172 If called with either the
173 <parameter>target=</parameter>
174 or <parameter>source=</parameter> keyword arguments,
175 the value of the argument is taken as the target name.
176 If called with both, the
177 <parameter>target=</parameter>
178 value is used and <parameter>source=</parameter> is ignored.
179 If called with multiple sources,
180 the source list will be ignored,
181 since there is no way to deduce what the intent was;
182 in this case the default target name will be used.
185 <emphasis>Available since &scons; 4.2.</emphasis>
191 <cvar name="NINJA_GENERATED_SOURCE_SUFFIXES">
194 The list of source file suffixes which are generated by &SCons; build steps.
195 All source files which match these suffixes will be added to the _generated_sources alias in the output
197 Then all other source files will be made to depend on this in the &ninja; build file, forcing the
198 generated sources to be built first.
203 <cvar name="NINJA_GENERATED_SOURCE_ALIAS_NAME">
206 A string matching the name of a user defined alias which represents a list of all generated sources.
207 This will prevent the auto-detection of generated sources from &cv-NINJA_GENERATED_SOURCE_SUFFIXES;.
208 Then all other source files will be made to depend on this in the &ninja; build file, forcing the
209 generated sources to be built first.
214 <cvar name="NINJA_MSVC_DEPS_PREFIX">
217 The <parameter>msvc_deps_prefix</parameter> string.
218 Propagates directly into the generated &ninja; build file.
220 <quote>defines the string which should be stripped from msvc's <option>/showIncludes</option> output</quote>
225 <cvar name="NINJA_DEPFILE_PARSE_FORMAT">
228 Determines the type of format ninja should expect when parsing header
229 include depfiles. Can be <option>msvc</option>, <option>gcc</option>, or <option>clang</option>.
230 The <option>msvc</option> option corresponds to <option>/showIncludes</option> format, and
231 <option>gcc</option> or <option>clang</option> correspond to <option>-MMD -MF</option>.
236 <cvar name="NINJA_DIR">
239 The <parameter>builddir</parameter> value.
240 Propagates directly into the generated &ninja; build file.
243 A directory for some Ninja output files. ... (You can also store other build output in this
246 The default value is <filename>.ninja</filename>.
251 <cvar name="NINJA_REGENERATE_DEPS">
254 A generator function used to create a &ninja; depfile which
255 includes all the files which would require
256 &SCons; to be invoked if they change.
257 Or a list of said files.
262 <cvar name="NINJA_COMPDB_EXPAND">
265 Boolean value to instruct &ninja; to expand the command line arguments normally put into
267 If true, prevents unexpanded lines in the compilation database like
268 <quote><literal>gcc @rsp_file</literal></quote> and instead yields expanded lines like
269 <quote><literal>gcc -c -o myfile.o myfile.c -Ia -DXYZ</literal></quote>.
272 Ninja's compdb tool added the <option>-x</option> flag in Ninja V1.9.0
277 <cvar name="NINJA_ENV_VAR_CACHE">
280 A string that sets the environment for any environment variables that
281 differ between the OS environment and the &SCons; execution environment.
285 It will be compatible with the default shell of the operating system.
289 If not explicitly set, &SCons; will generate this dynamically from the
290 execution environment stored in the current &consenv;
291 (e.g. <literal>env['ENV']</literal>)
292 where those values differ from the existing shell..
297 <cvar name="NINJA_POOL">
300 Set the <parameter>ninja_pool</parameter> for this or all targets in scope for this env var.
305 <cvar name="NINJA_DISABLE_AUTO_RUN">
308 Boolean. Default: <constant>False</constant>.
309 If true, &SCons; will not run &ninja; automatically after creating the &ninja; build file.
313 If not explicitly set, this will be set to <constant>True</constant>
314 if <option>--disable_execute_ninja</option> or
315 <code>SetOption('disable_execute_ninja', True)</code> is seen.
320 <!-- Internal for now
321 <cvar name="__NINJA_NO">
324 Internal flag. Used to tell &SCons; whether or not to try to import the &Python; &ninja; module.
325 This is set to True when being called by Ninja?
331 <cvar name="NINJA_FILE_NAME">
334 The filename for the generated Ninja build file.
335 The default is <filename>ninja.build</filename>.
340 <cvar name="NINJA_ALIAS_NAME">
343 The name of the alias target which will cause &SCons; to create the &ninja; build file,
344 and then (optionally) run &ninja;.
345 The default value is <literal>generate-ninja</literal>.
350 <cvar name="NINJA_SYNTAX">
353 The path to a custom <filename>ninja_syntax.py</filename> file which is used in generation.
354 The tool currently assumes you have &ninja; installed as a &Python; module and grabs the syntax file from that
355 installation if &cv-NINJA_SYNTAX; is not explicitly set.
360 <cvar name="NINJA_FORCE_SCONS_BUILD">
363 If true, causes the build nodes to callback to scons instead of using
364 &ninja; to build them. This is intended to be passed to the environment on the builder invocation.
365 It is useful if you have a build node which does something which is not easily translated into &ninja;.
370 <cvar name="_NINJA_REGENERATE_DEPS_FUNC">
373 Internal value used to specify the function to call with argument env to generate the list of files
374 which if changed would require the &ninja; build file to be regenerated.
379 <cvar name="NINJA_SCONS_DAEMON_KEEP_ALIVE">
382 The number of seconds for the SCons deamon launched by ninja to stay alive.
388 <cvar name="NINJA_SCONS_DAEMON_PORT">
391 The TCP/IP port for the SCons daemon to listen on.
392 <emphasis>NOTE: You cannot use a port already being listened to on your build machine.</emphasis>
393 (Default: random number between 10000,60000)
398 <cvar name="NINJA_CMD_ARGS">
401 A string which will pass arguments through SCons to the ninja command when scons executes ninja.
402 Has no effect if &cv-NINJA_DISABLE_AUTO_RUN; is set.
405 This value can also be passed on the command line:
408 scons NINJA_CMD_ARGS=-v
410 scons NINJA_CMD_ARGS="-v -j 3"