Commit Graph

584 Commits

Author SHA1 Message Date
Brad King
ba216592fc Merge topic 'cuda_language'
f75bea1071 CUDA: Abstract language flag to compiler modules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4464
2020-03-13 10:43:57 -04:00
Brad King
2ca34f0685 Merge topic 'apple-clang-flags-c++17'
a67f2d00d8 Apple Clang: add flags for C++17 standard

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4468
2020-03-12 09:33:19 -04:00
Marc Chevrier
a67f2d00d8 Apple Clang: add flags for C++17 standard 2020-03-12 08:09:12 -04:00
Raul Tambre
f75bea1071 CUDA: Abstract language flag to compiler modules
Separate this detail out into compiler-specific modules.
Required for Clang support, as it uses slightly different language flags.
2020-03-11 21:30:09 +02:00
Oliver Blasius
5a0fc68312 TI: Fix C toolchain command-lines
Fix `armar` arguments.  Fix the linker `--map_file=` argument.
Enable response files.
2020-03-09 12:02:20 -04:00
Brad King
210b0b99a9 XL: Fix using Fortran modules from their output directory
The XL Fortran compiler's `-qmoddir=` 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 XL Fortran
compiler so that it will be searched when using modules too.

This fixes our `FortranModules` test's coverage of submodules on
Ninja + XL.  That test places module files in a subdirectory that with
Ninja is not the current working directory when the compiler runs.

Fixes: #20400
2020-02-28 10:37:11 -05:00
Brad King
1d338dcf46 Merge topic 'cuda-non-device-link' into release-3.17
7da2c8c543 Merge branch 'backport-cuda-non-device-link'
738f3f23aa Ninja: Do not use nvcc response files with non-nvcc tools

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !4376
2020-02-25 08:54:45 -05:00
Brad King
64ed4f6f99 Merge topic 'cuda-non-device-link'
7da2c8c543 Merge branch 'backport-cuda-non-device-link'
738f3f23aa Ninja: Do not use nvcc response files with non-nvcc tools

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robert.maynard@kitware.com>
Merge-request: !4376
2020-02-25 08:54:45 -05:00
Brad King
7da2c8c543 Merge branch 'backport-cuda-non-device-link' 2020-02-24 13:34:13 -05:00
Francisco Facioni
738f3f23aa Ninja: Do not use nvcc response files with non-nvcc tools
Since commit d91b5a72cd (Ninja: Add support for CUDA nvcc response
files, 2019-05-30, v3.15.0-rc1~8^2) we use NVCC's `--options-file`
option to avoid long link command lines via a response file.  However,
for non-device linking the host tools are used and the option does not
make sense.  Update the logic to use `--options-file` only for device
linking.  Linking with the host tools already has its own logic for
response files.

Fixes: #19954
2020-02-24 13:31:33 -05:00
Sergey Larin
5c6d6ec27c PCH: Clang: Update PCH usage flags to include original header
Add an additional include flag to PCH usage command line to fix programs
that rely on `compile_commands.json` file. Pass it to the preprocessor
directly to avoid compiler driver to change it to '-include-pch'.

When preprocessor is requested to preprocess a file, it tries to get
the original filename from '.pch' and uses that file for preprocessing.
CMake generates a '.pch' file from the '.hxx' file by passing an empty
'.cxx' source file to the compiler as a compilation unit and the header
file with the '-include' flag. After that, compiler puts compilation
unit filename in the '.pch' as the original filename.

However, CMake build system uses empty file as the source file and
passes the header file using '-include-pch' flag. As a result, Clang
uses the wrong file for preprocessing and produces the corrupted
preprocessed file.

