summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-2/+2
| | | | All compilers hosting CMake support the std class.
* Add an option for explicit BYPRODUCTS of custom commands (#14963)Brad King2014-11-141-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common idiom in CMake-based build systems is to have custom commands that generate files not listed explicitly as outputs so that these files do not have to be newer than the inputs. The file modification times of such "byproducts" are updated only when their content changes. Then other build rules can depend on the byproducts explicitly so that their dependents rebuild when the content of the original byproducts really does change. This "undeclared byproduct" approach is necessary for Makefile, VS, and Xcode build tools because if a byproduct were listed as an output of a rule then the rule would always rerun when the input is newer than the byproduct but the byproduct may never be updated. Ninja solves this problem by offering a 'restat' feature to check whether an output was really modified after running a rule and tracking the fact that it is up to date separately from its timestamp. However, Ninja also stats all dependencies up front and will only restat files that are listed as outputs of rules with the 'restat' option enabled. Therefore an undeclared byproduct that does not exist at the start of the build will be considered missing and the build will fail even if other dependencies would cause the byproduct to be available before its dependents build. CMake works around this limitation by adding 'phony' build rules for custom command dependencies in the build tree that do not have any explicit specification of what produces them. This is not optimal because it prevents Ninja from reporting an error when an input to a rule really is missing. A better approach is to allow projects to explicitly specify the byproducts of their custom commands so that no phony rules are needed for them. In order to work with the non-Ninja generators, the byproducts must be known separately from the outputs. Add a new "BYPRODUCTS" option to the add_custom_command and add_custom_target commands to specify byproducts explicitly. Teach the Ninja generator to specify byproducts as outputs of the custom commands. In the case of POST_BUILD, PRE_LINK, and PRE_BUILD events on targets that link, the byproducts must be specified as outputs of the link rule that runs the commands. Activate 'restat' for such rules so that Ninja knows it needs to check the byproducts, but not for link rules that have no byproducts.
* Ninja: Implement USES_TERMINAL using the console pool if availablePeter Collingbourne2014-11-141-0/+1
|
* strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-1/+1
| | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Ninja: Fix RC include directories regressionBrad King2014-10-131-2/+3
| | | | | | | | | | | | | | | | | Changes in commit b9aa5041 (cmLocalGenerator: Simplify GetIncludeFlags output formatting, 2014-03-04) caused Windows Resource Compiler include directories to be computed as relative paths in the Ninja generator. This breaks the cmcldeps handling of include paths. The reason for the regression is that several cmLocalGenerator::GetIncludeFlags callers treated the fourth "bool forResponseFile" argument as if it controlled whether include directories were a full path. It actually did control that by accident until the above commit. Add an explicit "bool forceFullPaths" argument to GetIncludeFlags and thread the value through ConvertToIncludeReference as needed. Update GetIncludeFlags call sites that really wanted to control the forResponseFile setting to be aware of the new argument. Extend the VSResource test to cover this case.
* Ninja: Use 'console' pool for CMake re-run if possible (#14915)Sylvain Joubert2014-10-031-0/+25
| | | | | | | | | The pre-defined 'console' pool is a non-buffered pool that runs with a depth of 1. CMake re-run cannot be run concurrently and it will eventually output something. A non-buffered pool allows to get it as soon as possible Also, generate the minimal required version of Ninja in the build file.
* ninja: Use string parametersBen Boeckel2014-05-021-1/+1
|
* cmLocalGenerator: Add ComputeObjectFilenames interface.Stephen Kelly2014-03-131-0/+14
| | | | | Implement it in the local generators and use it in the global generators.
* Generalize cmCustomCommandGenerator to more fieldsBrad King2014-03-121-15/+18
| | | | | | | Until now the cmCustomCommandGenerator was used only to compute the command lines of a custom command. Generalize it to get the comment, working directory, dependencies, and outputs of custom commands. Update use in all generators to support this.
* cmCustomCommand: Return std::string from GetWorkingDirectoryBrad King2014-03-121-3/+3
|
* Remove some c_str() calls.Stephen Kelly2014-03-111-5/+5
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* cmLocalGenerator: Add format option to ConvertToLinkReferenceBrad King2014-03-041-2/+3
| | | | Replace the hard-coded SHELL output format with an optional argument.
* cmLocalGenerator: Add format option to ConvertToIncludeReferenceBrad King2014-03-041-2/+3
| | | | Replace the hard-coded SHELL output format with an optional argument.
* Merge topic 'ninja-compile-link-pool'Brad King2013-11-261-0/+35
|\ | | | | | | | | 7605e37 Ninja: job pool support for compiling and linking
| * Ninja: job pool support for compiling and linkingPeter Kümmel2013-11-251-0/+35
| | | | | | | | | | Could be tested by setting the environment variable NINJA_STATUS=[%r]
* | Merge topic 'INTERFACE_LIBRARY-property-whitelist'Brad King2013-11-261-1/+2
|\ \ | | | | | | | | | | | | | | | 5ee9e6b cmTarget: Add whitelist of properties on INTERFACE_LIBRARY. 0bfcb45 INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties.
| * | INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties.Stephen Kelly2013-11-251-1/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | As an INTERFACE_LIBRARY has no direct link dependencies, we can short-circuit in cmGeneratorExpressionEvaluator and in cmGlobalGenerator::CheckLocalGenerators. As they do not generate any output directly, any generate- or install- related code acn also be short-circuited. Many of the local generators already do this. Because only INTERFACE related properties make sense on INTERFACE_LIBRARY targets, avoid setting other properties, for example via defaults.
* | Merge topic 'ninja-quoted-cmd-commands'Brad King2013-11-261-7/+23
|\ \ | |/ |/| | | | | b6f1142 Ninja: multiple commands must be quoted
| * Ninja: multiple commands must be quotedPeter Kümmel2013-11-251-7/+23
| | | | | | | | Bug 14370
* | Port some of the generator API to cmGeneratorTarget.Stephen Kelly2013-11-221-5/+10
|/ | | | | | | Just enough to reach the BuildMacContentDirectory method and the NeedRelinkBeforeInstall methods. In the future, those methods can be moved to cmGeneratorTarget.
* Ninja: run custom commands through launcher if availableNils Gladitz2013-10-311-2/+42
|
* Ninja: use deps = gcc/msvc featurePeter Kümmel2013-10-241-5/+15
| | | | cmcldeps is now only used for .rc file processing
* Remove unused include.Stephen Kelly2013-09-111-1/+0
|
* VS,Xcode: Drop incorrect legacy dependency trace (#14291)Brad King2013-07-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | Drop the "vsProjectFile" argument from cmTarget::TraceDependencies. It appears to be the modern equivalent to a hunk added in commit ba68f771 (...added new custom command support, 2003-06-03): + name = libName; + name += ".dsp.cmake"; + srcFilesToProcess.push(name); but was broken by refactoring at some point. The current behavior tries to trace dependencies on a source file named the same as a target, which makes no sense. Furthermore, in code of the form add_executable(foo foo.c) add_custom_command(OUTPUT "${somewhere}/foo" ... DEPENDS foo) the "vsProjectFile" value "foo" matches source "${somewhere}/foo.rule" generated to hold the custom command and causes the command to be added to the "foo" target incorrectly. Simply drop the incorrect source file trace and supporting logic.
* Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non staticRobert Maynard2013-07-011-8/+9
| | | | | | To properly track the usage of dependencies that are generated at compile time as the side effect of other build steps we need to make the WriteBuild and WritePhonyBuild commands non static
* Ninja: use cd /D to set directory on WindowsIan Monroe2013-04-181-1/+6
| | | | | Add_custom_command was unable to handle build and source directories existing on different drives.
* Ninja: remove 'friend' in ninja codePeter Kümmel2012-07-181-1/+1
|
* Ninja: also consider variables when checking command line lengthPeter Kuemmel2012-07-011-1/+1
|
* Merge topic 'ninja-cldeps'David Cole2012-06-191-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eb410e8 Ninja: disable cldeps for bcc32, it's too old, and ninja would also not build 5ead31d Ninja: try work around for bcc32 bug 1333b57 Ninja: build server fixes 9081e3a remove warning about unused parameter f430bea Ninja: maybe this fixes the bcc32 build f2c1288 Ninja: msvc6 for-scoping 44b9bbc Ninja: build with old msvc versions 57156a5 Ninja: build server fixes f1abdce Ninja: some bytes of the rc files couldn't be piped correctly 2de963d Ninja: don't remove space between command and parameters 50b6f33 Ninja: build cmcldeps with mingw c05653e Ninja: try to make GetProcessId visible ab245ff Ninja: but cl supports /nologo ... bf58e9a Ninja: no /nologo option in old rc.exe 2fb07fc Ninja: Eclipse and KDevelop fixes for ninja 518c065 Ninja: don't pollute build dir with preprocessed rc files ...
| * Ninja: undo all the NOSHELL patchesPeter Kuemmel2012-06-141-11/+2
| |
| * Ninja: don't use shell when cmake is called directlyPeter Kuemmel2012-06-141-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When linking with cmake and vs_link_* the command line could be too long for cmd.exe, which needs not to be called in this case. (was not cached by a test) Introduce rules which don't use the shell and use this rule when there are no pre or post step. For free we get a small speedup, because cmd is then not called. Also be more accurate when estimating the command line length.
| * Ninja: don't pollute the rules file with useless commentsPeter Kuemmel2012-06-101-0/+2
| |
* | Merge branch 'ninja-rspfile' into no-std-stringstreamBrad King2012-06-121-6/+6
|\ \ | |/ | | | | | | | | | | Conflicts: Source/cmGlobalNinjaGenerator.cxx Source/cmLocalNinjaGenerator.cxx Source/cmNinjaNormalTargetGenerator.cxx
| * Ninja: add response file support on WindowsPeter Kuemmel2012-06-051-6/+6
| | | | | | | | | | | | | | When MinGW is used slashes are used for dependencies because ar.exe can't read rsp files with backslashes. Many thx to Claus Klein for starting working on this.
* | Avoid direct use of std::(o|)stringstream (#13272)Brad King2012-06-121-2/+2
|/ | | | | | | | | Older C++ compilers do not provide a standard std::stringstream. Use our compatibility interfaces instead. Also avoid std::stringstream(openmode) signature. Our approximate stringstream implementation provided when the standard one is not available does not support the openmode argument.
* Pre-compute object file names before Ninja generationBrad King2012-03-161-31/+0
| | | | | | Implement cmGlobalGenerator::ComputeTargetObjects in the Ninja generator to pre-compute all the object file names. Use the results during generation instead of re-computing it later.
* Ninja: Constify use of cmCustomCommandBrad King2012-03-131-3/+3
| | | | The generator never needs to modify custom command instances.
* Ninja: Import library support for WindowsPeter Collingbourne2012-02-191-0/+1
|
* Ninja: Shell encode the command used in custom commandsPeter Collingbourne2012-02-191-1/+2
|
* Ninja: Shell encode paths used in "cd" commandsPeter Collingbourne2012-02-191-5/+5
|
* Ninja: Backslash rules for WindowsPeter Collingbourne2012-02-191-3/+8
| | | | | | Generally these are only required in build statements, as Ninja wants to be able to chop paths up. But it doesn't hurt to also try to use them in command line arguments.
* Ninja: win fixes: escape back slash/colon, use cd. as cmd.exe nopPeter Kuemmel2012-02-181-0/+4
|
* Ninja: Fix a 79-col violationPeter Collingbourne2012-02-051-1/+1
|
* Ninja: Add the Ninja generatorPeter Collingbourne2012-02-021-0/+413