summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'include-what-you-use'Brad King2016-11-081-9/+15
|\ | | | | | | | | 2e620f0b Fix several include-what-you-use findings
| * Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-9/+15
| |
* | cmGlobalNinjaGenerator: Suppress clang-tidy warningDaniel Pfeifer2016-11-051-2/+2
|/
* Ninja: Fix POST_BUILD noop on WindowsBrad King2016-10-281-0/+5
| | | | | | Use `cd .` instead of `:` in a Windows shell. Closes: #16393
* Ninja: Use binary dir for `$subdir/all` targetsAlexis Murzeau2016-10-241-28/+16
| | | | | | | | | | The targets added by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all` targets, 2016-03-11) use as `$subdir` the relative path from the top of the source tree to the current source directory. This is not correct when using `add_subdirectory(test test_bin)`. Instead we need to use the relative path from the top of the binary tree to the current binary directory as was done for related targets by commit v3.7.0-rc1~268^2 (Ninja: Add `$subdir/{test,install,package}` targets, 2016-08-05).
* Merge topic 'ninja-encoding'Brad King2016-10-211-2/+16
|\ | | | | | | | | ced77d2b Ninja: Use ANSI encoding for Ninja build files on Windows
| * Ninja: Use ANSI encoding for Ninja build files on WindowsDāvis Mosāns2016-10-201-2/+16
| | | | | | | | | | Pass ANSI encoding to cmGeneratedFileStream for use with Ninja generator.
* | Ninja: Fail early on when ninja build tool does not runBrad King2016-10-201-2/+11
| | | | | | | | | | | | | | | | Diagnose failure to run `ninja --version` and abort early. Otherwise we end up aborting with a confusing message about ninja version "" being too old. Closes: #16378
* | cmGlobalGenerator: Allow FindMakeProgram to failBrad King2016-10-201-2/+5
|/ | | | | Revise its signature to return `bool` so that it can fail and abort configuration early.
* cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|
* cmState: Port dependent code to new cmStateSnapshot nameStephen Kelly2016-10-191-4/+3
|
* cmState: Port dependent code to new cmStateDirectory nameStephen Kelly2016-10-191-1/+1
|
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-15/+17
|
* cmLinkLineComputer: Move ComputeLinkLibs from cmLocalGeneratorStephen Kelly2016-10-101-1/+2
| | | | | | | | | | | | | | | Add a cmOutputConverter to the cmLinkLineComputer and factory methods to facilitate shell escapes. Add state to the cmLinkLineComputer to record whether outputting for response files or for watcom, to satisfy the cmOutputConverter API. These are constant for the lifetime of the cmLinkLineComputer, even when its functionality is extended in the future. This also keeps the signatures of cmLinkLineComputer relatively simple. Pass the cmComputeLinkInformation as a method parameter so that cmLinkLineComputer is free from target-specific state. An instance should be usable for all targets in a directory.
* cmLinkLineComputer: Extract from cmLocalGeneratorStephen Kelly2016-10-101-0/+8
| | | | | | | | | | | CMake has several classes which have too many responsibilities. cmLocalGenerator is one of them. Start to extract the link line computation. Create generator-specific implementations of the interface to account for generator-specific behavior. Unfortunately MSVC60 has different behavior to everything else and CMake still generates makefiles for it. Isolate it with MSVC60-specific names.
* Ninja: ConstifyStephen Kelly2016-10-101-2/+4
|
* Simplify CMake per-source license noticesBrad King2016-09-271-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Ninja: Conditionally allow Fortran based on ninja 'dyndep' supportBrad King2016-09-221-4/+39
| | | | | Detect from the version of Ninja whether it supports the dynamically discovered dependencies (dyndep) feature needed to support Fortran.
* Ninja: Add internal tool to produce a ninja dyndep file for FortranBrad King2016-09-221-0/+220
| | | | | | | Create an internal `cmake -E cmake_ninja_dyndep` tool to read the "ddi" files generated by `cmake -E cmake_ninja_depends` from all sources in a target and generate a ninja dyndep file that tells Ninja about Fortran module dependencies within the target and on target dependencies.
* Ninja: Add internal tool to scan Fortran code for module dependenciesBrad King2016-09-221-0/+125
| | | | | | | | Create an internal `cmake -E cmake_ninja_depends` tool to scan an already-preprocessed Fortran translation unit for modules that it provides or requires. Save the information in a "ddi" file with a CMake-private format for intermediate dynamic dependency information. This file may the be loaded by another tool to be added later.
* Ninja: Add comment with Fortran dependency design documentationBrad King2016-09-221-0/+78
|
* Ninja: Add API to check for dyndep supportBrad King2016-09-221-0/+11
| | | | | | | Kitware maintains a branch of Ninja with support for dynamically discovered dependencies (dyndep) that has not yet been accepted upstream. Add an internal API to check whether the Ninja version in use for the build supports this feature.
* Ninja: Refactor ninja feature detectionBrad King2016-09-221-6/+15
| | | | | Check for features as soon as we know the ninja version. Save the results so we do not have to re-compare versions every time.
* Ninja: Refactor Fortran rejection logicBrad King2016-09-221-3/+13
| | | | | | | | | Delay rejection of Fortran until after we've determined the version of the `ninja` tool to be used. This will later allow us to enable Fortran support based on the version of ninja. While at it, make the rejection an immediate fatal error. Also provide a stack trace so readers know what code tried to enable Fortran.
* cmGlobalNinjaGenerator: Add API to check for implicit outputs supportBrad King2016-09-201-0/+7
| | | | | | Ninja 1.7 introduced support for implicit outputs on build statements. Add an internal API to check whether the Ninja version in use for the build supports this feature.
* cmGlobalNinjaGenerator: Teach WriteBuild about implicit outputsBrad King2016-09-201-7/+20
| | | | | | | | Ninja 1.7 introduced support for implicit outputs on build statements. Teach WriteBuild to generate the corresponding syntax. Leave it up to callers to decide whether implicit outputs are supported by the Ninja version in use. For now simply update all call sites to pass an empty list of implicit outputs.
* Convert: Avoid HOME_OUTPUT enum when converting to relative pathsStephen Kelly2016-09-191-2/+2
|
* Convert: Remove last uses of HOME enum valueStephen Kelly2016-09-191-2/+2
|
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-1/+12
|
* Merge topic 'cleanup-Convert'Brad King2016-08-301-2/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4332131d Convert: Make variables a bit more clear 5aca066c Convert: Remove UNCHANGED enum value 146bf926 Convert: Remove 'FULL' conversion 58ba87f8 Convert: Replace Convert(FULL) with equivalent e80314d7 Ninja: Replace ternary with if() 563ac22a Convert: Replace trivial conversion with new method 08be47cf Convert: Replace UNCHANGED conversions with new API call 564d3a1d Convert: Extract ConvertToRelativePath from Convert() 95a659f1 Convert: Replace FULL conversions with equivalent a8c7ccb1 VS: Replace FULL/UNCHANGED conversion with equivalent 5ad25ef4 Convert: Remove NONE conversion ac463841 Convert: Replace uses of Convert(NONE) 998d9ee9 VS: Replace variable with an if() ee49f006 Makefiles: Replace ternaries with if()s 51f7dcb0 Makefiles: Inline MakeLauncher into only caller ba4ba7c3 Makefiles: Simplify MakeLauncher return value ...
| * Convert: Replace trivial conversion with new methodStephen Kelly2016-08-271-2/+4
| |
* | add_custom_command: Add DEPFILE option for NinjaKulla Christoph2016-08-301-4/+6
|/ | | | | | | | Provide a way for custom commands to inform the ninja build tool about their implicit dependencies. For now simply make use of the option an error on other generators. Closes: #15479
* CMake: don't use else after returnDaniel Pfeifer2016-08-181-5/+4
|
* Ninja: Add `$subdir/{test,install,package}` targetsBrad King2016-08-091-3/+8
| | | | | | | | | | | | | With the Makefile generator one can use `cd $subdir; make install` to build and install targets associated with a given subdirectory. This is not possible to do with the Ninja generator since there is only one `build.ninja` file at the top of the build tree. However, we can approximate it by allowing one to run `ninja $subdir/install` at the top of the tree to build the targets in the corresponding subdirectory and install them. This also makes sense for `test`, `package`, and other GLOBAL_TARGET targets. It was already done for `all` by commit v3.6.0-rc1~240^2~2 (Ninja: Add `$subdir/all` targets, 2016-03-11).
* Ninja: Simplify computation of GLOBAL_TARGET outputsBrad King2016-08-091-6/+1
| | | | | | | | | In cmGlobalNinjaGenerator::AppendTargetOutputs we previously handled GLOBAL_TARGET outputs specially in order to avoid adding directory components to the output. However, this is not necessary because cmNinjaTargetGenerator::New already filters out copies of these targets that are not at the top level. Instead we can simply follow the same output computation code path as UTILITY targets.
* Ninja: Fix response file format for GNU-like Clang on WindowsBrad King2016-08-041-5/+7
| | | | | | | | The `CMAKE_<LANG>_SIMULATE_ID` variables are not set to "GNU" for a GNU-like Clang compiler on Windows. They are only set to "MSVC" for a MSVC-like Clang. Revise our response file format selection accordingly. Reported-by: Chaoren Lin <chaorenl@google.com>
* Ninja: Fix inter-target order-only dependencies of custom commandsBrad King2016-07-201-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | Custom command dependencies are followed for each target's source files and add their transitive closure to the corresponding target. This means that when a custom command in one target has a dependency on a custom command in another target, both will appear in the dependent target's sources. For the Makefile, VS IDE, and Xcode generators this is not a problem because each target gets its own independent build system that is evaluated in target dependency order. By the time the dependent target is built the custom command that belongs to one of its dependencies will already have been brought up to date. For the Ninja generator we need to generate a monolithic build system covering all targets so we can have only one copy of a custom command. This means that we need to reconcile the target-level ordering dependencies from its appearance in multiple targets to include only the least-dependent common set. This is done by computing the set intersection of the dependencies of all the targets containing a custom command. However, we previously included only the direct dependencies so any target-level dependency not directly added to all targets into which a custom command propagates was discarded. Fix this by computing the transitive closure of dependencies for each target and then intersecting those sets. That will get the common set of dependencies. Also add a test to cover a case in which the incorrectly dropped target ordering dependencies would fail.
* use CM_NULLPTRDaniel Pfeifer2016-06-281-10/+10
|
* Access std::ios_base with std::iosDaniel Pfeifer2016-06-141-2/+2
| | | | Just because it is shorter.
* Add missing braces around statements.Daniel Pfeifer2016-06-101-9/+18
| | | | | Apply fixits of clang-tidy's readability-braces-around-statements checker.
* Simplify boolean expressionsDaniel Pfeifer2016-06-021-3/+3
| | | | | | Use clang-tidy's readability-simplify-boolean-expr checker. After applying the fix-its, revise all changes *very* carefully. Be aware of false positives and invalid changes.
* Remove unnecessary local copies.Daniel Pfeifer2016-05-261-4/+3
| | | | | | | Use clang-tidy's performance-unnecessary-copy-initialization checker. After applying the fix-its (which turns the copies into const&), revise the changes and see whether the copies can be removed entirely by using the original instead.
* Merge topic 'improve-character-find-and-replace'Brad King2016-05-251-4/+4
|\ | | | | | | | | | | | | | | 5784747d Improve string find: prefer character overloads. 5cec953e Use std::replace for replacing chars in strings. 2a1a2033 cmExtraEclipseCDT4Generator: use std::replace. 34bc6e1f cmCTestScriptHandler: don't call find repeatedly.
| * Use std::replace for replacing chars in strings.Daniel Pfeifer2016-05-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | Find uses of `cmSystemTools::ReplaceString` where both `replace` and `with` are string literals with a size of one. Automate with: git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g" git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
* | Use enums defined in cmOutputConverter using their fully qualified name.Daniel Pfeifer2016-05-251-5/+5
|/ | | | | | | | | Mostly automated: values=("RelativeRoot" "NONE" "FULL" "HOME" "START" "HOME_OUTPUT" "START_OUTPUT" "OutputFormat" "UNCHANGED" "MAKERULE" "SHELL" "WATCOMQUOTE" "RESPONSE" "FortranFormat" "FortranFormatNone" "FortranFormatFixed" "FortranFormatFree") for i in "${values[@]}"; do git grep -l cmLocalGenerator::$i | xargs sed -i "s|cmLocalGenerator::$i|cmOutputConverter::$i|g"; done
* Ninja: Support embedding of CMake as subninja projectNicolas Despres2016-05-171-3/+44
| | | | | | Add a `CMAKE_NINJA_OUTPUT_PATH_PREFIX` variable. When it is set, CMake generates a `build.ninja` file suitable for embedding into another ninja project potentially generated by an alien generator.
* Ninja: Pass all build paths through a central methodNicolas Despres2016-05-171-7/+16
| | | | This gives us a central location to revise paths.
* Ninja: Pre-compute "CMakeCache.txt" build target nameNicolas Despres2016-05-171-2/+3
|
* Ninja: Pre-compute "all" build target nameNicolas Despres2016-05-171-2/+4
|
* Ninja: Simplify generation of custom target logical pathBrad King2016-05-171-9/+4
| | | | | | In `AppendTargetOutputs` we generate a logical build target name for each UTILITY command. Simplify the logic to avoid testing the result of `ConvertToNinjaPath`.