1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Commit Graph

451 Commits

Author SHA1 Message Date
Brad King
8526756b61 cmOutputConverter: Adopt relative path conversion helpers
Move them up from cmLocalGenerator and out of cmStateDirectory.
2021-05-17 10:04:01 -04:00
Brad King
21da0f83a2 Merge topic 'relative-paths'
f6d4fa63f8 cmStateDirectory: Comment relative path top directory selection approach
f0ffb1e2d4 cmGlobalGenerator: Simplify relative path conversion in AddRuleHash
d346805e41 cmLocalCommonGenerator: Select work directory semantically
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
1879f1bcbc cmLocalCommonGenerator: Factor out relative path conversion helper
1d1d88d3c8 cmMakefileTargetGenerator: Clarify name of relative path conversion helper
ec1ea13066 cmDependsFortran: Simplify relative path conversion helper
ba7b939831 cmStateDirectory: Rename ConvertToRelPathIf{Not => }Contained
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6122
2021-05-14 08:37:24 -04:00
Brad King
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
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.
2021-05-13 12:47:25 -04:00
Brad King
db8e0beeac cmGlobalNinjaGenerator: Clarify semantics of Fortran scanning info
Use `optional<>` instead of `unique_ptr<>` to hold optional value.
2021-05-13 08:33:04 -04:00
Brad King
bd12b97d05 cmScanDepFormat: Drop unused "outputs", "inputs", and "depends" fields
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.
2021-05-13 08:33:00 -04:00
Brad King
03a61ae509 Merge topic 'ninja-regenerate-no-recompact'
6fd9c68ed0 Ninja: Do not recompact deps log in regeneration during a build

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !5916
2021-03-17 09:39:38 -04:00
Brad King
6fd9c68ed0 Ninja: Do not recompact deps log in regeneration during a build
Since commit fb18215904 (Ninja: clean ninja metadata once generated,
2019-05-13, v3.17.0-rc1~207^2) we recompact the ninja deps log during
regeneration.  That does not make sense during a build, so skip it if we
are regenerating during a build.

This problem went unnoticed previously because on non-Windows platforms
the deps log is just overwritten again by the outer build.  On Windows
platforms, recompaction during the build fails, but we did not actually
try to do that until commit 11f4259362 (Ninja: Clean metadata after
regen during build on Windows with 1.10.2+, 2020-11-30, v3.19.2~29^2~1).

Fixes: #21916
2021-03-16 09:37:35 -04:00
Kyle Edwards
9af6e2e7b2 Ninja: Use new wincodepage tool to determine encoding
Ninja 1.11 and later uses UTF-8 on Windows when possible, and
includes a tool that reports the code page in use. Use this tool
to determine what encoding to write the Ninja files in.

Fixes: #21866
2021-03-09 11:09:24 -05:00
Ben Boeckel
ef935b17ab clang-tidy: fix readability-use-anyofallof warnings 2021-01-27 08:54:18 -05:00
Brad King
05f4248e3d Merge topic 'cpp-modules'
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
2021-01-07 08:26:28 -05:00
Ben Boeckel
39cbbb59a5 ninja: add experimental infrastructure to generate gcc-format modmap files 2021-01-05 09:35:10 -05:00
Ben Boeckel
791b4d26d6 ninja: add experimental infrastructure to generate modmap files with dyndep
The scan step may need to output additional information for the
compiler, not just the build tool. The modmap is assumed to be beside
the object output. Additional refactoring may open up a channel to
inform per-source paths to the dyndep rule in the future, but is not
done here.
2021-01-05 09:35:10 -05:00
Brad King
4b23359117 ninja: Add experimental infrastructure for C++20 module dependency scanning
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>
2021-01-05 09:34:55 -05:00
Brad King
dacd93a2db ninja: De-duplicate version numbers required for ninja features 2021-01-05 09:29:18 -05:00
Oleksandr Koval
209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Brad King
34469a4f71 Merge topic 'custom-command-output-genex-nmc'
1526ae3aba Tests: Add cases for Ninja Multi-Config cross-config custom commands
dcf9f4d2f7 Ninja Multi-Config: Add support for cross-config custom commands
15467f12f7 cmLocalGenerator: Adopt custom target 'force' output name generation
7b64b0cd5a cmLocalGenerator: Refactor custom command generator construction
d29da8ed3e cmMakefile: Simplify custom target 'force' output name generation
2b1cc175ee Help: Clarify version adding add_custom_{command,target} OUTPUT genex support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5612
2020-12-16 06:20:39 -05:00
Brad King
b485e86363 Merge topic 'ninja-no-cleandead'
1144d25094 Merge branch 'backport-ninja-no-cleandead' into ninja-no-cleandead
73a961eaba Ninja: Remove cleandead on regeneration

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5614
2020-12-15 07:36:07 -05:00
Kyle Edwards
dcf9f4d2f7 Ninja Multi-Config: Add support for cross-config custom commands
Co-Author: Brad King <brad.king@kitware.com>
2020-12-15 07:01:21 -05:00
Brad King
1144d25094 Merge branch 'backport-ninja-no-cleandead' into ninja-no-cleandead 2020-12-14 10:14:19 -05:00
Brad King
73a961eaba Ninja: Remove cleandead on regeneration
Remove the `cleandead` tool invocation added by commit fb18215904
(Ninja: clean ninja metadata once generated, 2019-05-13,
v3.17.0-rc1~207^2).  The tool deletes files that were not previously
deleted by regenerating the build system.  Also, there are use cases
where no-longer-generated files should not be removed, such as Qt's TS
files.

