summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* IWYU: Update for Debian 12 CI jobBrad King2023-07-281-0/+2
| | | | | | `include-what-you-use` diagnostics, in practice, are specific to the environment's compiler and standard library. Update includes to satisfy IWYU for our CI job under Debian 12.
* CreateRulePlaceholderExpander(): enhance memory managementMarc Chevrier2023-05-041-6/+4
| | | | This method returns now a std::unique_ptr instance rather than a raw pointer.
* Link step: use linker dependency linker fileMarc Chevrier2023-05-031-0/+8
| | | | | | Based on work done by @ben.boeckel (!8051) Fixes: #22217
* cmLocalGenerator::MayBeRelativeToWorkDir: take care of all casesMarc Chevrier2023-05-021-1/+13
|
* CMake code rely on cmList class for CMake lists management (part. 2)Marc Chevrier2023-04-291-6/+3
|
* CMake code rely on cmList class for CMake lists management (part. 1)Marc Chevrier2023-04-241-1/+2
|
* Ninja: Use more efficient data structures to collect outputsNicolas van Kempen2023-03-281-12/+14
|
* Merge topic 'clang-windows-cxx-modules'Brad King2023-03-211-5/+22
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1b7c26da49 Ninja: Wrap rules using '>' shell redirection with 'cmd /C' on Windows ffd8537acf Clang: Record Clang 16.0 C++ modules flags only for GNU-like front-end 6013227230 cmGlobalNinjaGenerator: Use forward slashes in clang modmap format on Windows d9d74b5e8a cmDyndepCollation: Drop outdated mentions of CXX_MODULE_INTERNAL_PARTITIONS edab56d29a cmLocalNinjaGenerator: De-duplicate condition for using 'cmd /C' on Windows 8ebe3f92b3 cmGlobalNinjaGenerator: Detect GNU-like command-line for dyndep collator f3ca199c9b cmGlobalNinjaGenerator: Factor out GNU-like command-line detection on Windows f79817fcf0 cmCxxModuleMapper: Use value semantics in path conversion callback ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8346
| * Ninja: Wrap rules using '>' shell redirection with 'cmd /C' on WindowsBrad King2023-03-201-1/+18
| | | | | | | | | | | | | | | | This is needed for the clang-scan-deps rule added by commit 0e21e55fc5 (Clang: Record Clang 16.0 C++ modules flags only for GNU-like front-end, 2023-03-16). Fixes: #24611
| * cmLocalNinjaGenerator: De-duplicate condition for using 'cmd /C' on WindowsBrad King2023-03-181-5/+5
| |
* | add_custom_command: Add DEPENDS_EXPLICIT_ONLY option for NinjaAbdelmaged Khalifa2023-02-141-25/+27
|/ | | | | | | | | Add option `DEPENDS_EXPLICIT_ONLY` to `add_custom_command` to indicate that implicit dependencies coming from users of the output are not needed, and only consider dependencies explicitly specified in the custom command. Fixes: #17097
* cmGeneratorExpression: Require cmake instanceKyle Edwards2022-11-111-1/+1
|
* Ninja: Match showIncludes dependencies using console output code pageBrad King2022-10-301-21/+5
| | | | | | | | | Generalize the fix from commit 37a279f8d1 (Ninja: Write msvc_deps_prefix as UTF-8 when console codepage is UTF-8, 2020-07-31, v3.19.0-rc1~349^2). `cl /showIncludes` output is encoded using the console output code page, so this is the byte sequence that Ninja must use to match its lines. Fixes: #24068
* 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