summaryrefslogtreecommitdiff
path: root/Source/cmGlobalNinjaGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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`.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-565/+383
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Remove `//------...` horizontal separator commentsBrad King2016-05-091-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | Modern editors provide plenty of ways to visually separate functions. Drop the explicit comments that previously served this purpose. Use the following command to automate the change: $ git ls-files -z -- \ "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" | egrep -z -v "^Source/cmCommandArgumentLexer\." | egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmDependsJavaLexer\." | egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmExprLexer\." | egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmFortranLexer\." | egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" | egrep -z -v "^Source/cmListFileLexer\." | egrep -z -v "^Source/cm_sha2" | egrep -z -v "^Source/(kwsys|CursesDialog/form)/" | egrep -z -v "^Utilities/(KW|cm).*/" | xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}' This avoids modifying third-party sources and generated sources.
* Isolate formatted streaming blocks with clang-format off/onBrad King2016-05-061-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Source: Stabilize include orderBrad King2016-04-291-1/+2
| | | | | Each source file has a logical first include file. Include it in an isolated block so that tools that sort includes do not move them.
* cmGlobalNinjaGenerator: Clarify logic for forcing use of response filesDmitry Ivanov2016-04-071-3/+4
| | | | | Update the WriteBuild method to use a negative command line length limit to specify that we should force use of response files.
* Ninja: Add `$subdir/all` targetsCharles Huet2016-03-181-0/+82
| | | | | | | | | | | | | With the Makefile generator one can use `cd $subdir; make all` to build all 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/all` at the top of the tree to build the targets in the corresponding subdirectory. Port logic from cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2 to cmGlobalNinjaGenerator in order to produce equivalent directory-level targets.
* Drop Visual Studio 6 generatorBrad King2016-03-091-1/+0
| | | | | | This generator has been deprecated since CMake 3.3. Remove it. Update documentation, modules, and tests to drop content specific to this generator.
* Ninja: Fix non-determinism in generated target dependency order (#15968)Brad King2016-02-121-1/+4
| | | | | | | We represent target dependency sets as `set<cmTargetDepend>` which orders by a `cmGeneratorTarget const*` pointer value. Therefore the order of dependencies encountered in AppendTargetDepends is not predictable. Sort them by content to make the result deterministic.
* Ninja: Add 'restat' parameter to custom command generation methodBrad King2015-11-191-1/+6
| | | | Pass 'true' from all call sites to preserve existing behavior.
* Ninja: Refactor generation of 'restat' on custom commandsBrad King2015-11-191-1/+2
| | | | | | Move generation of 'restat = 1' from the CUSTOM_COMMAND rule to every build statement using it. This will allow future selection of this option on a per-custom-command basis.
* cmGlobalNinjaGenerator: Save 'ninja' version very earlyBrad King2015-11-021-14/+11
| | | | | Keep it in a member variable for convenient reference. Store the value as soon as it is known.
* cmGlobalNinjaGenerator: Save path to 'ninja' tool very earlyBrad King2015-11-021-3/+11
| | | | | Keep it in a member variable for convenient reference. Set the value as soon as it is known.
* cmGeneratorTarget: Add GetUtilities APIStephen Kelly2015-10-271-1/+1
|
* Ninja: Port to cmGeneratorTarget.Stephen Kelly2015-10-241-13/+10
|
* Use cmLocalGenerator at generate-time.Stephen Kelly2015-10-241-2/+2
|
* cmGeneratorTarget: Copy IsFrameworkOnApple from cmTarget.Stephen Kelly2015-10-191-2/+3
| | | | Leave the cmTarget method behind for now to implement cmInstallCommand.