Fixes: #20355
Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
2020-02-24 10:53:39 -05:00
Brad King
193352e420 Merge topic 'clang-tidy-driver-mode'
f6f4eb0907 clang-tidy: Add driver mode argument

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4208
2020-01-28 11:01:19 -05:00
Brad King
571205fb6b Merge topic 'QNX_CMAKE_SYSROOT'
32a6ab1f3b QNX: Add support for CMAKE_SYSROOT

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4277
2020-01-28 10:56:41 -05:00
Robert Maynard
0d0145138f CUDA: Add abstraction for cuda runtime selection
Fixes #17559
Replace our hard-coded default of cudart=static with a first-class abstraction to select the runtime library from an enumeration of logical names.
2020-01-27 16:02:26 -05:00
Stephen Kelly
32a6ab1f3b QNX: Add support for CMAKE_SYSROOT
QCC is a wrapper around GCC, but it is not a fully transparent wrapper.
Some compile options need to be passed to GCC using a `-Wc` option.

QCC does not support --sysroot, so setting CMAKE_SYSROOT in a toolchain
file currently does not work.  This means that it is likely that no one
is setting CMAKE_SYSROOT in existing QNC toolchain files.  Override the
GCC option for sysroot in the QCC.cmake file with -Wc,-isysroot.

This exposes a further issue in that the QNX SDK does not follow the
same architectural folder structure as linux uses.  That is, on linux
systems, architecture-specific libraries might be in

    <sysroot>/usr/lib/<arch>

such as

    /usr/lib/x86_64-linux-gnu/libcurl.so

CMake models this by suffixing the <arch> onto lib directories when
searching for libraries.

The QNX SDK is structured differently such that the <arch> should be
used as a prefix:

    <sysroot>/<arch>/usr/lib

such as

    <sysroot>/x86_64/usr/lib/libcurl.so

Add a variable for platform configuration to set whether to prefix or
suffix the <arch> and set that in the QCC.cmake.

Use the directory structure of the QNX SDK to compute the <arch> from
the implicit library directories.  The assumption is that the arch will
be a single directory directly below the CMAKE_SYSROOT, below which the
usr/ prefix occurs.

It would not be appropriate to instruct users to make the <arch> part of
the sysroot when specified in the toolchain file because:

1.  That would be non-DRY - The QCC wrapper already determines the <arch>
    by the -V argument passed to the compiler, specified in the toolchain
    file as the CMAKE_C_COMPILER_TARGET variable.
2.  The includes in the QNX SDK are not below the <arch> directory.

So, the location of the <arch> in the full path is different on QNX
compared to, say an embedded linux platform, but the intent is the same.

Add documentation to recommend the use of CMAKE_SYSROOT in a QNX
toolchain file.

As the CMAKE_SYSROOT is always the same for QNX, it would be possible to
simply set it in QCC.cmake.  However, that would change behavior for
existing users as when CMAKE_SYSROOT is set, files/paths outside of the
CMAKE_SYSROOT do not get found.

The <arch> prefixing is only enabled in cmSearchPath.cxx if
CMAKE_SYSROOT is set.  This ensures that the user gets consistency in
the current state without CMAKE_SYSROOT, and gets better consistency
when using CMAKE_SYSROOT.
2020-01-27 14:04:56 -05:00
Hanjiang Yu
f6f4eb0907 clang-tidy: Add driver mode argument
`clang-tidy` does not infer driver mode if it is not provided with a
JSON compilation database.  This is exactly the way cmake launches it.
Hence clang-tidy will only use the default driver mode.  Add an explicit
driver mode argument to avoid this.
2020-01-27 13:59:05 -05:00
Brad King
b2edb72642 Merge topic 'nag-submodule'
f7f60ddcf9 Fortran: Add support for NAG Fortran submodules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4229
2020-01-16 10:56:03 -05:00
Neil Carlson
f7f60ddcf9 Fortran: Add support for NAG Fortran submodules
They use a `.sub` extension.