Fixes: #21549
2020-12-14 10:08:14 -05:00
Brad King
5d49943504 Merge topic 'ninja-regen-metadata'
73d1c78bf4 ci: update to use ninja 1.10.2
11f4259362 Ninja: Clean metadata after regen during build on Windows with 1.10.2+

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5555
2020-12-01 09:29:12 -05:00
Brad King
11f4259362 Ninja: Clean metadata after regen during build on Windows with 1.10.2+
Ninja 1.10.2 fixes support for `generator = 1` rules that run metadata
update commands during regeneration while a build is running.  Update
the condition added by commit ccaa0bccc4 (Ninja: Do not clean metadata
when re-generating inside a running build, 2020-01-27,
v3.17.0-rc1~73^2) to remove our workaround when Ninja is new enough.

Fixes: #20274
2020-11-30 14:57:48 -05:00
Ben Boeckel
f3eed2c49d cmGlobalNinjaGenerator: use P1689 dependency file format for Fortran
The module dependency specification format described in the C++
JTC1/SC22/WG21 paper [1] is also suitable for use by Fortran.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1689r2.html
2020-11-17 13:17:04 -05:00
Brad King
fa18069ebd Ninja: Exclude unused dyndep features during CMake bootstrap 2020-11-16 11:42:40 -05:00
Brad King
5e3b0aa9b2 Merge topic 'ninja-cleandead-no-dyndep'
c5011399c5 Ninja: Avoid cleandead with dyndep bindings for Fortran module dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5490
2020-11-11 09:34:17 -05:00
Brad King
c5011399c5 Ninja: Avoid cleandead with dyndep bindings for Fortran module dependencies
The Ninja `cleandead` tool does not account for implicit outputs
discovered by `dyndep` bindings and can remove Fortran `.mod` files that
are still needed.  Disable the `cleandead` step when using `dyndep`
bindings.

Fixes: #21406
2020-11-10 15:16:28 -05:00
Brad King
2a1da463e9 Merge topic 'ninja-multi-per-config-sources'
b8937a992b Merge branch 'release' into ninja-multi-per-config-sources
d13bd6ec3d Ninja Multi-Config: Don't try to calculate dependencies for "all"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Brad King <brad.king@kitware.com>
Merge-request: !5430
2020-10-27 06:59:57 -04:00
Kyle Edwards
b8937a992b Merge branch 'release' into ninja-multi-per-config-sources 2020-10-26 15:43:57 -04:00
Kyle Edwards
d13bd6ec3d Ninja Multi-Config: Don't try to calculate dependencies for "all" 2020-10-26 15:37:04 -04:00
Cengizhan Pasaoglu
bd705788f6 Constify some code as suggested by clang-tidy 2020-10-20 00:04:04 +03:00
Kyle Edwards
297ab15bf6 Ninja Multi-Config: Read configuration variables as normal variables
Early versions of the Ninja Multi-Config generator required
CMAKE_CONFIGURATION_TYPES and friends to be cache variables in order
to support selecting the default config in cmake(1) --build. The
behavior of cmake(1) --build has since been updated to no longer
require this, and requiring these variables to be cache variables is
inconsistent with the other generators.

Read the variables as normal CMake variables like the other generators.
This does not require a policy, since the only scenario where this would
cause a breakage is one where the cache variable and the CMake variable
are explicitly set to different values, which doesn't make sense to do
anyway.
2020-10-13 10:52:02 -04:00
Kyle Edwards
f4215ee57d Ninja Multi-Config: Fix segfault when installing an export
Fixes: #21290
2020-10-09 13:51:01 -04:00
Brad King
5d952fd6e2 Merge topic 'ninja-multi-automoc-regression'
23fe4b861f Ninja Multi-Config: Fix dependencies of custom commands

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5238
2020-09-18 08:42:28 -04:00
Kyle Edwards
23fe4b861f Ninja Multi-Config: Fix dependencies of custom commands
a9fd3a10 addressed the scenario where the depending target is a
utility target, but not the scenario where the dependent target is
a utility target. Account for this scenario.

