Commit Graph

734 Commits

Author SHA1 Message Date
Lingkai Dong
c4941b7e66 ARMClang: Do not automatically add cpu/arch compile or link options
The compile options `--march=<arch>` and `--mcpu=<cpu>` and the
link option `--cpu=<cpu>` are automatically added by CMake based
on `CMAKE_SYSTEM_PROCESSOR` or `CMAKE_SYSTEM_ARCH`. But this is not
sufficient, because armclang also supports enabling or disabling
features using `+<feature>`:

    -mcpu=<name>[+[no]<feature>+...]

For example:

    -mcpu=cortex-a57+nocrypto+nofp+nosimd+crc

(Reference: https://developer.arm.com/documentation/dui0774/k/Compiler-Command-line-Options/-mcpu?lang=en)

The problem is, even if a project adds a flag with features it needs,
CMake still adds flags, resulting in code that is compiled with wrong
CPU features and unable to run.

Add policy `CMP0123` to not automatically add compile or link options,
and let projects set them instead.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #21173
2021-04-27 14:03:15 -04:00
Brad King
0078db3888 ARMClang: Separate cpu/arch flags from preceding flags
Suggested-by: Kim Kryger
2021-04-27 13:58:57 -04:00
Paul Zehner
cc0d2004b2 Fujitsu: Fix C90 standard flags
Fix typos from commit 3c867cff4a (Fujitsu: Add support for the Fujitsu
compiler in Trad mode, 2020-12-22).
2021-04-14 15:19:59 -04:00
Brad King
c3fab3e62d Merge topic 'cuda-depfile-ccbin'
8e38985db7 Makefiles: Fix dependency extraction with CUDA < 10.2 and host compiler

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Raul Tambre <raul@tambre.ee>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !5992
2021-04-08 07:46:15 -04:00
Brad King
8e38985db7 Makefiles: Fix dependency extraction with CUDA < 10.2 and host compiler
Since commit 2c71d051fa (Makefiles Generators: use compiler for
dependencies generation, 2020-10-18, v3.20.0-rc1~392^2) we invoke `nvcc`
for CUDA < 10.2 a second time in order to generate a depfile.  When
`CMAKE_CUDA_HOST_COMPILER` is set, the second invocation is missing its
`-ccbin=` option, even after refactoring in commit 8981e3e7cc
(NVIDIA-CUDA: rely on new capabilities for deps generation, 2020-12-02,
v3.20.0-rc1~362^2).

Ideally we should move the `-ccbin=` flag into `Compiler/NVIDIA-CUDA`,
but that will add `CMAKE_CUDA_HOST_COMPILER` support on Windows in
command-line generators but not the Visual Studio generators.
For now, add the flag to the depfile command specifically.

Fixes: #22037
2021-04-07 10:54:27 -04:00
Chuck Atkins
27579e9cf1 FujitsuClang: Add support for the Fujitsu compiler in Clang mode
This should be front end compatible with vanilla clang but giving it a
unique identifier allows a project to pass additional options unique to
Fujitsu and outside the scope of a CMake builtin.
2021-03-31 09:14:45 -04:00
Chuck Atkins
3c867cff4a Fujitsu: Add support for the Fujitsu compiler in Trad mode
Co-Author: Yuichiro Utsumi <utsumi.yuichiro@jp.fujitsu.com>
2021-03-30 10:32:53 -04:00
Brad King
31fc010259 Merge topic 'cray-fortran'
ef513fe3d1 Cray: Enable explicit Fortran preprocessing for Ninja generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5882
2021-03-08 13:07:20 -05:00
Brad King
ef513fe3d1 Cray: Enable explicit Fortran preprocessing for Ninja generator
Cray 11.0 adds support for preprocessing with output written to a
specified file (instead of always next to the source).  Use it to
enable Cray Fortran with the Ninja generator.

Patch-by: James Elliott
Fixes: #20731
2021-03-05 08:11:05 -05:00
Brad King
957a117c70 Merge topic 'android-r22'
005e2cdfb0 Android: Do not use gold for ndk >= r22
ed7a87f270 Tests: Update RunCMake.Android for NDK r22
4950d35733 Help: Document CMAKE_ANDROID_NDK_VERSION variable
746906242d Android: Detect NDK version number

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5862
2021-03-03 11:11:58 -05:00
Haibo Huang
005e2cdfb0 Android: Do not use gold for ndk >= r22
Fixes: #21772
2021-03-03 10:28:56 -05:00
Raul Tambre
8211b4706f IntelLLVM: C17 support
Issue: #17755
2021-02-25 12:50:45 -05:00
Raul Tambre
b9c3acac02 GNU: C23 support
Added in commit 9f936c861383dc69e0053e34315d5d0262a19e8f, released in 9.1.
2021-02-25 18:22:32 +02:00
Raul Tambre
c9f0613c2a GNU: C17 support
Added in commit c76dc9c32d616eff1e0ae162042f1c0f8ca65fbf, released in 8.1.
Set as default in the same commit.

Issue: #17755
2021-02-25 18:22:32 +02:00
Raul Tambre
10a72c0f1c Clang: Default C standard doesn't depend on compatibility mode
MSVC compatibility mode doesn't affect the default standard.
2021-02-25 18:22:32 +02:00
Raul Tambre
6c2e309a66 Clang: Set standard flags according to frontend variant
They depend on the frontend not which compiler we're simulating.

Fixes #21771.
2021-02-25 18:22:32 +02:00
Raul Tambre
9f81591dbf Clang: MSVC-style C flags
Support added in LLVM commit d087d805acb664e885e9c31a916f6cfa5dbc2186, will be
released in Clang 13.
2021-02-25 18:22:32 +02:00
Raul Tambre
72f4984cdc Clang: C23 support
Added in LLVM commit d06f3917913d2558b771ccc48d838f8cd8993c01, released in
Clang 9.0.
2021-02-25 18:22:32 +02:00
Raul Tambre
82239d43f8 Clang: C17 default version
Switched in LLVM commit 91cdbd521a38495c66e30636943563ca70d3c022, released in
Clang 11.

Issue: #17755
2021-02-25 18:22:29 +02:00
Raul Tambre
9024fb632e Clang: C17 support
Added in LLVM commit 5b6c0f75e01571851b767dc63a3229c962f464f1, available since
Clang 6.

Issue: #17755
2021-02-25 18:22:10 +02:00
Raul Tambre
dcd599757f C23 support 2021-02-25 18:22:10 +02:00
Raul Tambre
93b7d3d292 C17 support
Implements #17755.
2021-02-25 18:22:10 +02:00
Raul Tambre
58d9525233 Clang: Correct default C standards for ancient versions
C11 was made default in LLVM commit ab506adf7d3ced6abcaf42f92de3d6cd15fa19e8,
released in 3.5.2.
C99 was made default in LLVM commit 17f76e04d244c80e70f1c81c94d4524b53d9772d,
released in 2.1. It was flipped a few times between C89 and C99 during the 2.1
cycle, but the C89 default never made it into a release.
2021-02-25 18:22:10 +02:00
Raul Tambre
356e83c156 Clang: Correct C standards flags for ancient versions
C89, C99 flags in LLVM commit ff43821d5380ee38aff421701f1d461242b524ee.
C90 flag in LLVM commit 229ce60fc9983df5f7e83e25fa6b5c0ca4d2b135.
C1x flag in LLVM commit a686b5f8bf7b5a2ab636c0c2de5ad4c174aa33e0.
C11 flag in LLVM commit 6784aeb9ef96e5735850fa7226ed0cb45cb82e75.

Mark C90, C99 full support since 2.1. Might've been possibly a little later,
but source spelunking that much back is difficult.

Mark C11 full support since 3.0, which added _Static_assert in LLVM commit
3d9cbdc3e66e274d5d3cb94ce81a65478d9baae0.
2021-02-25 18:22:10 +02:00
Raul Tambre
f112450ea0 Clang: C flags cleanup
Don't need to set the options to empty strings if not supported.
2021-02-25 18:22:10 +02:00
Brad King
4250c5f91b Merge topic 'cuda_clang_implicit'
23753be1cc Clang/CUDA: Restore needed references to implicit link variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5855
2021-02-25 09:03:07 -05:00
Brad King
6288974ba5 Merge topic 'nvhpc-minor-fixes'
72efd95add PGI: Explicitly specify CMAKE_CXX98_STANDARD_COMPILE_OPTION
6bfb2c6175 HELP: Update compile-features documentation with missing compilers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5857
2021-02-25 09:02:02 -05:00
Robert Maynard
72efd95add PGI: Explicitly specify CMAKE_CXX98_STANDARD_COMPILE_OPTION
The PGI ( and NVIDIA HPC ) compilers default C++ standard level
are based on the GCC system headers it is compiling against.

Therefore on newer platforms the default C++ level will be >= 11
and requesting C++98 compilation mode will fail as no explicit
flag will be set.
2021-02-24 13:47:03 -05:00
Raul Tambre
23753be1cc Clang/CUDA: Restore needed references to implicit link variables
In commit 4620cf77f2 (Clang: Remove unused CUDA implicit link variables,
2021-02-14) we removed some references.  It turns out they are non-empty
and necessary if using a non-scattered installation.

Fixes: #21863
2021-02-24 09:58:06 -05:00
Brad King
788f231e4c Merge topic 'nag-fortran-include-moddir'
ec030877a2 NAG: Fix using Fortran modules from their output directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5842
2021-02-23 08:06:30 -05:00
Brad King
ec030877a2 NAG: Fix using Fortran modules from their output directory
The NAG Fortran compiler's `-mdir` flag sets the module output
directory but does not add the directory to the search path for using
modules.  This is inconsistent with other compilers like the GNU Fortran
compiler's `-J` flag that does both.  In order to make these consistent,
add the module output directory with a `-I` flag on the NAG Fortran
compiler so that it will be searched when using modules too.

We already do this for the XL Fortran compiler since commit 210b0b99a9
(XL: Fix using Fortran modules from their output directory, 2020-02-28,
v3.18.0-rc1~640^2~1).
2021-02-22 09:38:12 -05:00
Brad King
b3822e6508 Merge topic 'intel-fortran-preprocess'
c9244f369a IntelLLVM: Make explicit Fortran preprocessing under Ninja more robust
056d4bf528 Merge branch 'backport-intel-fortran-preprocess'
af074c266e Intel: Make explicit Fortran preprocessing under Ninja more robust

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5826
2021-02-19 09:35:18 -05:00
Brad King
c9244f369a IntelLLVM: Make explicit Fortran preprocessing under Ninja more robust
Tell the Fortran compiler to write preprocessor output directly to a
file, as we do for the GNU compiler.  The previous "redirect stdout"
approach could break during ABI detection with some `mpif90` wrappers
that add version information to stdout when called with `-v`.

Issue: #21828
2021-02-18 07:36:32 -05:00
Brad King
056d4bf528 Merge branch 'backport-intel-fortran-preprocess' 2021-02-18 07:35:35 -05:00
Brad King
af074c266e Intel: Make explicit Fortran preprocessing under Ninja more robust
Tell the Fortran compiler to write preprocessor output directly to a
file, as we do for the GNU compiler.  The previous "redirect stdout"
approach could break during ABI detection with some `mpif90` wrappers
that add version information to stdout when called with `-v`.

Fixes: #21828
2021-02-18 07:35:12 -05:00
Brad King
ae83d2b5ff Merge topic 'cuda_cleanup'
af38d5a1d4 Platform/Windows-NVIDIA-CUDA: Remove duplicated code
4dc1c9e525 CUDA: Fix spelling __IMPLICT_ -> __IMPLICIT_
4620cf77f2 Clang: Remove unused CUDA implicit link variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5812
2021-02-16 10:44:24 -05:00
Brad King
4642c81c72 IntelLLVM: Remove incomplete C17 support
CMake does not yet model support for C17.  Avoid possible confusion by
removing the settings for IntelLLVM pending a full implementation.
2021-02-15 10:43:35 -05:00
Raul Tambre
4620cf77f2 Clang: Remove unused CUDA implicit link variables
We don't use/need implicit links for Clang with CUDA.
2021-02-14 11:38:02 +02:00
Felipe Torrezan
8ee933900e IAR: add support for the STM8 compiler 2021-02-12 06:51:05 -05:00
Brad King
b1e544dd64 Merge topic 'IntelLLVM-no-imsvc' into release-3.20
e5563e592f IntelLLVM: Remove unsupported -imsvc system include flag

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5795
2021-02-11 08:58:40 -05:00
william.r.dieter
e5563e592f IntelLLVM: Remove unsupported -imsvc system include flag
`clang-cl` supports the `-imsvc` flag to tell the compiler an include
directory is intended for system paths.  `icx` does not accept this
flag, even on MSVC platforms, so do not tell CMake that it exists.

Fixes: #21801
Signed-off-by: william.r.dieter <william.r.dieter@intel.com>
2021-02-10 07:55:00 -05:00
Brad King
691e8ac480 Merge topic 'clang-imsvc'
2fc5e5dba9 Clang: Use -imsvc for system include only with MSVC-like front-end

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Thomas Bernard <thomas@famillebernardgouriou.fr>
Merge-request: !5792
2021-02-10 07:46:33 -05:00
Brad King
2fc5e5dba9 Clang: Use -imsvc for system include only with MSVC-like front-end
In commit bb61c2d024 (Clang: use -imsvc for system include dirs when
running on Windows, 2020-09-16, v3.19.0-rc1~162^2) we added `-imsvc`
for all Clang compilers targeting the MSVC ABI.  However, the option
only exists for the MSVC-like front-end.  The GNU-like front-ends
use `-isystem`.

Fixes: #21789
2021-02-09 11:24:41 -05:00
William R. Dieter
a90d2a9eed IntelLLVM: Add support for Intel LLVM-based compilers
Using a single ID 'IntelLLVM' for the suite of Intel compilers based on
the LLVM backend.  The 'IntelLLVM' ID are used for C, C++, and Fortran.
Data Parallel C++ will be handled in a separate commit.

The C and C++ definitions are based on the Clang definitions.  The Intel
LLVM-based C and C++ compilers are based on the Clang front end, so
existing Clang options are more likely to be a good match than options
for the older Intel compilers.

Fortran is based on the older Fortran front end with the LLVM backend.
It has a similar interface to the older versions, though many options
are shared with the C and C++ compilers.

Fixes: #21561
Signed-off-by: William R. Dieter <william.r.dieter@intel.com>
2021-01-28 09:05:35 -05:00
Tin Huynh
83ea49818f NVHPC: Add support for NVIDIA HPC SDK compilers based on PGI
Identify the compilers as `NVHPC` to distinguish it from the older PGI
compilers from which they evolved, and from other `NVIDIA` compilers.

Fixes: #20887
2021-01-27 09:53:02 -05:00
Thomas Bernard
b12aec6c8d BinUtils: prefer bin utils matching the compiler version extension 2021-01-11 11:33:37 -05:00
Brad King
9109475bfb Merge topic 'cpp23'
9f3c70a333 CUDA, CXX, OBJCXX: C++23 support with Clang 12
af7e1545c8 CUDA, CXX: Remove HAS_FULL_SUPPORT for C++17 and 20

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5576
2020-12-10 07:00:17 -05:00
Brad King
9f66eb74a5 Merge topic 'ispc-system-includes' into release-3.19
8da25e4a3c ISPC: Treat system includes as '-I' includes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5591
2020-12-10 06:57:04 -05:00
Brad King
e966c23be2 Merge topic 'ispc-system-includes'
8da25e4a3c ISPC: Treat system includes as '-I' includes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5591
2020-12-10 06:57:04 -05:00
Robert Maynard
8da25e4a3c ISPC: Treat system includes as '-I' includes
ISPC doesn't have specific syntax for system includes.
2020-12-09 11:33:44 -05:00