Fixes: #20220
2020-01-15 14:12:22 -05:00
Brad King
24d143e0f6 Merge topic 'objc-visibility-inlines'
7347e2f830 ObjC: Add VISIBLITY_INLINES_HIDDEN support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4199
2020-01-13 10:22:06 -05:00
Cristian Adam
7347e2f830 ObjC: Add VISIBLITY_INLINES_HIDDEN support
Fixes: #20193
2020-01-10 16:31:27 +01:00
Raul Tambre
7560c68f2c CUDA: Fix compiler option version checks for nvcc 10.2.19 2020-01-03 14:15:03 +02:00
Robert Maynard
2467a2b318 CUDA: Add cuda meta-features (e.g. `cuda_std_11`) support 2019-12-10 17:56:48 -05:00
Brad King
b2634d639b Merge topic 'cuda_updates_for_10.2'
5341f5e4a1 CUDA: get header deps from compiler invocation when possible
7f15c99851 CUDA: forward unknown flags to host compiler when possible.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4099
2019-12-09 11:21:58 -05:00
Brad King
a795aa145c Merge topic 'pch-xcode-no-warning'
df8372da09 PCH: Do not add #pragma system_header for Xcode generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4098
2019-12-05 11:39:24 -05:00
Cristian Adam
df8372da09 PCH: Do not add #pragma system_header for Xcode generator
Fixes: #20039
2019-12-04 12:56:53 -05:00
Robert Maynard
5341f5e4a1 CUDA: get header deps from compiler invocation when possible
Before CUDA 10.2 `nvcc` didn't support providing header dependency
information while compiling.
2019-11-29 14:21:35 -05:00
Robert Maynard
7f15c99851 CUDA: forward unknown flags to host compiler when possible.
Starting with CUDA 10.2 the nvcc compiler has gained support
to automatically forward unknown flags to the host compiler.

This behavior is highly desired as projcts that mix CUDA, C, C++
run into situation where flags such as `-pthread` which aren't
supported by nvcc, are being applied to all source files and
therefore break CUDA compilation.
2019-11-29 14:21:35 -05:00
Brad King
19f267c75e XL: Add support for Ninja and XL Fortran
The Ninja generator's support for Fortran requires that source files
be preprocessed explicitly first.  However, the `xlf` compiler does
not have a simple `-E` option or equivalent to do preprocessing.
The only documented way to get preprocessed output is to use `-d`
to leave it behind, but only at an inflexible location.

Instead, create our own `cpp` wrapper script and substitute it for the
real preprocessor using `-tF -B ...`.  Teach the wrapper to map the
`cpp` output to the location we need and then invoke the real `cpp`
underneath.

Fixes: #19450
2019-11-21 15:59:12 -05:00
Brad King
0f1458022d Merge topic 'revert-FindBinUtils-ask-compiler' into release-3.16
b2857514b0 FindBinUtils: Revert "Use the compiler to get the path to compiler tools"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4009
2019-11-08 09:41:05 -05:00
Brad King
9f7ca15de6 Merge topic 'revert-FindBinUtils-ask-compiler'
b2857514b0 FindBinUtils: Revert "Use the compiler to get the path to compiler tools"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4009
2019-11-08 09:41:05 -05:00
Brad King
b2857514b0 FindBinUtils: Revert "Use the compiler to get the path to compiler tools"
Revert commit b2fd479df5 (FindBinUtils: Use the compiler to get the path
to compiler tools, 2019-09-22, v3.16.0-rc1~51^2).  The compiler's answer
may incorrectly come from the `PATH`.  Another approach will be needed.

Fixes: #19934
2019-11-07 10:31:02 -05:00
Brad King
13ea5f06fa Merge topic 'objc-pch'
e331367a89 PCH: Add support for OBJC/OBJCXX languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3983
2019-11-05 11:24:55 -05:00
Cristian Adam
e331367a89 PCH: Add support for OBJC/OBJCXX languages 2019-11-03 21:34:39 +01:00
Alex Turbov
7b2dd9dedc Refactor: Use added message types in various modules
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2019-11-02 14:10:09 +02:00
Micael Borgefeldt
5652e11ea1 IAR: Add 8051 support
Issue: #17264
2019-10-11 10:22:52 -04:00
Micael Borgefeldt
6e51db9a40 IAR: Fix v850 assembler support file extensions
Fix the file extension added by commit 158f3795b8 (IAR: Add v850
assembler support, 2019-09-23, v3.16.0-rc1~70^2).

