summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* cmGlobalNinjaGenerator: Add helper to compute absolute paths for build.ninjaBrad King2021-05-251-0/+1
|
* Ninja: Handle depfiles with absolute paths to generated filesBrad King2021-05-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+14
| | | | | | 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-7/+9
| | | | | Re-order arguments to group those with similar roles. Use move semantics to avoid copying vectors of strings.
* Ninja: Use new wincodepage tool to determine encodingKyle Edwards2021-03-091-0/+5
| | | | | | | | 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
* Ninja Multi-Config: Enable relink diagnostic messageBrad King2021-02-031-0/+2
| | | | | We already have a message for the "Ninja" generator, but it applies to the "Ninja Multi-Config" generator too.
* clang-tidy: fix `readability-redundant-access-specifiers` warningsBen Boeckel2021-01-271-2/+0
|
* Merge topic 'cpp-modules'Brad King2021-01-071-9/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 39cbbb59a5 ninja: add experimental infrastructure to generate gcc-format modmap files 791b4d26d6 ninja: add experimental infrastructure to generate modmap files with dyndep 4b23359117 ninja: Add experimental infrastructure for C++20 module dependency scanning f814d3b3c6 cmNinjaTargetGenerator: use $OBJ_FILE for the object b0fc2993e1 Treat the '.mpp' file extension as C++ code 988f997100 cmScanDepFormat: Fix name of our internal tool in parse errors dacd93a2db ninja: De-duplicate version numbers required for ninja features 533386ca29 cmStandardLevelResolver: Factor out helper to capture stoi exceptions Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Ben Boeckel <ben.boeckel@kitware.com> Acked-by: Robert Maynard <robert.maynard@kitware.com> Acked-by: Shannon Booth <shannon.ml.booth@gmail.com> Merge-request: !5562
| * ninja: add experimental infrastructure to generate modmap files with dyndepBen Boeckel2021-01-051-9/+7
| | | | | | | | | | | | | | | | The scan step may need to output additional information for the compiler, not just the build tool. The modmap is assumed to be beside the object output. Additional refactoring may open up a channel to inform per-source paths to the dyndep rule in the future, but is not done here.
| * ninja: Add experimental infrastructure for C++20 module dependency scanningBrad King2021-01-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optionally enable this infrastructure through an undocumented `CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP` variable. Currently this is experimental and intended for use by compiler writers to implement their scanning tools. Warn as such when the feature is activated. Later when compilers provide the needed scanning tools we can enable this variable from our corresponding compiler information modules. It is never meant to be set by project code. When enabled, generate a build graph similar to what we use for Fortran module dependencies. There are some differences needed because we can scan dependencies without explicit preprocessing, and can directly compile the original source afterward. Co-Author: Ben Boeckel <ben.boeckel@kitware.com>
* | Code style: add missed explicit 'this->'Oleksandr Koval2021-01-051-2/+5
|/ | | | | CMake uses explicit 'this->' style. Using custom clang-tidy check we can detect and fix places where 'this->' was missed.
* Merge topic 'custom-command-output-genex-nmc'Brad King2020-12-161-3/+42
|\ | | | | | | | | | | | | | | | | | | | | | | 1526ae3aba Tests: Add cases for Ninja Multi-Config cross-config custom commands dcf9f4d2f7 Ninja Multi-Config: Add support for cross-config custom commands 15467f12f7 cmLocalGenerator: Adopt custom target 'force' output name generation 7b64b0cd5a cmLocalGenerator: Refactor custom command generator construction d29da8ed3e cmMakefile: Simplify custom target 'force' output name generation 2b1cc175ee Help: Clarify version adding add_custom_{command,target} OUTPUT genex support Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5612
| * Ninja Multi-Config: Add support for cross-config custom commandsKyle Edwards2020-12-151-3/+42
| | | | | | | | Co-Author: Brad King <brad.king@kitware.com>
* | Merge topic 'ninja-no-cleandead'Brad King2020-12-151-2/+0
|\ \ | |/ |/| | | | | | | | | | | 1144d25094 Merge branch 'backport-ninja-no-cleandead' into ninja-no-cleandead 73a961eaba Ninja: Remove cleandead on regeneration Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5614
| * Merge branch 'backport-ninja-no-cleandead' into ninja-no-cleandeadBrad King2020-12-141-2/+0
| |\
| | * Ninja: Remove cleandead on regenerationBrad King2020-12-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the `cleandead` tool invocation added by commit fb18215904 (Ninja: clean ninja metadata once generated, 2019-05-13, v3.17.0-rc1~207^2). The tool deletes files that were not previously deleted by regenerating the build system. Also, there are use cases where no-longer-generated files should not be removed, such as Qt's TS files. Fixes: #21549
* | | Merge topic 'ninja-regen-metadata'Brad King2020-12-011-0/+5
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | 73d1c78bf4 ci: update to use ninja 1.10.2 11f4259362 Ninja: Clean metadata after regen during build on Windows with 1.10.2+ Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5555
| * | Ninja: Clean metadata after regen during build on Windows with 1.10.2+Brad King2020-11-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ninja 1.10.2 fixes support for `generator = 1` rules that run metadata update commands during regeneration while a build is running. Update the condition added by commit ccaa0bccc4 (Ninja: Do not clean metadata when re-generating inside a running build, 2020-01-27, v3.17.0-rc1~73^2) to remove our workaround when Ninja is new enough. Fixes: #20274
* | | Merge topic 'ninja-cleandead-no-dyndep'Brad King2020-11-111-0/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | c5011399c5 Ninja: Avoid cleandead with dyndep bindings for Fortran module dependencies Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5490
| * | Ninja: Avoid cleandead with dyndep bindings for Fortran module dependenciesBrad King2020-11-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Ninja `cleandead` tool does not account for implicit outputs discovered by `dyndep` bindings and can remove Fortran `.mod` files that are still needed. Disable the `cleandead` step when using `dyndep` bindings. Fixes: #21406
* | | Constify some code as suggested by clang-tidyCengizhan Pasaoglu2020-10-191-3/+3
| | |
* | | Merge topic 'ninja-depfile-transformation'Brad King2020-10-141-0/+5
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 146e1e6ba1 Ninja: Transform DEPFILEs with policy CMP0116 596439b1bb cmCustomCommandGenerator: Add option to transform depfile b2c14bc774 cmake -E: Add cmake_transform_depfile internal command 946adadd40 cmGccDepfileReader: Rework helper code Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5325
| * | | Ninja: Transform DEPFILEs with policy CMP0116Kyle Edwards2020-10-131-0/+5
| |/ / | | | | | | | | | Fixes: #21267
* | | Ninja Multi-Config: Read configuration variables as normal variablesKyle Edwards2020-10-131-3/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Early versions of the Ninja Multi-Config generator required CMAKE_CONFIGURATION_TYPES and friends to be cache variables in order to support selecting the default config in cmake(1) --build. The behavior of cmake(1) --build has since been updated to no longer require this, and requiring these variables to be cache variables is inconsistent with the other generators. Read the variables as normal CMake variables like the other generators. This does not require a policy, since the only scenario where this would cause a breakage is one where the cache variable and the CMake variable are explicitly set to different values, which doesn't make sense to do anyway.
* | Modernize: Use #pragma once in all header filesKitware Robot2020-09-031-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
* | ISPC: Support ISPC header generation byproducts and parallel buildsRobert Maynard2020-08-281-0/+6
| |
* | Ninja: Remove parameter default for cmNinjaTargetDependsKyle Edwards2020-07-241-8/+7
|/
* Ninja Multi-Config: Make "install" targets depend on default configsKyle Edwards2020-05-221-0/+5
| | | | | | And add an "install:all" target. Fixes: #20713
* Ninja: Remove config suffix from order-only targetKyle Edwards2020-04-231-2/+5
| | | | Fixes: #20621
* Generator: Don't allow Ninja Multi-Config variables on other generatorsKyle Edwards2020-02-271-0/+4
| | | | | | We may want to enable these variables later on with specific semantics. To avoid breaking backwards compatibility, make it an error to use them for now.
* Ninja Multi-Config: Fix issue with "all" in CMAKE_NMC_DEFAULT_CONFIGSKyle Edwards2020-02-111-1/+1
| | | | | | | | Prior to this fix, CMAKE_NMC_DEFAULT_CONFIGS would inherit "all" from the union of CMAKE_NMC_DEFAULT_BUILD_FILE_CONFIG and CMAKE_NMC_CROSS_CONFIGS. This is inconsistent with the behavior of the "all" target signifying CMAKE_NMC_CROSS_CONFIGS. Update "all" in CMAKE_NMC_DEFAULT_CONFIGS to inherit only from CMAKE_NMC_CROSS_CONFIGS.
* Ninja Multi-Config: Add support for DEPFILE option in add_custom_command()Kyle Edwards2020-02-071-0/+2
| | | | And give other generators a path forward to add support in the future.
* Ninja Multi-Config: Use build.ninja if cmake --build has no --configKyle Edwards2020-02-041-0/+5
| | | | | | If cmake --build is called with no --config argument, and a build.ninja file is available, use that instead of defaulting to the Debug config.
* Ninja Multi-Config: Shuffle variables aroundKyle Edwards2020-02-031-12/+15
| | | | | | Remove redundant variable CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE. Rename other variables. Document and improve handling of error conditions.
* Ninja: Factor metadata cleanup into dedicated methodBrad King2020-01-271-0/+1
|
* Ninja Multi-Config: Add variable to control configs used in cross-config buildKyle Edwards2020-01-231-0/+6
|
* Ninja Multi-Config: Add variable to control aliases in build.ninjaKyle Edwards2020-01-221-0/+4
|
* Refactor: Split Ninja files into impl-<Config>.ninja and build-<Config>.ninjaKyle Edwards2020-01-221-3/+30
|
* Ninja Multi-Config: Make cross-config building opt-inKyle Edwards2020-01-101-0/+2
| | | | | | | | | | | Many users will want to use the Ninja Multi-Config generator like a traditional Visual Studio-style multi-config generator, which doesn't mix configurations - custom commands are built using target executables of the same configuration the command is for. We do not want to force these people to generate an N*N build matrix when they only need N*1, especially if they have lots of targets. Add a new variable, CMAKE_NINJA_CROSS_CONFIG_ENABLE, to opt-in to the cross-config build matrix.
* Merge topic 'ninja-postgen-commands'Brad King2020-01-101-0/+9
|\ | | | | | | | | | | | | | | fb18215904 Ninja: clean ninja metadata once generated Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Jan Niklas Hasse <jhasse@bixense.com> Merge-request: !3316
| * Ninja: clean ninja metadata once generatedBen Boeckel2020-01-061-0/+9
| | | | | | | | Fixes: #15830
* | GlobalGenerator family: modernize memory managementMarc Chevrier2020-01-071-4/+6
|/
* cmGlobalGenerator: modernize memrory managemenbtMarc Chevrier2019-12-301-1/+1
|
* Ninja: Add multi-config variantKyle Edwards2019-12-131-18/+168
| | | | Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
* Refactor: Prepare Ninja generator for multi-configKyle Edwards2019-12-131-3/+8
|
* cmLocalGenerator: modernize memory managementMarc Chevrier2019-12-091-6/+2
|
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-1/+2
| | | | | Run the `clang-format.bash` script to update our C and C++ code to a new include order `.clang-format`. Use `clang-format` version 6.0.
* Ninja: Simplify top-level "all" target generationBrad King2019-09-301-11/+1
| | | | | Remove its dedicated implementation and update the per-directory "all" target generation to work for the top-level directory too.
* cmGlobalNinjaGenerator: Remove unused AddDependencyToAll overloadBrad King2019-09-301-1/+0
|
* Merge branch 'backport-3.15-fix-EXCLUDE_FROM_ALL-subdir-all'Brad King2019-09-301-2/+2
|\ | | | | | | | | | | | | | | Resolve conflicts with changes since the 3.15 series: * Convert `cmSystemTools::IsOn` => `cmIsOn`. * Move one "EXCLUDE_FROM_ALL" target property logic fix to its new location in `cmMakefile::AddNewUtilityTarget`.