1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-21 20:11:22 +08:00

509 Commits

Author SHA1 Message Date
Brad King
cc118ddd70 cmGlobalNinjaGenerator: Remove unused member
The `DisableCleandead` member was added by commit c5011399c5 (Ninja:
Avoid cleandead with dyndep bindings for Fortran module dependencies,
2020-11-10, v3.19.0~15^2) but has not been used since commit 1144d25094
(Merge branch 'backport-ninja-no-cleandead' into ninja-no-cleandead,
2020-12-14, v3.19.2~4^2).  Remove it.
2023-02-07 15:10:29 -05:00
Ben Boeckel
eed295fd8a cmGlobalNinjaGenerator: require that dependency info files work
Now that only targets expected to have information are listed, all
`<LANG>Modules.json` files should exist.
2023-02-01 09:12:49 -05:00
Ben Boeckel
7abddcab08 Ninja: require Ninja 1.11 for C++ module support
See: https://gitlab.kitware.com/cmake/cmake/-/issues/18355#note_1296721
See: https://github.com/ninja-build/ninja/pull/1937
2023-01-23 12:21:05 -05:00
Pierre Testart
1f16af01f4 cmGlobalNinjaGenerator: Optimize target depends closure
Rewrite AppendTargetDependsClosure method to only cache local target
outputs, not including outputs from dependencies.

Caching all recursive target outputs causes much time to be spent
merging sets that have many elements in common (from targets that are
included through multiple dependency paths).
It is faster to always iterate over all dependencies instead.
2023-01-17 18:07:07 +01:00
Rose
6d15754814 Make vector operations more efficient 2022-12-10 12:48:09 -05:00
Brad King
3b4337adc7 Merge topic 'clang-tidy-export-fixes-dir'
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
2022-12-07 08:19:53 -05:00
Kyle Edwards
232467eb1c clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property
Fixes: #21362
2022-12-06 10:39:29 -05:00
Ben Boeckel
21b9fb1e8c cmCxxModuleMapper: support the clang module map format 2022-12-02 13:01:21 -05:00
Ben Boeckel
f4a17b29d3 cmDyndepCollation: factor out metadata writing for dyndep 2022-11-30 10:53:45 -05:00
Ben Boeckel
2f93a272d0 cmDyndepCollation: factor out parsing dyndep information 2022-11-30 10:53:45 -05:00
Ben Boeckel
5e026739e1 cmGlobalGenerator: factor out C++ module support checking
This will simplify adding support to other generators.
2022-11-23 17:31:31 -05:00
Ben Boeckel
0015cb95de cmGlobalNinjaGenerator: fix comment typo 2022-11-21 17:09:33 -05:00
Alex Turbov
6e3e8827fa Refactor: cmGlobalGeneratorFactory::GetDocumentation returns entry
Before, a documentation entry was in/out parameter.
Now it's a normal return value.

This also makes possible to eliminate defaulted default ctor
for `cmDocumentationEntry` for C++ 11.