Issue: #17264
2019-10-11 10:22:52 -04:00
Cristian Adam
bc4f8f4472 PCH: Use clang's own pch functionality instead of the GCC emulation
Fixes: #19786
2019-10-03 14:43:00 +02:00
Brad King
9b03baee30 Merge topic 'objective-c-cxx'
dd0f304613 Objective C/C++: Add compiler standard detection
b515af782b Help: Add release note for Objective-C/C++ language support
9e66397c28 Languages: Add support for Objective-C++
80f120a85f Languages: Add support for Objective-C

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3811
2019-09-30 10:25:19 -04:00
Steve Wilson
9e66397c28 Languages: Add support for Objective-C++
Add entries in Modules and Modules/Platform to support
Objective-C++ compiler determination and identification.
Add Modules to check Objective-C++ compiler flags, source
compilations, program checks, etc...

Use OBJCXX as the designator of the language, eg:

project(foo OBJCXX)

Add various tests for Objective-C++ language features.  Add
tests to preserve C++ handling of .M and .mm files when
Objective-C++ is not a configured language.

Co-authored-by: Cristian Adam <cristian.adam@gmail.com>
2019-09-28 15:56:53 +02:00
Steve Wilson
80f120a85f Languages: Add support for Objective-C
Add entries in Modules and Modules/Platform to support
Objective-C compiler determination and identification.
Add Modules to check Objective-C compiler flags, source
compilations, program checks, etc...

Use OBJC as the designator of the language, eg:

project(foo OBJC)

Add various tests for Objective-C language features.  Add
tests to preserve C++ handling of .m and .mm files when
OBJC is not a configured language.

Co-Authored-By: Cristian Adam <cristian.adam@gmail.com>
2019-09-28 15:56:46 +02:00
Brad King
c88cf48bbe Merge topic 'FindBinUtils-ask-compiler'
b2fd479df5 FindBinUtils: Use the compiler to get the path to compiler tools
587ccffe74 Tests: Add symbols to FortranModules static libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !3854
2019-09-27 14:56:53 -04:00
Isuru Fernando
b2fd479df5 FindBinUtils: Use the compiler to get the path to compiler tools
Fixes: #19728
2019-09-26 19:11:00 -05:00
Nico Mueller
158f3795b8 IAR: Add v850 assembler support
Assembler compiler configuration for 'v850' architecture

Issue: #17264
2019-09-23 13:14:14 +02:00
Nico Mueller
bd5006e813 IAR: Add v850 support
Add compiler identification for V850.

Issue: #17264
2019-09-16 11:07:04 -04:00
Brad King
fb9da8e6f4 Ninja: Pass preprocessor definitions when compiling with Intel Fortran
The Intel Fortran compiler supports an extension that allows conditional
compilation based on preprocessor definitions specified on the command
line even when not preprocessing.

Fixes: #19664
2019-09-03 14:20:26 -04:00
Cristian Adam
b8626261e9 Precompile headers: Add methods to generate PCH sources
Co-Author: Daniel Pfeifer <daniel@pfeifer-mail.de>
2019-08-28 11:47:40 -04:00
Brad King
76891a4a7a Merge topic 'CrayPrgEnv-update-link-type-detection'
971c778213 CrayPrgEnv: Change default linking mode based on PE version

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3716
2019-08-23 10:05:52 -04:00
Chuck Atkins
971c778213 CrayPrgEnv: Change default linking mode based on PE version
Beginning with the 19.06 release of the Cray Programming Environment, the
default linking mode on XC Cray systems is dynamic instead of static.
This updates the CrayPrgEnv compiler wrappers to detect the PE version
being used and behave accordingly.
2019-08-22 12:26:06 -04:00
Robert Maynard
a233e4e7d9 CUDA: Compilers can now state they don't require a device linking step 2019-08-06 15:44:15 -04:00
Brad King
5cfc39127e Merge branch 'backport-clang-gnulike-support' into clang-gnulike-support 2019-07-24 08:00:53 -04:00