Commit Graph

598 Commits

Author SHA1 Message Date
Brad King
67d604a792 Merge topic 'nmake-rsp-encoding'
d5ee6d50ee NMake: Use UTF-8 BOM in response files only with MSVC tooling
cab631c2e2 NMake: Document response file encoding heuristic in a comment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6905
2022-01-27 11:05:04 -05:00
Brad King
d5ee6d50ee NMake: Use UTF-8 BOM in response files only with MSVC tooling
Since commit f3f57cc4ed (NMake: Use UTF-8 with BOM if supported by
nmake, 2021-04-22, v3.21.0-rc1~217^2), we add a BOM to response files
to tell MSVC tooling that they are encoded as UTF-8.  However, the
"NMake Makefiles" generator may also be used with non-MSVC toolchains
that do not understand the BOM.  Update the response file encoding
selection heuristic to add the BOM only with MSVC tooling.

Fixes: #23143
2022-01-26 07:57:43 -05:00
Brad King
cab631c2e2 NMake: Document response file encoding heuristic in a comment
Since commit f3f57cc4ed (NMake: Use UTF-8 with BOM if supported by
nmake, 2021-04-22, v3.21.0-rc1~217^2) the encoding of response files is
selected based on the makefile encoding.  In principle these may be
orthogonal, but in practice it is a useful heuristic.  Call out this
heuristic in a comment, and leave a FIXME to do something better.
2022-01-26 07:40:36 -05:00
Brad King
d6993e593d Merge topic 'makefile-CMAKE_EXPORT_COMPILE_COMMANDS-HIP'
b59f7600c4 HIP: Enable CMAKE_EXPORT_COMPILE_COMMANDS for HIP

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6789
2021-12-07 09:54:10 -05:00
Brad King
b59f7600c4 HIP: Enable CMAKE_EXPORT_COMPILE_COMMANDS for HIP
Fixes: #22986
2021-12-07 09:34:49 -05:00
Raul Tambre
4707ecbe6f CUDA: Support CMP0105 on Clang
Add link flags during the "device compile" step.

