summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Swift: Ninja: Pass module name to all swift buildsEvan Wilde2024-02-231-4/+2
| | | | | | | | Executables that don't export a public API should not emit a swiftmodule, but the swift modulename is observable from within the program, so we should still set the module name on executable builds. Fixes: #25710
* Merge topic 'cxxmodules-collation-restat' into release-3.29Brad King2024-02-161-0/+5
|\ | | | | | | | | | | | | | | | | a7424b636b Ninja: make the collator rule use `restat = 1` e24eecfc33 Tests/CXXModules: add a test to ensure that `restat` works for collation Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9259
| * Ninja: make the collator rule use `restat = 1`Ben Boeckel2024-02-151-0/+5
| | | | | | | | This avoids rebuilds when the module metadata does not change.
* | Merge topic 'cxxmodules-visibility-change-rebuild' into release-3.29Brad King2024-02-161-3/+7
|\ \ | |/ | | | | | | | | | | | | | | | | 60a8736378 cmNinjaTargetGenerator: scanning depends on the module metadata 52036ce090 Tests/CXXModules: test that objects depend on dependent modules json files 9a45c9fbd5 cmNinjaTargetGenerator: use `emplace_back` for scanning deps Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9247
| * cmNinjaTargetGenerator: scanning depends on the module metadataBen Boeckel2024-02-151-0/+2
| | | | | | | | Fixes: #25531
| * cmNinjaTargetGenerator: use `emplace_back` for scanning depsBen Boeckel2024-02-151-3/+5
| |
* | Merge topic 'cxxmodules-depend-on-modmap-file' into release-3.29Brad King2024-02-161-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | 363300ace5 cxxmodules: depend on the modmap contents 940628d48d Tests/CXXModules: test that objects depend on their modmap files 681ee92030 Tests/CXXModules: support testing rebuild conditions Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9248
| * cxxmodules: depend on the modmap contentsBen Boeckel2024-02-151-1/+1
| | | | | | | | | | | | | | If the modmap changes, we need to recompile. It is not just a file that needs to exist to compile. Fixes: #25511
* | Merge topic 'ewilde/swift-escapism'Brad King2024-01-161-2/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | 9950a69f26 Swift/Ninja: Fix compile commands output file path Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9150
| * | Swift/Ninja: Fix compile commands output file pathEvan Wilde2024-01-121-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | The exported compile commands did not use the proper file path separator for Windows in the output field for Swift files. This patch adds the appropriate filepath fix-ups to the output-field. Fixes: #25580
* | | Merge topic 'swift-sources-in-resp-file'Brad King2024-01-121-2/+8
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | b767917ebb Swift/Ninja: Include sources in response file Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9143
| * | Swift/Ninja: Include sources in response fileEvan Wilde2024-01-111-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Unlike C/C++, Swift compiles all sources in a module at once. This can quickly overwhelm the commandline length limit on Windows, so it is useful to place the source files in the response file. Issue: #25572
* | | Swift: preserve `-static` for static library swiftmodulesSaleem Abdulrasool2024-01-091-8/+12
|/ / | | | | | | | | | | | | The `-static` is important for the emission of the module as it is serialized into the swiftmodule which then is used by the Swift frontend to decide how to link to the symbol (via the GOT or not, or the IAT on Windows). This repairs building static libraries with Swift on Windows.
* | Merge topic 'ewilde/swift-ninja-response-files'Brad King2024-01-091-1/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | a6a5c43300 Swift/Ninja: Add support for response files Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9098
| * | Swift/Ninja: Add support for response filesEvan Wilde2024-01-081-1/+3
| | | | | | | | | | | | | | | | | | | | | Adding support for `CMAKE_NINJA_FORCE_RESPONSE_FILE` with Swift. Issue: #25490 Fixes: #25563
* | | Merge topic 'ninja-always-make-object-dirs'Brad King2024-01-091-20/+31
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | de3dc16b64 cmNinjaTargetGenerator: use `.` for the needed phony order-only dependency 1aa28f3b92 cmNinjaTargetGenerator: ensure that the object output directory exists 4a9613ff9b cmNinjaTargetGenerator: add a method to compute the object directory Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9105
| * | cmNinjaTargetGenerator: use `.` for the needed phony order-only dependencyBen Boeckel2024-01-061-6/+10
| | | | | | | | | | | | It is only required for Ninja < 1.7 though.
| * | cmNinjaTargetGenerator: ensure that the object output directory existsBen Boeckel2024-01-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a target has no object compilations within it, nothing ensures that the directory exists yet it is still mentioned as an order-only dependency within the build files. While `ninja` is OK with this, `samu`, an alternate `ninja` implementation, is not. Make sure the directory always exists for consistency. Fixes: #25526
| * | cmNinjaTargetGenerator: add a method to compute the object directoryBen Boeckel2024-01-051-15/+13
| | |
* | | Merge topic 'swift-always-restat'Brad King2024-01-051-0/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | 1161ad76ac Swift/Ninja: Always restat swift build commands Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9076
| * | | Swift/Ninja: Always restat swift build commandsJeremy Day2024-01-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The swift toolchain leaves output files untouched if there are no meaningful input changes; without restat, this causes ninja to needlessly rebuild targets that are not actually out-of-date Fixes: #25496
* | | | Swift/Ninja: Fix multifile module compile commandsEvan Wilde2024-01-031-20/+78
| |/ / |/| | | | | | | | | | | | | | | | | | | | Swift compile commands need to have all source files in the module specified in the compile command or LSP systems will report errors on missing types that are defined in other source files in the same module. Issue: #25491
* | | Merge branch 'cxxmodules-no-compile-commands-modmap-release' into ↵Ben Boeckel2023-12-281-11/+11
|\ \ \ | | |/ | |/| | | | | | | | | | | | | cxxmodules-no-compile-commands-modmap * cxxmodules-no-compile-commands-modmap-release: cmNinjaTargetGenerator: use scan flag for modmap usage in exported commands
| * | cmNinjaTargetGenerator: use scan flag for modmap usage in exported commandsBen Boeckel2023-12-221-9/+9
| | | | | | | | | | | | See: https://discourse.cmake.org/t/how-to-control-the-location-of-the-c-20-binary-module-interface-bmi-output-directory/7968
* | | Swift/Ninja: Fix missing OFM in CMP0157 OLD behaviorEvan Wilde2023-12-191-1/+2
| |/ |/| | | | | | | | | | | | | The CMP0157 old behavior omitted the output-file-map after the Swift build split because we stopped calling `EmitSwiftDependencyInfo` when we could not split the build because we didn't call `WriteObjectBuildStatement`. If we can't split the build, then we still need to include the OFM information to not break incremental builds.
* | Merge topic 'swift-split-compilation-model'Brad King2023-12-161-7/+231
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 9bed4f4d81 Swift/Ninja: Split compilation model 64b3367845 cmGlobalGenerator: Allow passing language to GetLangaugeOutputExtension Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8907
| * | Swift/Ninja: Split compilation modelEvan Wilde2023-12-151-7/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Splitting the Swift build into an object build and a separate link step, instead of building and linking in one step. The immediate benefit is LSP support because we are able to emit compile-commands for Swift files now. Additionally, it is possible to specify flags to the compile step, enabling folks to emit C and C++ headers from their Swift builds for C/C++ interop, without needing custom commands. Eventually, this gives us a path toward working object libraries. Object Libraries: - Object libraries don't work today because CMake doesn't emit targets for object libraries into the Ninja build file. - tl;dr: Object libraries work if they aren't WMO. Still need work to make WMO'd object libraries work. Object libraries still don't completely work with this patch because, while we emit the targets, the `TARGET_OBJECTS` generator expression expansion has a separate mechanism for determining what the names of the objects are based on the input source files, so targets that depend on an object library built with a whole-module optimization will depend on objects based on the name of the source file instead of the actual emitted object file. These features require being able to accurately model wholemodule builds though, because we actually need to track object files and WMO affects what objects are emitted. For that, we require CMP0157 use the NEW policy. When it's OLD, we have to fall back on the old behavior and cannot provide object libraries or the compile-commands for LSP. Issue: #25308
* | | Merge topic 'cxxmodules-pch'Brad King2023-12-051-8/+7
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | 40dc13b242 cmNinjaTargetGenerator: PCH files do not need dyndep f61c64cd1c cmLocalGenerator: prevent scanning of PCH source files ea8c37b759 Tests/CXXModules: add a test which scans a PCH-using source Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9032
| * cmNinjaTargetGenerator: PCH files do not need dyndepBen Boeckel2023-12-041-8/+7
| | | | | | | | Fixes: #24209
* | Merge topic 'fortran-objects-as-sources-fix'Brad King2023-11-271-5/+25
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | beb1393f8f Merge branch 'revert-exact-collation-depends-3.27' into fortran-objects-as-sources-fix a033dce326 Makefiles: provide, but do not consume, "forward linked" target dirs 7cd0adab1b cmCommonTargetGenerator: use modules from linked object-referenced targets 1175f1c874 LinkItem: track `cmSourceFile` instances for external objects d2fa56772f Ninja: support "forwarding" modules from other targets ec1e589bec Ninja: Revert exact collation dependencies for 3.27 06df59b930 cmCommonTargetGenerator: return forward linked target dirs too f8729ab366 cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules ... Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8989
| * Ninja: support "forwarding" modules from other targetsBen Boeckel2023-11-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | When a target uses objects from another target which provides modules as sources, the modules provided by the referenced target must also be treated as if they were provided by the referencing target. Add the concept of "forwarding" modules so that consumers can use modules created by these sources as well. Note that this is only sensible for Fortran where module usages are implicit as far as CMake's visibility model is concerned. C++ modules have their own concept of visibility which does not require or support such `$<TARGET_OBJECTS>` reuse in this way.
| * cmCommonTargetGenerator: return forward linked target dirs tooBen Boeckel2023-11-211-5/+7
| | | | | | | | | | This will be used for module forwarding in order to support `$<TARGET_OBJECTS>` usage in source and link libraries calls.
| * cmNinjaTargetGenerator: handle object-referencing Fortran modulesBen Boeckel2023-11-211-0/+9
| | | | | | | | | | | | Targets only using Fortran modules via `$<TARGET_OBJECTS>` also need a collation step to be performed. Check for this case and trigger the collation rule to be added and used.
* | Merge topic 'cxxmodules-ninja-forced-rsp-files'Brad King2023-10-301-2/+1
|\ \ | |/ | | | | | | | | | | | | 09c962a6a4 Tests/CXXModules: test forced rsp files with ninja Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8926
| * Tests/CXXModules: test forced rsp files with ninjaBen Boeckel2023-10-281-2/+1
| | | | | | | | Fixes: #25367
* | Merge topic 'ninja-better-order-depends'Brad King2023-10-231-4/+12
|\ \ | |/ | | | | | | | | | | | | | | | | | | ed45432571 cmNinjaTargetGenerator: do not order-depend on C++ module sources 0973cd6702 cmNinjaTargetGenerator: use the file set visibility API 4625170925 cmFileSet: add a query for includeable file set types 51f9d9f0a2 cmNinjaTargetGenerator: avoid traversing old outputs repeatedly Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8902
| * cmNinjaTargetGenerator: do not order-depend on C++ module sourcesBen Boeckel2023-10-201-4/+9
| | | | | | | | | | | | | | | | | | C++ module sources should not be included by any other TUs, so their presence cannot matter for order-only dependencies of the entire target. Exclude them. Update CMP0154 to take this into consideration and add tests to the `CXXModules` suite (which already deals with module support detection).
| * cmNinjaTargetGenerator: use the file set visibility APIBen Boeckel2023-10-201-1/+1
| |
| * cmNinjaTargetGenerator: avoid traversing old outputs repeatedlyBen Boeckel2023-10-201-0/+3
| | | | | | | | | | We actually only need to look at outputs just added to the vector, not all outputs that have been detected so far.
* | Ninja: Set TARGET_COMPILE_PDB correctly for compile_commands.jsonSebastian Theophil2023-10-181-6/+11
|/ | | | | | | Previously the Ninja target generator did not set the TARGET_COMPILE_PDB before writing a compiler command to `compile_commands.json`. Fixes: #25214
* Ninja: message about not compiled sources explicitlyBen Boeckel2023-10-021-0/+24
| | | | | | With CMP0155, filesets with only non-compiled sources do not go through the collation path that detects it. Detect it explicitly like the Visual Studio generator does.
* CXXModules: remove `EXPERIMENTAL` from C++ module variable namesBen Boeckel2023-10-021-10/+10
|
* Ninja: Allow compilation before generation of dependencies' private sourcesMartin Duffy2023-09-201-13/+81
| | | | | | | | | | This requires knowing when a generated header is public, which we can model using file sets. Add policy CMP0154 to treat generated sources as private by default in targets with file sets. Generated public headers can be specified in public file sets. Fixes: #24959 Issue: #15555
* cmNinjaTargetGenerator: Reduce lifetime of custom command listBrad King2023-09-121-7/+8
| | | | | | Since commit 2583eff6fe (ninja: Factor out custom command order-only depends, 2014-03-10, v3.1.0-rc1~559^2) we can store the list of custom commands in a local variable rather than a member.
* Ninja: generate scanning and build rules for C++20 module synthetic targetsBen Boeckel2023-08-171-8/+214
|
* Merge topic 'windows-tidy-cmstrcat'Brad King2023-08-011-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | d58253d155 clang-tidy: fix `performance-faster-string-find` lints a19ec77200 clang-tidy: fix `readability-static-accessed-through-instance` lints 3d03629f20 cmWIXRichTextFormatWriter: remove identity cast 1df29567ac clang-tidy: fix `modernize-use-equals-default` lints 32fe862b8c clang-tidy: fix `readability-container-size-empty` lints 7eaab9a957 clang-tidy: fix `modernize-raw-string-literal` lints ffa49c23aa clang-tidy: fix `readability-else-after-return` lints 4489e9a85c clang-tidy: fix `modernize-use-auto` lints ... Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8668
| * strings: use `emplace_back` with `cmStrCat` argumentsBen Boeckel2023-07-281-1/+2
| |
* | IWYU: Update for Debian 12 CI jobBrad King2023-07-281-1/+0
|/ | | | | | `include-what-you-use` diagnostics, in practice, are specific to the environment's compiler and standard library. Update includes to satisfy IWYU for our CI job under Debian 12.
* Ninja: include module mapper flags in `compile_commands.json`Ben Boeckel2023-07-091-3/+25
| | | | Fixes: #24618
* cxxmodules: remove support for `CXX_MODULE_HEADER_UNITS` filesetsBen Boeckel2023-05-311-3/+1
| | | | | There's no backing implementation for header units anyways, so just remove it for now.