Also add a Qt-specific test case.

Fixes: #21118
2020-09-17 15:46:57 -04:00
Robert Maynard
a020787a9b ISPC: Support generation for multiple instruction sets 2020-09-04 08:37:07 -04:00
Brad King
ca5babfd7a Merge topic 'getdef'
11425041f0 cmMakefile::GetDefinition: return cmProp

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5179
2020-09-03 09:18:05 -04:00
Kyle Edwards
2a6471dd7b Merge branch 'master' into ninja-multi-automoc-regression 2020-09-02 14:39:04 -04:00
Kyle Edwards
a9fd3a107d Ninja Multi-Config: Fix dependencies of utility targets
Fixes: #21118
2020-09-02 12:59:59 -04:00
Kyle Edwards
657047cd24 Ninja Multi-Config: Fix clean:all target 2020-09-02 12:59:59 -04:00
Vitaly Stakhovsky
11425041f0 cmMakefile::GetDefinition: return cmProp 2020-09-02 07:27:32 -04:00
Brad King
f10682b796 Merge topic 'ispc_lang_support'
5ece12b7e4 gitlab-ci: add ISPC to the Fedora CI image
8976817d6d ISPC: Update help documentation to include ISPC
2368f46ba4 ISPC: Support building with the MSVC toolchain
e783bf8aa6 ISPC: Support ISPC header generation byproducts and parallel builds
34cc6acc81 Add ISPC compiler support to CMake
419d70d490 Refactor some swift only logic to be re-used by other languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5065
2020-09-01 09:15:39 -04:00
Robert Maynard
e783bf8aa6 ISPC: Support ISPC header generation byproducts and parallel builds 2020-08-28 11:21:31 -04:00
Brad King
4391913133 Add INTERFACE libraries to generated buildsystem if they have SOURCES
INTERFACE libraries were created with the intention of collecting usage
requirements for use by other targets via `target_link_libraries`.
Therefore they were not allowed to have SOURCES and were not included in
the generated buildsystem.  In practice, this has become limiting:

* Header-only libraries do have sources, they just do not compile.
  Developers should be able to edit those sources (the header files)
  in their IDE.

* Header-only libraries may need to generate some of their header
  files via custom commands.

Some projects work around these limitations by pairing each interface
library with an `add_custom_target` that makes the header files and
custom commands appear in the generated buildsystem and in IDEs.

Lift such limitations by allowing INTERFACE libraries to have SOURCES.
For those with sources, add a corresponding build target to the
generated buildsystem.

Fixes: #19145
2020-08-07 08:46:32 -04:00
Brad King
261a2585d9 Merge topic 'cleanup-target-types'
ef796cc743 cmGeneratorTarget: Skip computing link implementation for custom targets
45158b2afe cmGeneratorTarget: Simplify logic in ComputeLinkInterfaceLibraries
d6b1f5704e cmGeneratorTarget: Add missing nullptr checks
7695b67500 cmComputeTargetDepends: Add missing nullptr check
95b5df8646 cmGeneratorTarget: Skip computing languages for custom targets
2f0790df50 Factor out generator checks for filtering on non-compiling targets
422d9a0ab2 Factor out generator checks for filtering out interface libraries
bce82df0aa cmGeneratorTarget: Remove unnecessary target type check in dependency tracing
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kyle Edwards <kyle.edwards@kitware.com>
Merge-request: !5038
2020-07-28 08:26:23 -04:00
Kyle Edwards
cfe2dc4721 Ninja: Remove parameter default for cmNinjaTargetDepends 2020-07-24 11:49:59 -04:00
Brad King
422d9a0ab2 Factor out generator checks for filtering out interface libraries
Add a `cmGeneratorTarget::IsInBuildSystem` helper method to tell
generators whether a target should participate in the generated build
system.
2020-07-23 13:31:44 -04:00
Brad King
159a4d6b11 cmGlobalNinjaGenerator: Replace switch default with all cases 2020-07-23 08:56:50 -04:00
Joerg Bornemann
2cdaf43d96 Allow generator expressions in the EXCLUDE_FROM_ALL target property
This allows for setting EXCLUDE_FROM_ALL, conditional on the build
configuration. However, only the Ninja Multi-Config generator supports
different property values per config. All other multi-config
generators will yield an error in that situation.

Fixes: #20923
2020-07-21 17:16:26 +02:00
Robert Maynard
7a969fe21d cmMakefile: Refactor API to better handle empty config values 2020-07-03 07:43:18 -04:00
Marc Chevrier
2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
Fixes: #20666
2020-05-07 12:06:08 +02:00