summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Performance: Add an index to Change cmLocalGenerator::GeneratorTargets.Aaron Orenstein2017-08-161-2/+2
| | | | | | | | | | | Add an index to Change cmLocalGenerator::GeneratorTargets for faster lookup by name. Also changed a bunch of uses of cmLocalGenerator::GetGeneratorTargets() to take const references instead of copying the vector. Represent generator targets as a map (name -> target) to make name lookups more efficient instead of looping through the entire vector to find the desired one.
* Add const-reference qualificationsPavel Solodovnikov2017-05-261-1/+1
|
* cmLocalCommonGenerator: Save CMAKE_BUILD_TYPE on constructionBrad King2017-05-151-2/+0
| | | | | | | | | | | | | | | Copy the value to our `ConfigName` member on construction to ensure it is available even to code paths that run before `Generate`. We once needed to delay this lookup until `Generate` because the local generators were at one time created before `Configure`. Now they are created at generate time which is late enough to expect `CMAKE_BUILD_TYPE` to be available. Without this, `cmGlobalUnixMakefileGenerator3::WriteConvenienceRules` causes use of `ConfigName` before it is populated which breaks use of source files that depend on the `$<CONFIG>` generator expression. Fixes: #16889
* Merge topic 'split-sysroot'Brad King2017-05-111-2/+3
|\ | | | | | | | | | | | | 53e89b6a Add options for separate compile and link sysroots Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !819
| * Add options for separate compile and link sysrootsBrad King2017-05-091-2/+3
| | | | | | | | | | | | | | | | | | Add `CMAKE_SYSROOT_COMPILE` and `CMAKE_SYSROOT_LINK` variables to as operation-specific alternatives to `CMAKE_SYSROOT`. This will be useful for Android NDKs that compile and link with different sysroot values (e.g. `r14` with unified headers). Co-Author: Florent Castelli <florent.castelli@gmail.com>
* | Ninja: Fix command concatenation on WindowsBernhard Burgermeister2017-05-091-1/+7
|/ | | | | | | | | | | Put commands that contain `||` into brackets to avoid early abort of execution by `cmd.exe` because `||` has higher precedence than `&&` in `cmd.exe`. Add test to check for command execution after `||` as part of a parameter and as command separator. Fixes: #16850
* Merge topic 'loosen-object-deps'Brad King2017-04-241-2/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | d96e5d9a Tests: use BYPRODUCTS in the CustomCommandWorkingDirectory test 664591ce RunCMake.Ninja: add a test for assumed sources adf60b28 ninja: break unnecessary target dependencies 01c5bb95 RunCMake.Ninja: support passing arguments when running ninja 7f947b60 ninja: remove duplicate order-only dependencies e9827eba ninja: describe the intermediate order depends target better b57b7d8e Ninja: Order Fortran dyndep file generation explicitly Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !430
| * ninja: break unnecessary target dependenciesBen Boeckel2017-04-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, given two libraries, X and Y where X depends on Y, all object compilations of X would require the Y library to have been linked before being compiled. This is not necessary and can instead be loosened such that object compilations of X only depend on the order-only dependencies of Y to be completed. This is to ensure that generated sources, headers, custom commands, etc. are completed before X starts to compile its objects. This should help build performance in projects with many libraries which cause a deep library dependency chain. Previously, a library at the bottom would not start compilation until after all other libraries completed, but now only its link step needs to wait and its compilation jobs can be run in parallel with other tasks. Fixes: #15555
* | CUDA: Allow sources to be compiled to .ptx filesRobert Maynard2017-04-201-2/+5
|/ | | | | When the target property `CUDA_PTX_COMPILATION` is enabled CUDA OBJECT libraries will generate ptx files instead of object files.
* Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-7/+8
|
* Ninja: Fix POST_BUILD noop on WindowsBrad King2016-10-281-6/+2
| | | | | | Use `cd .` instead of `:` in a Windows shell. Closes: #16393
* cmListFileCache: Remove cmState header includeStephen Kelly2016-10-191-0/+1
| | | | | Include it in dependents which have previously relied on it transitively.
* cmState: Port dependents to new cmStateTypes headerStephen Kelly2016-10-191-1/+1
|
* cmState: Move TargetType enum to separate namespaceStephen Kelly2016-10-191-1/+1
|
* cmRulePlaceholderExpander: Port clients to direct-useStephen Kelly2016-10-151-3/+15
| | | | | | Add a factory function to cmLocalGenerator so that variableMappings can be provided from it, and so that Ninja can always have a hard-coded TargetImpLib.
* cmLocalGenerator: Use a converter in rule replacement APIStephen Kelly2016-10-151-1/+1
| | | | | | | The rule replacement API should not really be in cmLocalGenerator, but it was historically, and this coupled many other things together here too, such as output conversion. Make the output converter a parameter so that rule replacement can be removed from cmLocalGenerator.
* cmLocalGenerator: Remove the launcher from RuleVariablesStephen Kelly2016-10-151-4/+6
| | | | | | | | | This one is not like the others as it doesn't participate in substitutions. Keep ExpandRuleVariables doing only one thing and make callers responsible for inserting a launcher prefix, simplifying the code all-around. Remove now-obsolete InsertRuleLauncher method.
* cmLinkLineComputer: Extract from cmLocalGeneratorStephen Kelly2016-10-101-6/+0
| | | | | | | | | | | 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: Extract identical code from conditionStephen Kelly2016-10-081-3/+1
|
* Ninja: Replace array access with local variableStephen Kelly2016-10-071-4/+4
|
* Ninja: Separate two coupled callsStephen Kelly2016-10-071-4/+3
|
* cmLocalGenerator: Simplify ConvertToLinkReferenceStephen Kelly2016-10-061-3/+2
| | | | | Make conversion to output format the caller responsibility, so that the method only 'converts to a link reference'.
* 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.
* Convert: Inline uses of START_OUTPUTStephen Kelly2016-09-191-2/+4
|
* Convert: Inline uses of HOME_OUTPUTStephen Kelly2016-09-191-1/+2
|
* Common: Use a string instead of enum for WorkingDirectoryStephen Kelly2016-09-191-1/+1
|
* Convert: Avoid HOME_OUTPUT enum when converting to relative pathsStephen Kelly2016-09-191-1/+1
|
* fix a load of include-what-you-use violationsDaniel Pfeifer2016-09-031-0/+9
|
* Merge topic 'cleanup-Convert'Brad King2016-08-301-10/+13
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Convert(FULL) with equivalentStephen Kelly2016-08-271-1/+2
| | | | | | | | | | This is more explicit than funnelling everything through the Convert method.
| * Ninja: Replace ternary with if()Stephen Kelly2016-08-271-3/+4
| | | | | | | | On principle of segregating the interface.
| * Convert: Replace trivial conversion with new methodStephen Kelly2016-08-271-1/+1
| |
| * Convert: Replace uses of Convert(NONE)Stephen Kelly2016-08-271-2/+2
| | | | | | | | These are equivalent to ConvertToOutputFormat.
| * Makefiles: Replace ternaries with if()sStephen Kelly2016-08-271-6/+7
| |
* | add_custom_command: Add DEPFILE option for NinjaKulla Christoph2016-08-301-1/+2
|/ | | | | | | | 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
* Ninja: Fix inter-target order-only dependencies of custom commandsBrad King2016-07-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Refactor Makefile/Ninja tool working directory storageBrad King2016-06-171-1/+1
| | | | | Move cmCommonTargetGenerator::WorkingDirectory to cmLocalCommonGenerator and add an access method.
* Add missing braces around statements.Daniel Pfeifer2016-06-101-7/+14
| | | | | Apply fixits of clang-tidy's readability-braces-around-statements checker.
* Merge topic 'improve-character-find-and-replace'Brad King2016-05-251-1/+1
|\ | | | | | | | | | | | | | | 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.
| * Improve string find: prefer character overloads.Daniel Pfeifer2016-05-241-1/+1
| | | | | | | | | | Apply fix-its from clang-tidy's performance-faster-string-find checker. Ignore findings in kwsys.
* | Use enums defined in cmOutputConverter using their fully qualified name.Daniel Pfeifer2016-05-251-10/+17
|/ | | | | | | | | 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: Pass all build paths through a central methodNicolas Despres2016-05-171-2/+7
| | | | This gives us a central location to revise paths.
* Ninja: Convert link library file names like all other output pathsNicolas Despres2016-05-171-1/+2
| | | | | | All paths generated on Ninja-invoked command lines should be passed through ConvertToNinjaPath. Fix ConvertToLinkReference to call this instead of partially duplicating its implementation.
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-157/+106
| | | | | | | | | | | | | 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.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+1
| | | | | 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.
* Merge topic 'ninja-restat-custom-command-byproducts'Brad King2016-04-081-2/+2
|\ | | | | | | | | | | add7abc8 Ninja: Restat custom command byproducts even with a SYMBOLIC output (#16049) ff805113 Ninja: Fix detection of custom command symbolic outputs
| * Ninja: Restat custom command byproducts even with a SYMBOLIC output (#16049)Brad King2016-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change in commit v3.5.0-rc1~198^2 (Ninja: Always re-run custom commands that have symbolic dependencies, 2015-11-19) broke the byproducts feature added by commit v3.2.0-rc1~340^2~2 (Add an option for explicit BYPRODUCTS of custom commands, 2014-11-13) when SYMBOLIC outputs also appear. This case occurs with AUTORCC-generated custom targets because the output is SYMBOLIC (to always run) and the generated file is a byproduct (for restat so dependents do not run unnecessarily). The two use cases conflict because Ninja does not support per-output restat. Favor restat whenever byproducts are present because it is required for byproducts to work correctly. In use cases where we want an always-run chain we simply will not be able to also use byproducts.
| * Ninja: Fix detection of custom command symbolic outputsBrad King2016-04-051-1/+1
| | | | | | | | | | | | | | Fix logic introduced by commit v3.5.0-rc1~198^2 (Ninja: Always re-run custom commands that have symbolic dependencies, 2015-11-19) to not consider only the last output. We need to know if any output is SYMBOLIC, so stop checking as soon as one is found.