Enabled the relevant tests. The disable reasons regarding separable compilation
were outdated and the actual failure case was device link flags support.
2021-11-08 21:26:00 +02:00
Raul Tambre
15fde4c420 CUDA: Use local shorthands for variables in Clang device link code
Helps reduce wrapping of lines making code more readable.
2021-11-07 21:28:08 +02:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Robert Maynard
61b9764b03 CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATION
The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION`
now aren't mutually exclusive and can now be used together on the same
target.
2021-10-20 11:18:06 -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
PigeonF
ccfe1b0b40 IWYU: Add --driver-mode=cl when applicable
We already do this for `clang-tidy`.

Fixes: #16554
2021-09-10 09:53:31 -04:00
Marc Chevrier
5a2a275bb4 Refactor: reduce cmToCStr usage 2021-08-19 10:49:30 +02:00
Marc Chevrier
9e7a0568f6 Merge branch 'backport-3.21-CC-DEPFILE-independent-from-CMAKE_DEPENDS_USE_COMPILER' into CC-DEPFILE-independent-from-CMAKE_DEPENDS_USE_COMPILER 2021-08-01 15:26:21 +02:00
Marc Chevrier
213fec4908 add_custom_command(DEPFILE) independent from CMAKE_DEPENDS_USE_COMPILER
Fixes: #22486
2021-08-01 15:24:16 +02:00
Brad King
6064c70469 Merge topic 'cuda_separable_clang_make'
3975678fcc CUDA/Clang: Simplify --register-link-binaries logic
0b1cea66cd CUDA/Clang: Fix separable compilation in non-root directories with Makefiles

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6400
2021-07-29 08:45:40 -04:00
root
3975678fcc CUDA/Clang: Simplify --register-link-binaries logic
Move the logic for appending cubin afterwards, so the check can simply be
empty().
With the Makefile generator the option is now at the front instead of being
intermixed with the actual bins.
2021-07-29 13:19:37 +03:00
root
0b1cea66cd CUDA/Clang: Fix separable compilation in non-root directories with Makefiles
Seems the relative paths were wrong basically all around such that only
compiling files in the top-level directory would work. I've modified
CudaOnly.SeparateCompilation to cover this.

Fixes #22482.
2021-07-29 13:19:37 +03:00
Isuru Fernando
fe3f846e1b Makefiles: Add support for building Fortran intrinsics
Fixes: #21463
2021-06-24 08:39:47 -04:00
Robert Maynard
b50bfc8913 HIP: Add language to CMake 2021-06-07 19:25:33 +00:00
Brad King
37cda77d16 Merge topic 'fix-compile-db-crash'
316cbbe8d5 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6173
2021-05-29 09:45:33 -04:00
Brad King
316cbbe8d5 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule
Extend the fix from commit 67e2130c96 (Makefiles: Fix
CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule,
2020-11-20, v3.19.1~8^2) to work for the `<FLAGS>` placeholder too.
Also fix the test case to actually enable `EXPORT_COMPILE_COMMANDS`
on the test target.

Fixes: #22261
2021-05-28 15:41:38 -04:00
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
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
1d1d88d3c8 cmMakefileTargetGenerator: Clarify name of relative path conversion helper 2021-05-13 12:47:25 -04:00
Vitaly Stakhovsky
ce97b7909b Source: Remove unnecessary comparisons to nullptr 2021-05-10 11:44:53 -04:00
Amine Najahi
f3f57cc4ed NMake: Use UTF-8 with BOM if supported by nmake
Fixes: #21792
2021-05-05 10:56:49 -04:00
Brad King
3e7dd39747 cmLocalGenerator: Simplify some GetIncludeFlag call sites
The path style argument is meaningful only with the Ninja generator,
so drop it from call sites in Makefile and Xcode generators.
2021-02-25 13:24:54 -05:00
Brad King
a133a583d4 cmLocalGenerator: Clarify GetIncludeFlags signature
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.
2021-02-25 13:24:45 -05:00
Cristian Adam
c450d66daa PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 15:03:55 -05:00
Brad King
8d379e7406 Revert "PCH: Remove restrictions for REUSE_FROM signature for MSVC"
This reverts commit 9f06097141.
It was merged accidentally.
2021-02-02 15:02:08 -05:00
Cristian Adam
9f06097141 PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 19:11:44 +01:00
Marc Chevrier
bb64ea5741 Makefiles: ensure transparent switch between dependencies strategies 2021-01-09 11:35:17 +01:00
Brad King
1cbbfbc78f Merge topic 'export-compile-commands-per-target'
a742b5d137 CMAKE_EXPORT_COMPILE_COMMANDS: allow configuration per target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5651
2021-01-07 08:22:27 -05:00
Shannon Booth
a742b5d137 CMAKE_EXPORT_COMPILE_COMMANDS: allow configuration per target
The new target property `EXPORT_COMPILE_COMMANDS` associated with the
existing global variable can be used to optionally configure targets for
their compile commands to be exported.

Fixes: #19462
2021-01-06 11:51:39 +13: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
Marc Chevrier
cfd8a5ac1f Makefiles: Add support of DEPFILE for add_custom_command
Issue: #20286
Fixes: #21415
2020-12-23 15:47:46 +01:00
Brad King
67f12dd1d6 Merge topic 'ispc_control_header_suffixes'
c9a50f3556 ISPC: Generated Headers suffix configurable with a better default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5597
2020-12-15 07:40:34 -05:00
Robert Maynard
c9a50f3556 ISPC: Generated Headers suffix configurable with a better default
The target property `ISPC_HEADER_SUFFIX` and associated global
variable now can control the suffix used when generating the
C/C++ interoperability ISPC headers.

In addition the default suffix is now "_ispc.h" which matches the
common convention that the ISPC compiler team uses and recommends.
2020-12-14 13:13:09 -05:00
Brad King
48aac247e9 Compile with explicit language flag when source LANGUAGE property is set
This change was originally made by commit 74b1c9fc8e (Explicitly specify
language flag when source LANGUAGE property is set, 2020-06-01,
v3.19.0-rc1~722^2), but it was reverted by commit 30aa715fac (Revert
"specify language flag when source LANGUAGE property is set",
2020-11-19) to restore compatibility with pre-3.19 behavior.

Implement the change again, but add policy CMP0119 to make this change
while preserving compatibility with existing projects.

Note that the `Compiler/{Clang,Intel,MSVC}-CXX` modules do not need to
specify `-TP` for their MSVC-like variants because we already use the
flag in `CMAKE_CXX_COMPILE_OBJECT`.  Similarly for `Compiler/XL-CXX`
and `Platform/Windows-Embarcadero`.

Note also that this does not seem possible to implement for XL C.
Even with `-qsourcetype=c`, `xlc` complains about an unknown suffix:
`1501-218 (W) file /.../AltExtC.zzz contains an incorrect file suffix`.
It returns non-zero even with `-qsuppress=1501-218`.

Co-Author: Robert Maynard <robert.maynard@kitware.com>
Fixes: #14516, #20716
2020-12-02 11:39:11 -05:00
Marc Chevrier
2c71d051fa Makefiles Generators: use compiler for dependencies generation
Each source compilation generates a dependencies file. These dependencies
files are consolidated in one file per target. This consolidation is done
as part of command 'cmake -E cmake_depends` launched before evaluation of
makefile dependency graph.