Also, simplify `cmake::AppendGlobalGeneratorsDocumentation()`.
2022-11-17 16:37:13 +04:00
Ben Boeckel
887a8874c3 EXPORT_COMPILE_COMMANDS: add output field
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`).
2022-10-28 13:54:43 -04:00
Brad King
fa040cedad Merge topic 'ninja-intl-paths'
a12050666c Tests: Add case for ninja with non-ascii chars
02a04dd9c7 Ninja: Restore support for non-ascii paths on Windows with ninja<=1.10

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7833
2022-10-27 09:26:36 -04:00
Brad King
02a04dd9c7 Ninja: Restore support for non-ascii paths on Windows with ninja<=1.10
Revert commit bbdb000c55 (GlobalNinjaGenerator: enlarge file stream
buffer, 2022-01-25, v3.23.0-rc1~68^2).  Somehow `rdbuf()->pubsetbuf()`
is resetting our imbued locale and `cm_codecvt` that handles encoding.

Fixes: #24089
2022-10-26 15:24:43 -04:00
Ben Boeckel
297e0f4dce cmCxxModuleMapper: support MSVC module map format
THis is a set of flags stored in a response file which informs the
compiler about where to place output BMI files as well as find the
required BMIs.
2022-08-02 10:53:38 -04:00
Ben Boeckel
b3c2880cb2 cmCxxModuleMapper: track transitive modules for MSVC
MSVC needs the transitive closure of module usage to compile.
2022-08-02 10:53:38 -04:00
Ben Boeckel
f899563ae4 cmGlobalNinjaGenerator: verify that private sources stay private
Private source files are not installed or made available, so they must
not be required by public module interface units at all.
2022-07-06 11:37:51 -04:00
Ben Boeckel
9ecd3e771b cmGlobalNinjaGenerator: generate install rules for BMI files 2022-07-06 11:37:50 -04:00
Ben Boeckel
89f39b6539 cmGlobalNinjaGenerator: generate module property files for each target export 2022-07-06 11:33:16 -04:00
Ben Boeckel
cf847617be cmGlobalNinjaGenerator: verify generated objects against filesets 2022-07-06 10:15:23 -04:00
Ben Boeckel
4151547e2f cmGlobalNinjaGenerator: use cmModuleMapper implementation 2022-06-16 10:28:34 -04:00
Ben Boeckel
a046a45aad cmGlobalNinjaGenerator: add a TODO for header units 2022-06-16 10:28:34 -04:00
Ben Boeckel
52d47fd4e6 cmGlobalNinjaGenerator: simplify a string building call 2022-06-14 19:27:30 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Ben Boeckel
cc4e19710d cmGlobalNinjaGenerator: use an extention based on the modmapfmt 2022-04-27 14:30:41 -04:00
Ben Boeckel
97a68198c9 cmGlobalNinjaGenerator: escape : in module names
Not all filesystems support `:` in the name, so replace it with `-`. As
`-` is not otherwise allowed in module names anyways, there is no risk
of conflict.
2022-04-27 14:30:41 -04:00
Brad King
43416c48ed cmOutputConverter: Always set relative path top source and binary together
Refactor to set both at once so we have a single place in the code that
knows both have been set.
2022-02-28 10:25:18 -05:00
Brad King
f4893ac0b1 Merge topic 'enlarge-build-file-stream-buffer'
bbdb000c55 GlobalNinjaGenerator: enlarge file stream buffer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6903
2022-01-27 11:11:59 -05:00
Brad King
b41b841cc6 Merge topic 'encode-literal-inplace'
5c3f188bef GlobalNinjaGenerator: Add EncodeLiteralInplace which doesn't copy

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6904
2022-01-27 11:11:11 -05:00
Clemens Wasser
bbdb000c55 GlobalNinjaGenerator: enlarge file stream buffer 2022-01-26 17:09:21 +01:00
Clemens Wasser
5c3f188bef GlobalNinjaGenerator: Add EncodeLiteralInplace which doesn't copy 2022-01-25 21:39:49 +01:00
Carsten Rudolph
193b8fca52 cmBuildOptions: Split build arguments into separate object. 2022-01-22 06:35:38 -05:00
Brad King
e479650b41 Merge topic 'nmc-cross-config-target-deps'
95f44e00cd Ninja Multi-Config: Fix custom command target dependencies in cross-configs
a883363935 Ninja Multi-Config: Fix internal cross-config target dependency ordering
16e24748c5 Ninja Multi-Config: Fix cross-config custom command dependency tracing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6702
2021-11-05 10:09:28 -04:00
Brad King
16e24748c5 Ninja Multi-Config: Fix cross-config custom command dependency tracing
Process `CMAKE_CROSS_CONFIGS` and friends to properly configure the
generator for cross-config behavior before custom command dependency
tracing.
2021-11-04 12:23:35 -04:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Sean McBride
37859e3244 Source: Fix clang -Wimplicit-fallthrough warnings 2021-09-28 10:53:54 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Brad King
bcdd8cfe44 Merge topic 'platform-vars'
a136b6ec98 MINGW: Define variable only when targeting Windows platforms
39c5dad0cb Ninja: Remove redundant check for GNU-like compiler on Windows
0b7ae84a96 Cygwin: Remove redundant definitions of CYGWIN and UNIX variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6538
2021-09-21 11:01:18 -04:00
Brad King
39c5dad0cb Ninja: Remove redundant check for GNU-like compiler on Windows
Update the Ninja generator's check to work using whatever language is
being enabled instead of hard-coding C and CXX.  With that, the
undocumented internal `CMAKE_COMPILER_IS_MINGW` variable is only set by
compilers already covered by other alternatives in the condition.  See
commit b3de0dfe93 (Ninja: Use forward slashes for any GCC on Windows,
2015-05-07, v3.3.0-rc1~93^2~3).
2021-09-17 12:15:11 -04:00
Marc Chevrier
7e154ebd59 cmSystemTools::VersionCompare: use std::string for arguments 2021-09-17 11:58:46 +02:00
Brad King
eec847cca5 Merge topic 'ninja-armclang-windows'
b6cf93472f Ninja: fix ARMClang paths for Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6484
2021-09-03 10:16:26 -04:00
Martin Kojtal
b6cf93472f Ninja: fix ARMClang paths for Windows
We need to escape paths for ARMClang on Windows, see the referenced
issue for more details.

Fixes: #21093
2021-09-02 11:40:17 -04:00
Brad King
03bd9c4c10 cmMakefile: Add helper to initialize CMAKE_CONFIGURATION_TYPES
Factor out duplicate code from the Ninja Multi-Config, Visual Studio,
and Xcode generators.
2021-06-30 10:55:40 -04:00
NAKAMURA Takumi
51bf4094fb Ninja: Use ccmake for edit_cache
If `ninja` is new enough to support the console pool, and `ccmake` is
available, use it for `edit_cache`.
2021-06-29 11:07:42 -04:00
NAKAMURA Takumi
61a737b088 cmGlobalNinjaGenerator: Rename SupportsConsolePool to SupportsDirectConsole
Use a name that is not ninja-specific.
2021-06-29 10:36:03 -04:00
Brad King
a35d121276 Ninja: Populate P1689R4 compiled-module-path field for Fortran
When scanning Fortran dependencies, we know the file path at which a
provided module file is written.  Store it in the `compiled-module-path`
field as specified by P1689R4.  Our collator in `cmake_ninja_dyndep` no
longer needs to assume that the module file path can be derived from the
logical module name.  In the future, the Fortran dependency scanning may
be done by the compiler itself, in which case it will provide the value
of `compiled-module-path`.
2021-06-15 09:11:06 -04:00
Brad King
10b2e53469 cmScanDepFormat: Remove Fortran-specific compiled-module-path logic
Read and write the `compiled-module-path` field only when explicitly
known.  Move the assumption that the `compiled-module-path` can be
derived from the logical module name from the scandep parser to the
`cmake_ninja_dyndep` helper.
2021-06-15 09:09:28 -04:00
Brad King
c564a3e3ff Ninja: Always compile sources using absolute paths
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
2021-05-25 10:48:26 -04:00