summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* cmLocalGenerator: Remove unused IncludePathStyle infrastructureBrad King2021-12-011-4/+1
| | | | | | It is unused since commit c564a3e3ff (Ninja: Always compile sources using absolute paths, 2021-05-19, v3.21.0-rc1~129^2), which left behind a FIXME comment to eventually remove it.
* Merge topic 'fix-ifdef-windows'Brad King2021-10-181-1/+1
|\ | | | | | | | | | | | | 40e73c5ac4 Source: Fix typo in _WIN32 preprocessor checks Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6631
| * Source: Fix typo in _WIN32 preprocessor checksBrad King2021-10-151-1/+1
| | | | | | | | | | | | | | | | | | | | Since CMake's default compiler flags with MSVC include `-DWIN32` for historical reasons, a few preprocessor conditions were accidentally checking for `WIN32` instead of `_WIN32`. The corresponding blocks were left out when compiling official binaries for `cmake.org` because we hard-code compiler flags without `-DWIN32`. Fixes: #22764
* | Source: Fix clang -Wimplicit-fallthrough warningsSean McBride2021-09-281-1/+2
| |
* | Rename cmProp in cmValueMarc Chevrier2021-09-211-4/+4
| |
* | cmGlobalNinjaGenerator: Rename SupportsConsolePool to SupportsDirectConsoleNAKAMURA Takumi2021-06-291-1/+1
| | | | | | | | Use a name that is not ninja-specific.
* | cmTransformDepfile: Make directory for transformed depfile automaticallyBrad King2021-06-091-2/+0
| |
* | Ninja: Always compile sources using absolute pathsBrad King2021-05-251-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Ninja generator traditionally referenced source files and include directories using paths relative to the build directory if they could be expressed without a `../` sequence that leaves the build and source directories. For example, when using a `build/` directory inside the source tree, sources would be compiled as `-c ../src.c` and include directories would be referenced as `-I ../include`. This approach matches the traditional Ninja convention of using relative paths whenever possible, but has undesirable side effects such as: * Compiler diagnostic messages may not use absolute paths, making it harder for IDEs/editors to find the referenced sources or headers. * Debug symbols may not use absolute paths, making it harder for debuggers to find the referenced sources or headers. * Different results depending on the path to the build tree relative to the source tree. * Inconsistent with the Makefile generators, which use absolute paths. Switch to always using absolute paths to reference source files and include directories on compiler command lines. While alternative solutions for diagnostic messages and debug symbols may exist with specific tooling, this is the simplest and most consistent approach. Note that a previous attempt to do this in commit 955c2a630a (Ninja: Use full path for all source files, 2016-08-05, v3.7.0-rc1~275^2) was reverted by commit 666ad1df2d (Revert "Ninja: Use full path for all source files", 2017-02-24, v3.8.0-rc2~9^2) due to problems hooking up depfile dependencies on generated files. This time, the changes in commit 2725ecff38 (Ninja: Handle depfiles with absolute paths to generated files, 2021-05-19) should avoid those problems. Fixes: #13894, #17450
* | cmLocalNinjaGenerator: Remove unnecessary CollapseFullPath callBrad King2021-05-251-3/+1
| | | | | | | | | | `ConvertToIncludeReference` is only called with absolute paths. One branch already assumed this.
* | Ninja: Handle depfiles with absolute paths to generated filesBrad King2021-05-191-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ninja treats every (normalized) path as its own node. It does not recognize `/abs/path/to/file` in a depfile as matching `path/to/file` even when `build.ninja` and the working directory are in `/abs/`. See Ninja Issue 1251. In cases where we pass absolute paths to the compiler, it will write a depfile containing absolute paths. If those files are generated in the build tree by custom commands, `build.ninja` references them by relative path in build statement outputs, so Ninja does not hook up the dependency and rebuild the project correctly. Add infrastructure to work around this problem by adding implicit outputs to custom command build statements that reference the main outputs by absolute path. Use a `${cmake_ninja_workdir}` placeholder to avoid repeating the base path. For example: build out.txt | ${cmake_ninja_workdir}out.txt: CUSTOM_COMMAND ... Ninja will create two nodes for the output file, one with a relative path and one with an absolute path. A depfile may then mention either form of the path and Ninja will hook up the dependency. Unfortunately Ninja will also stat the file twice. Issue: #13894 Fixes: #21865
* | cmGlobalNinjaGenerator: Factor out custom command output collectionBrad King2021-05-191-14/+6
| | | | | | | | | | | | De-duplicate code paths calling ConvertToNinjaPath and SeenCustomCommandOutput on custom command outputs and custom target byproducts.
* | cmGlobalNinjaGenerator: Reduce string copies in WriteCustomCommandBuildBrad King2021-05-191-2/+3
| | | | | | | | | | Re-order arguments to group those with similar roles. Use move semantics to avoid copying vectors of strings.
* | cmLocalNinjaGenerator: Use variable for main custom command output pathBrad King2021-05-191-5/+8
| |
* | cmLocalCommonGenerator: Select work directory semanticallyBrad King2021-05-131-1/+1
| |
* | cmLocalGenerator: Factor out relative path conversion helpersBrad King2021-05-131-7/+5
| | | | | | | | | | | | Most calls to `MaybeConvertToRelativePath` use one of our common work directories (e.g. top of the build tree) as the local path. Add helpers for each of the common cases to simplify and clarify call sites.
* | Merge topic 'ninja-multi-long-command-line-config'Brad King2021-05-031-5/+12
|\ \ | | | | | | | | | | | | | | | | | | ad08f93ee4 Ninja Multi-Config: Split long command lines by config Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6067
| * | Ninja Multi-Config: Split long command lines by configKyle Edwards2021-04-301-5/+12
| | | | | | | | | | | | Fixes: #22123
* | | Genex: add_custom_command: DEPFILE supports genexMarc Chevrier2021-04-121-1/+1
| | | | | | | | | | | | | | | | | | This facility is very useful for 'Ninja Multi-Config' and required as well for future support of DEPFILE in 'Xcode' and 'Visual Studio' generators (#20286).
* | | Merge topic 'nmc-cc-no-output'Brad King2021-03-301-0/+5
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | 6dd89529e8 Ninja Multi-Config: Fix crash on custom command config with no output e21a80e97d Tests: Teach RunCMake to ignore incidental 'Recompacting log' ninja output Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kyle Edwards <kyle.edwards@kitware.com> Merge-request: !5950
| * | Ninja Multi-Config: Fix crash on custom command config with no outputBrad King2021-03-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | With generator expressions in a custom command's `OUTPUT` and `BYPRODUCTS`, it is possible to have no outputs at all for a particular configuration. Generate no rule in this case. Fixes: #21989
* | | Merge topic 'ninja-multi-long-custom-command'Brad King2021-03-261-0/+6
|\ \ \ | |/ / | | | | | | | | | | | | | | | 3b864b2583 Ninja Multi-Config: Include configs in long CC scripts Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5941
| * | Ninja Multi-Config: Include configs in long CC scriptsKyle Edwards2021-03-251-0/+6
| | | | | | | | | | | | Fixes: #21973
* | | Merge topic 'ninja-utf8'Brad King2021-03-101-1/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 9af6e2e7b2 Ninja: Use new wincodepage tool to determine encoding Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5860
| * | | Ninja: Use new wincodepage tool to determine encodingKyle Edwards2021-03-091-1/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | Ninja 1.11 and later uses UTF-8 on Windows when possible, and includes a tool that reports the code page in use. Use this tool to determine what encoding to write the Ninja files in. Fixes: #21866
* | | cmLocalGenerator: Clarify GetIncludeFlags signatureBrad King2021-02-251-3/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Make the `config` argument non-optional so all callers must be explicit. Convert the path style argument to an enumeration to make its role clear at call sites. The path style argument is implemented by `ConvertToIncludeReference`, which was introduced with the Ninja generator by commit 5b114c9bee (Introduce a cmLocalGenerator::ConvertToIncludeReference function, 2011-09-07, v2.8.7~187^2~4). Its only purpose is to allow the Ninja generator to use relative paths in `-I` flags. Add a comment explaining this role.
* | Ninja: Use CMP0116 status recorded at time of custom command's creationKyle Edwards2021-02-231-2/+2
| |
* | clang-tidy: fix `readability-redundant-string-init` warningsBen Boeckel2021-01-271-1/+0
| |
* | Ninja Multi-Config: Run POST_BUILD when BYPRODUCTS don't overlapKyle Edwards2021-01-071-7/+6
| | | | | | | | Fixes: #21252
* | Ninja: Omit custom commands with an empty COMMANDShannon Booth2020-12-231-1/+5
| | | | | | | | Fixes: #21063
* | Ninja Multi-Config: Add support for cross-config custom commandsKyle Edwards2020-12-151-42/+152
| | | | | | | | Co-Author: Brad King <brad.king@kitware.com>
* | cmLocalGenerator: Refactor custom command generator constructionBrad King2020-12-151-78/+89
| | | | | | | | | | | | | | Add support for constructing and using multiple generators for one custom command. cmGeneratorTarget contains a code path that needs this behavior when used with Ninja but not other generators, so use virtual dispatch through cmLocalGenerator.
* | cmLocalNinjaGenerator: Remove leftover local debugging commentBrad King2020-10-271-5/+0
| |
* | Ninja: Transform DEPFILEs with policy CMP0116Kyle Edwards2020-10-131-2/+43
|/ | | | Fixes: #21267
* Refactor: Use cmToCStr()Vitaly Stakhovsky2020-09-031-2/+1
|
* cmMakefile::GetDefinition: return cmPropVitaly Stakhovsky2020-09-021-2/+3
|
* Ninja: Write msvc_deps_prefix as UTF-8 when console codepage is UTF-8Ben McMorran2020-08-071-2/+20
|
* Merge topic 'cleanup-target-types'Brad King2020-07-281-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ef796cc743 cmGeneratorTarget: Skip computing link implementation for custom targets 45158b2afe cmGeneratorTarget: Simplify logic in ComputeLinkInterfaceLibraries d6b1f5704e cmGeneratorTarget: Add missing nullptr checks 7695b67500 cmComputeTargetDepends: Add missing nullptr check 95b5df8646 cmGeneratorTarget: Skip computing languages for custom targets 2f0790df50 Factor out generator checks for filtering on non-compiling targets 422d9a0ab2 Factor out generator checks for filtering out interface libraries bce82df0aa cmGeneratorTarget: Remove unnecessary target type check in dependency tracing ... Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kyle Edwards <kyle.edwards@kitware.com> Merge-request: !5038
| * Factor out generator checks for filtering out interface librariesBrad King2020-07-231-1/+1
| | | | | | | | | | | | Add a `cmGeneratorTarget::IsInBuildSystem` helper method to tell generators whether a target should participate in the generated build system.
* | Ninja: Remove parameter default for cmNinjaTargetDependsKyle Edwards2020-07-241-8/+11
|/
* cmNonempty: Convenience inlines to check for non-empty stringVitaly Stakhovsky2020-07-141-1/+1
|
* Single location for cmProp typedefVitaly Stakhovsky2020-06-011-0/+1
|
* Merge topic 'ninja-multi-install'Brad King2020-05-251-0/+37
|\ | | | | | | | | | | | | dddb4f02f7 Ninja Multi-Config: Make "install" targets depend on default configs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4778
| * Ninja Multi-Config: Make "install" targets depend on default configsKyle Edwards2020-05-221-0/+37
| | | | | | | | | | | | And add an "install:all" target. Fixes: #20713
* | cmMakefile::GetProperty: return cmPropVitaly Stakhovsky2020-04-011-6/+5
| |
* | Merge topic 'cleanup-endls-1'Brad King2020-03-271-16/+11
|\ \ | | | | | | | | | | | | | | | | | | 3fdd8db3aa Refactor: Avoid `std::endl` where it's not necessary (part 1) Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4513
| * | Refactor: Avoid `std::endl` where it's not necessary (part 1)Alex Turbov2020-03-261-16/+11
| |/ | | | | | | | | | | | | The `std::endl` manupulator, except inserting `\n` character, also performs `os.flush()`, which may leads to undesired effects (like disk I/O in the middle of forming data strings). For the `std::stringstream` it also has no meaning.
* | Merge topic 'cmprop-getglobalprop'Brad King2020-03-271-3/+3
|\ \ | | | | | | | | | | | | | | | | | | c84cf42897 cmState::GetGlobalProperty: return cmProp Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4521
| * | cmState::GetGlobalProperty: return cmPropVitaly Stakhovsky2020-03-251-3/+3
| |/
* | Simplify absolute path conversions using CollapseFullPath full signatureBrad King2020-03-241-2/+3
|/
* Refactor: Split Ninja files into impl-<Config>.ninja and build-<Config>.ninjaKyle Edwards2020-01-221-5/+5
|