summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.h
Commit message (Collapse)AuthorAgeFilesLines
* Swift/Ninja: Split compilation modelEvan Wilde2023-12-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Swift: Add abstraction for compilation modeEvan Wilde2023-11-171-0/+13
| | | | | | | | | | | Add a `CMAKE_Swift_COMPILATION_MODE` variable and corresponding `Swift_COMPILATION_MODE` target property to control the compilation mode. Select among `wholemodule`, `singlefile`, and `incremental`. Add policy CMP0157 to remove the default `-wmo` flags in favor of the abstract setting. Issue: #25366
* Add options to specify linker toolMarc Chevrier2023-10-131-0/+3
| | | | | | | | | | | | | | | | | | Offer the capability, through variable `CMAKE_LINKER_TYPE`, as well as the target property `LINKER_TYPE` to specify which linker must be used. The implementation of this capability is specified by variables specific to the language and linker type: `CMAKE_<LANG>_USING_LINKER_<TYPE>`. Some definitions are provided as part of `CMake`. For example, to select the `LLVM` linker rather than the standard one, the type `LLD` should be specified through the variable `CMAKE_LINKER_TYPE`. And, on `Apple`, `Linux` and some environments on `Windows`, the variable `CMAKE_<LANG>_USING_LINKER_LLD` has value `-fuse-ld=lld`. And for `Windows` environments based on `MSVC`, where the linker is used directly, the tool `lld-link.exe` will be used rather than `link.exe`. Fixes: #19174, #24254, #24990
* PCH: Add missing dependency of REUSE_FROM shared compiler PDBRussell Greene2023-09-111-1/+3
| | | | | | | Have the `copy_pdb_idb` script depend on the PCH file so that the shared compiler PDB is updated when the PCH is rebuilt. Fixes: #25240
* cmLocalGenerator: always support shortening filenamesBen Boeckel2023-08-081-6/+0
|
* IWYU: Update for Debian 12 CI jobBrad King2023-07-281-2/+2
| | | | | | `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.
* macOS: Add support for linking against .xcframework foldersKyle Edwards2023-07-261-0/+3
| | | | Issue: #21752
* CreateRulePlaceholderExpander(): enhance memory managementMarc Chevrier2023-05-041-1/+2
| | | | This method returns now a std::unique_ptr instance rather than a raw pointer.
* Link step: use linker dependency linker fileMarc Chevrier2023-05-031-0/+6
| | | | | | Based on work done by @ben.boeckel (!8051) Fixes: #22217
* cmLocalGenerator::MayBeRelativeToWorkDir: take care of all casesMarc Chevrier2023-05-021-1/+1
|
* RULE_LAUNCH_*: Add support for generator expressionsKyle Edwards2023-02-031-1/+3
|
* cmLocalGenerator: Inline AddCompilerRequirementFlag in only call siteBrad King2022-11-181-4/+0
| | | | | | The call site in `AddLanguageFlags` is now the "one true place" for adding language standard flags. Inline the helper to reduce risk of adding other call sites later.
* cmLocalGenerator: Factor out helper to compute MSVC_DEBUG_INFORMATION_FORMATBrad King2022-10-311-0/+4
|
* CUDA: Add Device LTO support for nvccRobert Maynard2022-07-221-2/+11
| | | | Fixes #22200
* cmLocalGenerator: Adopt AppendModuleDefinitionFlag methodBrad King2022-05-311-0/+4
| | | | Migrate from `cmCommonTargetGenerator::AddModuleDefinitionFlag`.
* xcode: add support for xcconfig filesGregor Jasny2022-04-031-0/+1
| | | | Fixes: #18420
* color: Introduce CMAKE_COLOR_DIAGNOSTICS variableSemyon Kolton2022-03-081-0/+1
| | | | | | | Add a variable to control both makefile color messages and compiler color diagnostics. Fixes: #15502
* CMP0028: Report the target whose link interface has an offending itemBrad King2021-12-161-0/+5
| | | | | | | | | | | | Previously items linked via the link interface of a dependency were reported in CMP0028 messages as if directly linked by a target. Clarify the messages to indicate that an offending item is actually in the link interface of a given target, regardless of its consumer. Move the check to the end of generation and look through the final set of link implementations and link interfaces that were used for generation. This avoids repeating messages on link interfaces that have multiple consumers.
* cmCustomCommand: Track main dependency explicitlyNAKAMURA Takumi2021-12-141-3/+1
| | | | | | | Store the main dependency as the first entry in the dependency list plus a boolean member indicating its existence. Note that this slightly changes existing behavior: the main dependency was previously the last entry of the dependency list.
* cmLocalGenerator: Remove unused IncludePathStyle infrastructureBrad King2021-12-011-16/+9
| | | | | | 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.
* cmLocalGenerator: Simplify Add{Custom,Utility}CommandNAKAMURA Takumi2021-11-181-38/+9
|
* cmMakefile: Simplify detail:::Add{Custom,Utility}CommandNAKAMURA Takumi2021-11-181-34/+11
| | | | | | | | | Note 1: `detail::AddCustomCommandToTarget()` resets cc, since cc is not moved away. Note 2: In `detail::AddUtilityCommand()`, a few vars are preserved before using. Their refs will be alive in most cases, but cc might be destroyed in the future.
* Unity Build: Fix per-config sources in multi-config generatorsBrad King2021-11-111-2/+10
| | | | | | | | | | | | | | | Single-config generators already support unity builds with per-config sources because they compute sources using `CMAKE_BUILD_TYPE` as the configuration. Each original source is either included in the unity build source, or not. Teach multi-config generators to compute the list of sources for inclusion in unity builds using all configurations. Previously they only used the empty string as the configuration. Each original source may be included in some configurations, but not others. Use preprocessor conditions to guard their inclusion when necessary. Fixes: #22892
* cmLocalGenerator: Add dedicated types to hold unity source infoBrad King2021-11-111-8/+28
|
* cmLocalGenerator: Clarify name of method to write unity source include linesBrad King2021-11-101-5/+4
|
* cmLocalGenerator: De-duplicate unity source file generationBrad King2021-11-101-0/+8
|
* CUDA: Avoid unnecessary allocation and GetLinkLanguage()Raul Tambre2021-11-071-1/+1
| | | | | There's no reason to allocate the cmNinjaLinkLineDeviceComputer on the heap. We can also assume the link language as CUDA in cmLocalGenerator::GetDeviceLinkFlags().
* Rename cmProp in cmValueMarc Chevrier2021-09-211-10/+10
|
* Refactor: reduce cmToCStr usageMarc Chevrier2021-08-191-1/+1
|
* Merge topic 'LWYU-externalization'Brad King2021-07-121-0/+2
|\ | | | | | | | | | | | | | | | | 14e57e9637 LINK_WHAT_YOU_USE feature: externalize configuration 9c5132a586 PGI: Fix "LINKER:" prefix generated separator 8a93de080c cmGeneratorTarget: Add method for LINKER: prefix translation Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6306
| * LINK_WHAT_YOU_USE feature: externalize configurationMarc Chevrier2021-07-091-0/+2
| | | | | | | | | | | | | | | | Currently, this feature is only supported on ELF platforms. So, the property LINK_WHAT_YOU_USE will be ignored for other plateforms. Moreover, flags and commands are now controled by CMake variables. Fixes: #20174
* | Do not exclude include directory symlinks to entries of CPATHAlexander Grund2021-07-071-1/+1
|/ | | | | | | | | | | Extend the fix from commit 2d0b0e2b9d (Do not exclude include directories made implicit by CPATH, 2019-05-29, v3.14.5~2^2) to cover include directories that are symlinks to paths listed in `CPATH`. Compare resolved paths against resolved entries of `CPATH`. Resolve the entries as late as possible in case symlinks change. Fixes: #22383
* cmOutputConverter: Adopt relative path conversion helpersBrad King2021-05-171-13/+0
| | | | Move them up from cmLocalGenerator and out of cmStateDirectory.
* cmLocalGenerator: De-duplicate StateSnapshot memberBrad King2021-05-171-1/+0
| | | | We have the member from the cmOutputConverter parent.
* cmLocalGenerator: Remove unused MaybeRelativeToCurSrcDir methodBrad King2021-05-171-1/+0
| | | | | | | With the recent update to `GetObjectFileNameWithoutTarget`, we no longer have any call sites for `MaybeRelativeToCurSrcDir`. It does not make sense for the generator to produce paths relative to the source tree in general, so remove the method.
* cmLocalGenerator: Factor out relative path conversion helpersBrad King2021-05-131-4/+8
| | | | | | Most calls to `MaybeConvertToRelativePath` use one of our common work directories (e.g. top of the build tree) as the local path. Add helpers for each of the common cases to simplify and clarify call sites.
* cmLocalGenerator: Clarify GetIncludeFlags signatureBrad King2021-02-251-11/+19
| | | | | | | | | | | | | 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.
* cmCustomCommand: Record value of CMP0116 at time of creationKyle Edwards2021-02-231-10/+16
|
* Merge topic 'xcode12-ios_install_combined'Brad King2021-02-091-0/+2
|\ | | | | | | | | | | | | 0110aa018d IOS_INSTALL_COMBINED: Support Xcode 12 (command line only) Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5785
| * IOS_INSTALL_COMBINED: Support Xcode 12 (command line only)Craig Scott2021-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Xcode 12 doesn't allow nested builds within the same build directory. That means we can no longer do an install by building the install target when IOS_INSTALL_COMBINED is true. We can, however, still do an install by running the cmake_install.cmake script or executing cmake --install, since there is no outer build and therefore the associated SDK can be built as a sub-build. The non-build methods previously didn't work when IOS_INSTALL_COMBINED was true because the generated install script and the CMakeIOSInstallCombined script both made certain assumptions that relied on being part of a build. Those assumptions are now removed. A side-effect of this work is that cpack now also works from the command line when IOS_INSTALL_COMBINED is true. Relates: #21282 Fixes: #20023
* | clang-tidy: fix `readability-make-member-function-const` warningsBen Boeckel2021-01-271-1/+1
| |
* | Unity: Generate reproducible unity IDs for anonymous namespacesCraig Scott2021-01-221-0/+14
| | | | | | Fixes: #21564
* | Ninja Multi-Config: Add support for cross-config custom commandsKyle Edwards2020-12-151-1/+3
| | | | | | | | Co-Author: Brad King <brad.king@kitware.com>
* | cmLocalGenerator: Adopt custom target 'force' output name generationBrad King2020-12-151-1/+3
| |
* | cmLocalGenerator: Refactor custom command generator constructionBrad King2020-12-151-0/+4
| | | | | | | | | | | | | | Add support for constructing and using multiple generators for one custom command. cmGeneratorTarget contains a code path that needs this behavior when used with Ninja but not other generators, so use virtual dispatch through cmLocalGenerator.
* | cmMakefile: Simplify custom target 'force' output name generationBrad King2020-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unnecessary check of policy CMP0049. The policy can never trigger on our internally-generated name because it has no variable references. The rename in commit 0ed5ce4cd8 (cmTarget: Rename AddSource method for backward compatibility., 2014-03-17, v3.1.0-rc1~688^2~17) made it look like this code path depended on CMP0049. Then commit 0e1faa28cb (cmMakefile: Separate custom command setup from actual creation, 2019-09-14, v3.16.0-rc1~85^2) and commit ea1bed34b2 (cmMakefile: Extract utilities used for creation of custom commands, 2019-09-21, v3.16.0-rc1~52^2~1) built additional infrastructure to thread that dependence through the call stack. Remove it all.
* | cmLocalGenerator: Evaluate generator expressions in custom command outputsBrad King2020-12-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | Custom commands with generator expressions in their OUTPUTs or BYPRODUCTS are still attached to a single `.rule` file. We use an internal map to look up the source file holding the custom command for a given output. Populate this map using the outputs and byproducts from all configurations after evaluating the generator expressions for each configuration. Issue: #12877
* | cmLocalGenerator: Simplify custom command output cmSourceFile creationBrad King2020-12-101-4/+10
| | | | | | | | | | Move calls to `CreateGeneratedSource` over to `UpdateOutputToSourceMap`, which is called for all generated outputs and byproducts.
* | cmLocalGenerator: Factor out helper to expand custom command output pathsBrad King2020-12-101-0/+4
| |
* | cmLocalGenerator: Refactor UpdateOutputToSourceMap to avoid boolean trapBrad King2020-12-101-3/+9
| |