summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* cmGlobalNinjaGenerator: Detect GNU-like command-line for dyndep collatorBrad King2023-03-181-0/+4
| | | | | This will help the collator choose flags and path styles for modmap files.
* cmCommonTargetGenerator: classify linked target directories by languageBen Boeckel2023-02-011-1/+1
| | | | | | | | | | | | | | | | | | | These directories are used to direct collators for Fortran and C++ modules to consume dependent module information to properly collate. However, the consumption of these files merely checks for existence of the file, not whether they are actually needed anymore. The problem arises when a target has Fortran or C++ modules at point A, a build occurs populating this file, and then the target is updated to no longer have potential modules. The `DependInfo.make` (for `Makefiles`) or `<LANG>DependInfo.json` (for `Ninja`) files still exist as they are never guaranteed to be cleaned up. This can introduce stale information to the build which may cause a false-positive compilation if a module file happens to still exist and gets found this way. Instead, query the `linked-target-dirs` using the language in question and only add the directory if it contains potential sources for modules coming from the language in question.
* cxxmodules: support new round of Clang patchesBen Boeckel2022-12-151-3/+0
| | | | | | | | | | These patches now support the `-MF` output, so remove the `none` support added just for the old patchset which did not use it. Also update the flag name to `-fmodule-output=`. Due to the new Clang module mapper flag, use a new experimental support UUID as well.
* Merge topic 'clang-tidy-export-fixes-dir'Brad King2022-12-071-1/+48
|\ | | | | | | | | | | | | | | 232467eb1c clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7982
| * clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR propertyKyle Edwards2022-12-061-1/+48
| | | | | | | | Fixes: #21362
* | cmNinjaTargetGenerator: skip setting `depfile` for `none` scantypesBen Boeckel2022-12-021-0/+3
| | | | | | | | | | The `clang` mechanism does not support `depfile` discovered dependencies at the moment.
* | cmNinjaTargetGenerator: use `.clear()` to empty out some stringsBen Boeckel2022-12-021-2/+2
|/
* cmDyndepCollation: factor out writing C++ module info from NinjaBen Boeckel2022-11-301-214/+10
| | | | | | | | | To facilitate other generators being able to build C++20 modules, start pulling out collator logic into a generator-agnostic location. This commit starts by factoring out the information written to the "target depend info" object consumed during the build to handle writing out export and installation scripts expected during those steps.
* cmGeneratorTarget: factor out fileset info and scanning detectionBen Boeckel2022-11-231-86/+3
|
* cmGeneratorTarget: factor out dyndep support detectionBen Boeckel2022-11-231-19/+2
|
* cxxmodules: add properties to control scanningBen Boeckel2022-11-181-8/+48
| | | | | | The `CXX_SCAN_FOR_MODULES` property may be used to control scanning for targets and for source files rather than assuming "C++20 always needs to be scanned".
* cmNinjaTargetGenerator: factor out determining the fileset of a sourceBen Boeckel2022-11-171-47/+68
| | | | | This information is now needed in more than one place, so factor the logic out and use it to build a cache.
* Merge topic 'compile-commands-output-field'Brad King2022-11-011-1/+2
|\ | | | | | | | | | | | | | | 887a8874c3 EXPORT_COMPILE_COMMANDS: add `output` field Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !7844
| * EXPORT_COMPILE_COMMANDS: add `output` fieldBen Boeckel2022-10-281-1/+2
| | | | | | | | | | | | | | | | Also write for all configurations from multi-config generators. This field was added in the Clang 5 documentation and not present in the Clang 4 documentation (sometime between Dec 2016 and Mar 2017 according to `web.archive.org`).
* | Swift: Omit output-file-map when used as a linkerEvan Wilde2022-10-281-21/+33
|/ | | | | | | | | | | | | | | Swift is used as the linker for non-swift files because it needs to pull files like swiftrt.o in when swift symbols are present to ensure that the swift runtime is linked. The swift driver uses clang as the underlying linker, which pulls in crtbegin.o and friends when appropriate, so using Swift as a linker for C/C++ libraries is fine. The output-file-map was getting passed to all Swift invocations, regardless of whether or not we generated one. This patch changes it so that we only include the output-file-map in the Swift compiler invocation if we have actually generated the file.
* COMPILER_LAUNCHER: Add support for generator expressionsThomas Weißschuh2022-08-301-2/+4
| | | | Fixes: #23441
* Ninja Multi-Config: Deduplicate compile_commands.json for cross configsKyle Edwards2022-07-151-3/+5
| | | | | | | | compile_commands.json was being written for every permutation of cross configurations. Deduplicate so only one command is output for each configuration. Fixes: #23733
* cmNinjaTargetGenerator: write out BMI install information for the collatorBen Boeckel2022-07-061-0/+38
|
* cmNinjaTargetGenerator: write out export information for the collatorBen Boeckel2022-07-061-0/+79
| | | | | The collator will use this to know where the target's export information needs to go so that module properties may be provided.
* cmNinjaTargetGenerator: write out fileset information for the collatorBen Boeckel2022-07-061-0/+99
| | | | | The collator will use this to generate property settings for the imported targets in the build and install export sets.
* cmTarget: add support for C++ module fileset typesBen Boeckel2022-06-161-47/+45
| | | | | | | | | | | | | | | C++ modules have two variants which are of importance to CMake: - `CXX_MODULES`: interface modules (those using `export module M;`, `export module M:part;`, or `module M:internal_part;`) - `CXX_MODULE_HEADER_UNITS`: importable header units Creating C++ modules or partitions are *not* supported in any other source listing. This is because the source files must be installed (so their scope matters), but not part of usage requirements (what it means for a module source to be injected into a consumer is not clear at this moment). Due to the way `FILE_SET` works with scopes, they are a perfect fit as long as `INTERFACE` is not allowed (which it is not).
* cmNinjaTargetGenerator: expand CFGIntDir for NMCBen Boeckel2022-06-141-2/+3
|
* cmNinjaTargetGenerator: support msvc-style deps discovery for scanningBen Boeckel2022-04-271-10/+21
|
* cmNinjaTargetGenerator: add flags for scanning based on the fileset typeBen Boeckel2022-04-271-0/+52
|
* CUDA: Ninja generator generates valid compile databaseRobert Maynard2022-03-301-15/+19
| | | | | | | The ninja generator has been updated to poperly write the compile database when the CUDA language has been enabled. Fixes #23368
* Ninja: Avoid preprocessing twice with explicit Fortran_PREPROCESSPeter Hill2022-02-241-1/+2
| | | | | | Fix spurious warnings from gfortran+Ninja for preprocessing. Fixes: #23248
* cmLocalGenerator: Remove unused IncludePathStyle infrastructureBrad King2021-12-011-8/+3
| | | | | | It is unused since commit c564a3e3ff (Ninja: Always compile sources using absolute paths, 2021-05-19, v3.21.0-rc1~129^2), which left behind a FIXME comment to eventually remove it.
* Merge topic 'ninja-pdb-dir'Brad King2021-11-041-1/+1
|\ | | | | | | | | | | | | | | 73b84db62d Ninja: Fix creation of Windows import library directory bd36735f65 cmNinjaTargetGenerator: Replace "their" with "there" in comment Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6694
| * cmNinjaTargetGenerator: Replace "their" with "there" in commentBrad King2021-11-031-1/+1
| |
* | CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATIONRobert Maynard2021-10-201-14/+20
|/ | | | | | The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION` now aren't mutually exclusive and can now be used together on the same target.
* Rename cmProp in cmValueMarc Chevrier2021-09-211-27/+27
|
* Merge topic 'iwyu-cl'Brad King2021-09-141-2/+20
|\ | | | | | | | | | | | | | | ccfe1b0b40 IWYU: Add `--driver-mode=cl` when applicable Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6511
| * IWYU: Add `--driver-mode=cl` when applicablePigeonF2021-09-101-2/+20
| | | | | | | | | | | | We already do this for `clang-tidy`. Fixes: #16554
* | cmNinjaTargetGenerator: Use short path for cmcldeps.exeWayde Reitsma2021-09-031-2/+5
|/
* Refactor: reduce cmToCStr usageMarc Chevrier2021-08-191-4/+2
|
* cmNinjaTargetGenerator: Fix scan rule PREPROCESSED_SOURCE placeholderBrad King2021-06-141-6/+12
| | | | | | | | | When running the module dependencies scan tool for for a language that does not compile the preprocessed output, we do not actually put the preprocessed output in the build graph. However, the value of `CMAKE_EXPERIMENTAL_<LANG>_SCANDEP_SOURCE` may reference the placeholder for the preprocessed source. Populate the placeholder to keep the file out of the way. In particular, do not clobber the `.ddi` file.
* cmNinjaTargetGenerator: Clarify GetScanBuildStatement conditionBrad King2021-06-141-1/+1
| | | | | Use the `compilePP` variable directly rather than relying on callers to make `compilePP == !ppFileName.empty()`.
* cmNinjaTargetGenerator: Simplify scan rule response file selectionBrad King2021-06-141-5/+1
| | | | | | Since commit 33a8e0bb09 (cmNinjaTargetGenerator: Simplify scan rule depfile selection, 2020-11-06, v3.20.0-rc1~516^2~1), the `$out` of the scan rule always matches our `.rsp` file selection, so use `$out.rsp`.
* HIP: Add language to CMakeRobert Maynard2021-06-071-1/+2
|
* Ninja: Always compile sources using absolute pathsBrad King2021-05-251-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Ninja generator traditionally referenced source files and include directories using paths relative to the build directory if they could be expressed without a `../` sequence that leaves the build and source directories. For example, when using a `build/` directory inside the source tree, sources would be compiled as `-c ../src.c` and include directories would be referenced as `-I ../include`. This approach matches the traditional Ninja convention of using relative paths whenever possible, but has undesirable side effects such as: * Compiler diagnostic messages may not use absolute paths, making it harder for IDEs/editors to find the referenced sources or headers. * Debug symbols may not use absolute paths, making it harder for debuggers to find the referenced sources or headers. * Different results depending on the path to the build tree relative to the source tree. * Inconsistent with the Makefile generators, which use absolute paths. Switch to always using absolute paths to reference source files and include directories on compiler command lines. While alternative solutions for diagnostic messages and debug symbols may exist with specific tooling, this is the simplest and most consistent approach. Note that a previous attempt to do this in commit 955c2a630a (Ninja: Use full path for all source files, 2016-08-05, v3.7.0-rc1~275^2) was reverted by commit 666ad1df2d (Revert "Ninja: Use full path for all source files", 2017-02-24, v3.8.0-rc2~9^2) due to problems hooking up depfile dependencies on generated files. This time, the changes in commit 2725ecff38 (Ninja: Handle depfiles with absolute paths to generated files, 2021-05-19) should avoid those problems. Fixes: #13894, #17450
* cmNinjaTargetGenerator: Rename source file path lookup method for clarityBrad King2021-05-251-4/+5
| | | | | | The `GetSourceFilePath` method is meant only for compiled sources, and automatically handles converting it to a path for the Ninja build manifest. Rename the method to clarify both.
* cmNinjaTargetGenerator: Remove GetSourceFilePath call with different semanticsBrad King2021-05-251-1/+1
| | | | | Reference external object files using `ConvertToNinjaPath` directly. `GetSourceFilePath` is meant to reference source files to be compiled.
* cmNinjaTargetGenerator: Rename local variable for clarityBrad King2021-05-251-5/+5
|
* Ninja/Swift: Remove redundant calls to ConvertToNinjaPathBrad King2021-05-251-2/+1
| | | | `GetSourceFilePath` already handles converting to a Ninja path.
* cmScanDepFormat: Drop unused "outputs", "inputs", and "depends" fieldsBrad King2021-05-131-1/+1
| | | | | | | These fields are specified by our `P1689r3` paper, but are not actually needed. The dependencies of the scanning results themselves can be captured via normal depfile logic. Avoid saving this possibly-large information in the scanning results. It is not needed by later steps.
* Source: Remove unnecessary comparisons to nullptrVitaly Stakhovsky2021-05-101-1/+1
|
* Merge topic 'ninja-multi-long-command-line-config'Brad King2021-05-031-10/+15
|\ | | | | | | | | | | | | ad08f93ee4 Ninja Multi-Config: Split long command lines by config Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6067
| * Ninja Multi-Config: Split long command lines by configKyle Edwards2021-04-301-10/+15
| | | | | | | | Fixes: #22123
* | cmLocalGenerator: Clarify GetIncludeFlags signatureBrad King2021-02-251-6/+8
|/ | | | | | | | | | | | | Make the `config` argument non-optional so all callers must be explicit. Convert the path style argument to an enumeration to make its role clear at call sites. The path style argument is implemented by `ConvertToIncludeReference`, which was introduced with the Ninja generator by commit 5b114c9bee (Introduce a cmLocalGenerator::ConvertToIncludeReference function, 2011-09-07, v2.8.7~187^2~4). Its only purpose is to allow the Ninja generator to use relative paths in `-I` flags. Add a comment explaining this role.
* Merge topic 'cpp-modules'Brad King2021-01-071-25/+108
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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