summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* Ninja: Fix depfile binding with spaces in pathBrad King2024-09-131-1/+1
| | | | | | | | | | | In build statements we use a single `DEP_FILE = ...` binding that is shared between `depfile = $DEP_FILE` and `command = ... $DEP_FILE ...` bindings in the corresponding rule. In cases that the command's shell argument needs quoting, add a separate `depfile = ...` binding to the build statement to express the depfile path without quoting. Otherwise `ninja` tries to open a file path that contains literal quotes. Fixes: #26287
* cmNinjaTargetGenerator: Factor out helper to add depfile bindingsBrad King2024-09-121-0/+3
|
* Merge topic 'ninja-always-make-object-dirs'Brad King2024-01-091-0/+1
|\ | | | | | | | | | | | | | | | | 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: add a method to compute the object directoryBen Boeckel2024-01-051-0/+1
| |
* | Swift/Ninja: Fix multifile module compile commandsEvan Wilde2024-01-031-0/+6
|/ | | | | | | | 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-1/+1
|\ | | | | | | | | | | | | 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-1/+1
| | | | | | | | See: https://discourse.cmake.org/t/how-to-control-the-location-of-the-c-20-binary-module-interface-bmi-output-directory/7968
* | Swift/Ninja: Split compilation modelEvan Wilde2023-12-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Ninja: Set TARGET_COMPILE_PDB correctly for compile_commands.jsonSebastian Theophil2023-10-181-0/+1
|/ | | | | | | Previously the Ninja target generator did not set the TARGET_COMPILE_PDB before writing a compiler command to `compile_commands.json`. Fixes: #25214
* Ninja: Allow compilation before generation of dependencies' private sourcesMartin Duffy2023-09-201-0/+2
| | | | | | | | | | 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-2/+0
| | | | | | 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-1/+11
|
* TargetGenerator: Factor out generation of code check rulesOrkun Tokdemir2023-05-161-2/+2
| | | | | | | | De-duplicate code check rule generation in Ninja and Makefile generators by moving their implementation to `cmCommonTargetGenerator`. Previously Ninja was generating code check rules per language. It was changed to generate code check rules for each source file.
* Ninja: track modmap dependencies properlyBen Boeckel2023-02-101-2/+13
| | | | Mark modmaps as outputs of the collation step.
* clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR propertyKyle Edwards2022-12-061-0/+5
| | | | Fixes: #21362
* cmGeneratorTarget: factor out fileset info and scanning detectionBen Boeckel2022-11-231-9/+0
|
* cmGeneratorTarget: factor out dyndep support detectionBen Boeckel2022-11-231-3/+0
|
* cxxmodules: add properties to control scanningBen Boeckel2022-11-181-1/+12
| | | | | | 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-0/+6
| | | | | This information is now needed in more than one place, so factor the logic out and use it to build a cache.
* Swift: Omit output-file-map when used as a linkerEvan Wilde2022-10-281-0/+3
| | | | | | | | | | | | | | | 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.
* cmGlobalNinjaGenerator: Add helper to compute absolute paths for build.ninjaBrad King2021-05-251-0/+5
|
* cmNinjaTargetGenerator: Reduce string copies in ConvertToNinjaPath wrapperBrad King2021-05-251-1/+1
| | | | | The global generator's method returns a reference to a cached value. Return that from the wrapper too.
* cmNinjaTargetGenerator: Rename source file path lookup method for clarityBrad King2021-05-251-1/+1
| | | | | | 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.
* Ninja Multi-Config: Split long command lines by configKyle Edwards2021-04-301-1/+2
| | | | Fixes: #22123
* ninja: Add experimental infrastructure for C++20 module dependency scanningBrad King2021-01-051-1/+3
| | | | | | | | | | | | | | | | | Optionally enable this infrastructure through an undocumented `CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP` variable. Currently this is experimental and intended for use by compiler writers to implement their scanning tools. Warn as such when the feature is activated. Later when compilers provide the needed scanning tools we can enable this variable from our corresponding compiler information modules. It is never meant to be set by project code. When enabled, generate a build graph similar to what we use for Fortran module dependencies. There are some differences needed because we can scan dependencies without explicit preprocessing, and can directly compile the original source afterward. Co-Author: Ben Boeckel <ben.boeckel@kitware.com>
* Ninja Generators: Homogenize configuration with MakefilesMarc Chevrier2020-12-011-2/+0
| | | | | * Use same configuration variables to configure dependencies * Abstract Ninja deps format from compiler one
* cmNinjaTargetGenerator: Clarify method namesBrad King2020-11-061-5/+5
|
* cmNinjaTargetGenerator: Consolidate redundant methodsBrad King2020-11-061-2/+1
|
* CUDA: Clang separable compilationRaul Tambre2020-09-241-1/+2
| | | | | | | | | | | | For NVCC the compiler takes care of device linking when passed the "-dlink" flag. Clang doesn't support such magic and requires the buildsystem to do the work that NVCC does behind the scenes. The implementation is based on Bazel's device linking documentation: https://github.com/tensorflow/tensorflow/blob/7cabcdf073abad8c46e9dda62bb8fa4682d2061e/third_party/nccl/build_defs.bzl.tpl#L259 Closes: #20726
* Modernize: Use #pragma once in all header filesKitware Robot2020-09-031-4/+1
| | | | | | | | | | | | | | | | #pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
* Merge topic 'fortran-preprocess-property'Brad King2020-05-221-0/+2
|\ | | | | | | | | | | | | | | | | | | 3888de23da Ninja: Skip Fortran preprocessing if Fortran_PREPROCESS is OFF 66c4e87282 Ninja: Add helper functions to generate Fortran build 5cca1ec893 Ninja: Add helper functions to generate Fortran preprocess rule b0a6161190 Fortran: Add Fortran_PREPROCESS property Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4659
| * Ninja: Skip Fortran preprocessing if Fortran_PREPROCESS is OFFPeter Hill2020-05-211-0/+2
| | | | | | | | | | | | | | | | | | If `Fortran_PREPROCESS` is explicitly turned off for a source file then we know it does not need to be preprocessed. Teach the Ninja generator to skip preprocessing in this case. Otherwise we still must preprocess just in case. Fixes: #18870
* | Refactoring: Third-parties public headers are under cm3p prefixMarc Chevrier2020-05-071-1/+1
|/ | | | Fixes: #20666
* Ninja Multi-Config: Fix bug with MacOS frameworksKyle Edwards2020-01-241-2/+6
|
* Refactor: Split Ninja files into impl-<Config>.ninja and build-<Config>.ninjaKyle Edwards2020-01-221-1/+1
|
* Ninja: Add multi-config variantKyle Edwards2019-12-131-23/+44
| | | | Co-Authored-by: vector-of-bool <vectorofbool@gmail.com>
* Refactor: Prepare Ninja generator for multi-configKyle Edwards2019-12-131-14/+23
|
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-6/+6
| | | | | Run the `clang-format.bash` script to update our C and C++ code to a new include order `.clang-format`. Use `clang-format` version 6.0.
* Ninja: Pass preprocessor definitions when compiling with Intel FortranBrad King2019-09-031-0/+1
| | | | | | | | The Intel Fortran compiler supports an extension that allows conditional compilation based on preprocessor definitions specified on the command line even when not preprocessing. Fixes: #19664
* IWYU: Fix handling of <memory> standard headerBrad King2019-07-101-1/+1
| | | | | | | | An old workaround for `std::allocator_traits<>::value_type` lints from IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`. Convert the workaround to use the same approach we already use for a workaround of `std::__decay_and_strip<>::::__type` lints. Then update the `<memory>` inclusions to follow the now-correct IWYU lints.
* Ninja: add support for Swift's output-file-map.jsonSaleem Abdulrasool2019-05-161-0/+7
| | | | | | | Add an emitter for the Swift's output-map-file.json to emit the requisite support files for Swift compilation. This additionally prevents the build rules for the object file emission as well to properly support the Swift build semantics.
* Ninja: Add support for ADDITIONAL_CLEAN_FILES target propertySebastian Holtermann2019-05-141-0/+2
|
* Ninja: In cmNinjaTargetGenerator use std::unique_ptr to manage new instancesSebastian Holtermann2019-05-131-1/+3
|
* Ninja,Makefile: use `unique_ptr` for memory managementSaleem Abdulrasool2019-04-181-2/+2
| | | | | Use a `unique_ptr` to manage the lifetime of the `MacOSXContentGenerator` and 'OSXBundleGenerator` rather than manually handling the lifetime.
* ninja: do not assume explicit preprocessing uses that outputBen Boeckel2019-02-251-0/+1
| | | | | | In Fortran, this is OK, but for C++, compiling preprocessed source generally results in poorer diagnostic messages and can also be ill-formed anyways.
* ninja: make dyndep generation language awareBen Boeckel2019-02-251-1/+2
| | | | | A target may have multiple languages with dyndep rules, separate `.dd` files should be generated.
* Replace occurrences of "Mac OS X" with "macOS" in commentsBartosz Kosiorek2018-09-101-1/+1
| | | | | | | | Apple's main Operating system changed their name from OS X to macOS: https://www.engadget.com/2016/06/13/os-x-is-now-macos/ Revise source comments accordingly.
* LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDSMarc Chevrier2018-06-271-1/+1
| | | | Fixes: #17997
* sourceFile properties: add property INCLUDE_DIRECTORIESMarc Chevrier2018-01-241-0/+3
|
* Use C++11 override instead of CM_OVERRIDEBrad King2017-09-151-5/+3
| | | | | | | | We now require C++11 support including `override`. Drop use of the old compatibility macro. Convert references as follows: git grep -l CM_OVERRIDE -- '*.h' '*.hxx' '*.cxx' | xargs sed -i 's/CM_OVERRIDE/override/g'