summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'refactor-iwyu-code'Brad King2017-09-151-1/+1
|\ | | | | | | | | | | | | 3bbe95f5 Clean up iwyu code to not be one big if statement. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1247
| * Clean up iwyu code to not be one big if statement.Bill Hoffman2017-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | This commit changes the internal -E__run_iwyu to be -E__run_co_compile. This is used for co-compile commands. These are tools that want to mirror the compiler. For each compiler invocation the tool will be invoked first. This started as a way to implement include what you use (iwyu), but has expanded to include cpplint, cppcheck and others. Likely there will be more in the future as well. This commit implements each one in its own function and provides a way to add additional ones in the future with less work.
* | Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-48/+28
|/ | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* Add properties to run cppcheck along with the compilerBill Hoffman2017-08-301-2/+10
| | | | | | Create a `<LANG>_CPPCHECK` target property (initialized by a `CMAKE_<LANG>_CPPCHECK` variable) to specify a `cppcheck` command line to be run along with the compiler.
* Merge topic 'cxx11-nullptr'Brad King2017-08-251-3/+3
|\ | | | | | | | | | | | | 5962db43 Use C++11 nullptr Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1175
| * Use C++11 nullptrDaniel Pfeifer2017-08-241-3/+3
| |
* | Ninja: Fix references to source files in gfortran diagnosticsRaul Laasner2017-08-231-1/+7
|/ | | | | | | | | The Ninja generator preprocesses and compiles separately for Fortran. When compiling, tell gfortran that the source is already preprocessed so that it will honor the `# <line>` directives when producing diagnostics messages. Fixes: #17160
* Merge topic 'ninja_cuda_export_compile_commands_support'Brad King2017-07-141-6/+21
|\ | | | | | | | | | | | | 712af07e CUDA: CMAKE_EXPORT_COMPILE_COMMANDS now works with CUDA and Ninja Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1055
| * CUDA: CMAKE_EXPORT_COMPILE_COMMANDS now works with CUDA and NinjaRobert Maynard2017-07-131-6/+21
| | | | | | | | Fixes: #17061
* | Ninja: always use response file for cmake_ninja_dyndepYurii Batrak2017-07-101-8/+2
| | | | | | | | | | | | | | Command line argument passed to the internal tool "cmake_ninja_dyndep" could hit MAX_ARG_STRLEN on Linux for projects with a large code base. To prevent such problems, a response file was opted for argument transfer in all cases, not only on Windows.
* | CUDA: Add option to run the compiler through launcher toolsBrad King2017-06-091-1/+2
|/ | | | | | | | Add a `CUDA_COMPILER_LAUNCHER` target property like those added for C and CXX by commit v3.4.0-rc1~450^2 (Add options to launch the compiler through tools like ccache or distcc, 2015-06-04). Fixes: #16953
* Ninja: Fix escaping of path to depfileBrad King2017-05-301-4/+4
| | | | | Replace the dedicated and non-portable escaping code with use of our standard escaping logic.
* Merge topic 'ninja-dyndep-response-file'Brad King2017-04-251-4/+15
|\ | | | | | | | | | | | | 594d3d6f Ninja: support response file for cmake_ninja_depends on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !722
| * Ninja: support response file for cmake_ninja_depends on WindowsBernhard Burgermeister2017-04-251-4/+15
| | | | | | | | | | | | | | The internal tool "cmake_ninja_depends" now supports reading the list of ddi files from a reponse file to circumvent Windows command line length limits. Use this response file for dyndep rule on Windows.
* | Merge topic 'loosen-object-deps'Brad King2017-04-241-9/+22
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | 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-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * ninja: remove duplicate order-only dependenciesBen Boeckel2017-04-211-0/+4
| |
| * ninja: describe the intermediate order depends target betterBen Boeckel2017-04-211-1/+1
| | | | | | | | This is only used for compiled objects, so indicate it as such.
| * Ninja: Order Fortran dyndep file generation explicitlyBrad King2017-04-211-0/+11
| | | | | | | | | | | | | | | | | | Each target's dyndep file generation depends on loading information generated by the same step in its dependencies. Add an explicit ordering dependency to ensure the needed information is available. Without the explicit ordering dependency we were abusing the more general target ordering rules through the preprocessor rules generating the `.ddi` files used as input to dyndep file generation.
* | CUDA: Allow sources to be compiled to .ptx filesRobert Maynard2017-04-201-0/+3
|/ | | | | When the target property `CUDA_PTX_COMPILATION` is enabled CUDA OBJECT libraries will generate ptx files instead of object files.
* Use quotes for non-system includesDaniel Pfeifer2017-04-111-2/+2
| | | | | | | | | | | | | Automate with: git grep -l '#include <cm_' -- Source \ | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g' git grep -l '#include <cmsys/' -- Source \ | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g' git grep -l '#include <cm[A-Z]' -- Source \ | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
* Merge topic 'ninja-fortran-depfile-fix'Brad King2017-03-221-1/+3
|\ | | | | | | | | | | | | 805706b3 Ninja: Fix Fortran `include` dependency on generated file Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !601
| * Ninja: Fix Fortran `include` dependency on generated fileBrad King2017-03-211-1/+3
| | | | | | | | | | | | | | | | Work around upstream ninja issue 1251 by converting include directories used by our Fortran dependency scanner to the same path format that we use in preprocessor `-I` flags and in the `build.ninja` manifest. Fixes: #16722
* | Merge topic 'cuda_no_ninja_response_support'Brad King2017-03-221-3/+5
|\ \ | | | | | | | | | | | | | | | | | | feaea065 CUDA: Disable support for using response files. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !596
| * | CUDA: Disable support for using response files.Robert Maynard2017-03-211-3/+5
| |/
| * Merge branch 'ninja-no-full-path' into releaseBrad King2017-02-241-4/+3
| |\
* | | Support WINDOWS_EXPORT_ALL_SYMBOLS with `.def` filesBrad King2017-03-211-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `WINDOWS_EXPORT_ALL_SYMBOLS` target property exports all symbols found in object files explicitly given to the linker. However, the linker may also find additional symbols in dependencies and copy them into the linked binary (e.g. from `msvcrt.lib`). Provide a way to export an explicit list of such symbols by adding a `.def` file as a source file. Fixes: #16473
* | | Refactor WINDOWS_EXPORT_ALL_SYMBOLS implementationBrad King2017-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Use `cmGeneratorTarget::ModuleDefinitionInfo` to combine the implementation of `WINDOWS_EXPORT_ALL_SYMBOLS` with that of using a `.def` file as a source. Only one of these could be used within a single target before anyway.
* | | Refactor module definition file selectionBrad King2017-03-091-3/+4
| | | | | | | | | | | | | | | | | | Create a `ModuleDefinitionInfo` structure for each configuration of a target to hold corresponding information about the selected module definition file (`.def` source).
* | | Merge topic 'ninja-no-full-path'Brad King2017-02-271-4/+3
|\ \ \ | |/ / |/| / | |/ | | 666ad1df Revert "Ninja: Use full path for all source files"
| * Revert "Ninja: Use full path for all source files"Brad King2017-02-241-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit v3.7.0-rc1~275^2 (Ninja: Use full path for all source files, 2016-08-05). Unfortunately using absolute paths can cause incorrect rebuilds due to ninja limitations. The ninja manual [1] explains: > ... using absolute paths, your depfile may result in a mixture of > relative and absolute paths. Paths used by other build rules need > to match exactly. Passing an absolute path to a source file to the compiler while using a relative path in the ninja build manifest can cause such mixture and lead to incorrect rebuilds. Simply revert the change for now. Note that there was a follow-up to the original change in commit v3.7.0-rc2~10^2 (Ninja: Fix RC language depfile generation with cmcldeps, 2016-10-13). We don't need to revert that because that change made the relevant code cleverly adapt to whatever variable we use to reference the source file. [1] https://ninja-build.org/manual.html#_deps Fixes: #16675 Issue: #13894
* | CUDA: Fix boolean interpretation of CUDA_SEPARABLE_COMPILATIONBrad King2017-02-201-1/+2
| | | | | | | | | | If the property is explicitly set to a non-true value we should not treat it as true.
* | Add properties to run the cpplint style checker with the compilerJamie Snape2017-01-231-1/+9
| | | | | | | | | | | | Create a `<LANG>_CPPLINT` target property (initialized by a `CMAKE_<LANG>_CPPLINT` variable) to specify a `cpplint` style checker command line to be run along with the compiler.
* | CUDA: Detect MSVC architecture idBrad King2017-01-121-1/+2
| |
* | Makefile,Ninja: De-duplicate MSVC compiler PDB path selectionBrad King2016-12-151-15/+1
| | | | | | | | | | Add a helper to cmCommonTargetGenerator instead of duplicating it in cmMakefileTargetGenerator and cmNinjaTargetGenerator.
* | Merge topic 'clang-tidy'Brad King2016-12-121-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | b932cd42 clang-tidy: apply misc-redundant-expression fixes 88da3d68 clang-tidy: apply misc-suspicious-string-compare fixes 58c66393 clang-tidy: apply readability-static-definition-in-anonymous-namespace fixes 85bfddda clang-tidy: apply readability-redundant-control-flow fixes 2988abd9 clang-tidy: apply modernize-use-bool-literals fixes a74e6893 clang-tidy: apply readability-redundant-string-init fixes cac529dd clang-tidy: apply performance-faster-string-find fixes 7c9db8f8 clang-tidy: apply performance-unnecessary-value-param fixes
| * | clang-tidy: apply readability-redundant-string-init fixesDaniel Pfeifer2016-12-121-1/+1
| | |
* | | Merge topic 'fix-ctest-launchers'Brad King2016-12-121-0/+1
|\ \ \ | |/ / |/| | | | | | | | | | | | | | db61cd5d cmRulePlaceholderExpander: Remove unused member RuleLauncher b7771078 Comment ExpandRuleVariables calls not preceded by launcher insertion c58a5198 Makefile: Restore RULE_LAUNCH_COMPILE generation on compilation rules
| * | Comment ExpandRuleVariables calls not preceded by launcher insertionBrad King2016-12-091-0/+1
| | | | | | | | | | | | | | | | | | | | | Call sites of `ExpandRuleVariables` are now responsible for inserting the `RULE_LAUNCH_{COMPILE,LINK,CUSTOM}` values in rule command lines. Audit all call sites and add a comment to each one that does not insert a launcher to explain why.
* | | Ninja,Makefile: Name static library compile PDB files as VS doesBrad King2016-11-301-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the default compile PDB file name for static libraries to match the Visual Studio default of using the logical target name. This may be incompatible with existing behavior but `COMPILE_PDB_NAME` documents that the default is unspecified. Projects depending on a particular name should set the property. Closes: #16438
* | | CUDA: Add support for the CUDA_SEPARABLE_COMPILATION target propertyRobert Maynard2016-11-141-3/+15
| | |
* | | Fix several include-what-you-use findingsDaniel Pfeifer2016-11-081-8/+11
| | |
* | | Add generator expression support to per-source COMPILE_FLAGSZsolt Parragi2016-10-281-2/+8
| | | | | | | | | | | | | | | | | | This allows users to specify different genex-based compile flags for each file in a target, e.g. compiling just a single file with `Od/Ox` in release builds on Visual Studio.
* | | Merge topic 'clang-tidy'Brad King2016-10-201-2/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | effa6c83 fix more issues reported by clang-tidy fb461cac silence selected clang-tidy violations
| * | | fix more issues reported by clang-tidyDaniel Pfeifer2016-10-201-2/+4
| |/ /
* | | 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-14/+14
|/ /
* | cmRulePlaceholderExpander: Port clients to direct-useStephen Kelly2016-10-151-9/+16
| | | | | | | | | | | | 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 strings instead of a Target in rule replacementStephen Kelly2016-10-151-2/+5
| | | | | | | | Don't rely on the cmGeneratorTarget type needlessly.