The consolidation uses the same approach as `CMake` dependencies management.

Fixes: #21321
2020-11-29 15:25:42 +01:00
Marc Chevrier
afd0f6785d Refactoring: Abstract Makefile line continuation format 2020-11-28 16:02:58 +01:00
Marc Chevrier
a97c41bf8b Refactoring: Makefiles Generators: Add support for various depends scanners 2020-11-28 16:02:58 +01:00
Brad King
c178fad186 Merge topic 'fix-compile-db-crash'
67e2130c96 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5521
2020-11-23 11:19:59 -05:00
Brad King
ed049d1678 Merge topic 'fix-compile-db-crash' into release-3.19
67e2130c96 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5521
2020-11-23 11:19:58 -05:00
Brad King
60a131efd5 Merge topic 'revert-explicit-LANGUAGE-flag'
30aa715fac Revert "specify language flag when source LANGUAGE property is set"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5519
2020-11-20 10:05:11 -05:00
Brad King
67e2130c96 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule
Fixes: #21471
2020-11-20 09:45:14 -05:00
Brad King
30aa715fac Revert "specify language flag when source LANGUAGE property is set"
Revert commit 74b1c9fc8e (Explicitly specify language flag when source
LANGUAGE property is set, 2020-06-01, v3.19.0-rc1~722^2) and the lookup
tables from its two immediate ancestors.  The purpose of that change was
to convert an explicit `LANGUAGE` source file property into an explicit
language specification compiler flag like `-x c`.  This seems reasonable
since the property is documented as meaning "indicate what programming
language the source file is".  It is also needed to help compilers deal
with non-standard source file extensions they don't recognize.

However, some projects have been setting `LANGUAGE C` on `.S` assembler
source files to mean "use the C compiler".  Passing `-x c` for them
breaks the build because the `.S` sources are not written in C.  These
projects should be updated to use `enable_language(ASM)`, for which
CMake often chooses the C compiler as the assembler when using
toolchains that support it (which would have to be the case for projects
using the approach).

Revert the change for now to preserve the old behavior for such projects.
We can re-introduce it with a policy in a future version of CMake.

Fixes: #21469
Issue: #14516, #20716
2020-11-19 17:06:03 -05:00
Brad King
ffda92d4bf Merge topic 'clang-tidy-for-objc'
1134064e22 clang-tidy: allow OBJC and OBJCXX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5467
2020-11-06 08:05:00 -05:00
Andrew Fuller
1134064e22 clang-tidy: allow OBJC and OBJCXX 2020-11-05 11:39:32 -08:00