Commit Graph

1131 Commits

Author SHA1 Message Date
Saleem Abdulrasool
444dbd40de Darwin: honour CMAKE_OSX_SYSROOT more faithfully
The libraries in the SDK should be given precedence over the system
libraries.  Check for the default library search path (in default order)
of `/usr/lib` and `/usr/local/lib` and use these as system prefix paths
for libraries when performing the link step against a specified SDK.
2020-05-30 20:32:38 -07:00
Brad King
a7b3102e00 Merge topic 'support_conda_env'
50879ce412 Conda: Add CONDA_PREFIX as an acceptable system prefix path
cd9c3c000f Tests: Update QtAutogen codeeditor test only include headers needed
d806bd2e8c Tests: Update test suite to run in an Anaconda environment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4773
2020-05-22 08:12:24 -04:00
Brad King
d8eee80e30 Merge branch 'backport-cuda-default-runtime' into cuda-default-runtime 2020-05-22 06:50:19 -04:00
Robert Maynard
50879ce412 Conda: Add CONDA_PREFIX as an acceptable system prefix path 2020-05-21 11:32:36 -04:00
Robert Maynard
e55b21e24e CUDA: Compute CMAKE_CUDA_RUNTIME_LIBRARY default from toolchain
Since commit 0d0145138f (CUDA: Add abstraction for cuda runtime
selection, 2019-11-29, v3.17.0-rc1~83^2) we add CUDA runtime library
selection flags by default.

To maintain backwards compatibility the default CUDA runtime
library needs to be computed based on what libraries are found
on the initial compiler invocation. For example a toolchain
could establish initial flags that have all CUDA compilations
using the runtime version, and if we don't detect this we will
try to link to both the static and shared runtime.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #20708
2020-05-21 11:15:03 -04:00
Craig Scott
ddcc5a350c Merge topic 'doc-CMAKE_SYSTEM_PREFIX_PATH'
6b3d8f281e Document which environment variables effect CMAKE_SYSTEM_PREFIX_PATH

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4748
2020-05-20 06:28:11 -04:00
Robert Maynard
6b3d8f281e Document which environment variables effect CMAKE_SYSTEM_PREFIX_PATH 2020-05-19 10:57:09 -04:00
Raul Tambre
5df21adf46 CUDA: Add support for Clang compiler
When crosscompiling we pass the sysroot.

We need to try various architecture flags. Clang doesn't automatically
select one that works.  First try the ones that are more likely to work
for modern installations:

* <=sm_50 is deprecated since CUDA 10.2, try sm_52 first for
          future compatibility.
* <=sm_20 is removed since CUDA 9.0, try sm_30.

Otherwise fallback to Clang's current default. Currently that's `sm_20`,
the lowest it supports.

Separable compilation isn't supported yet.

Fixes: #16586
2020-05-15 17:46:51 +03:00
Brad King
91dd23d3d5 Merge topic 'pch-msvc-pragma' into release-3.17
6c2514dabe MSVC: Use 'pragma system_header' in PCH only on cl 19.13 and above

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4736
2020-05-12 06:52:40 -04:00
Brad King
cd89ebdda2 Merge topic 'pch-msvc-pragma'
6c2514dabe MSVC: Use 'pragma system_header' in PCH only on cl 19.13 and above

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4736
2020-05-12 06:52:40 -04:00
Brad King
6c2514dabe MSVC: Use 'pragma system_header' in PCH only on cl 19.13 and above
VS 2017 15.6 introduced support for this pragma.  Older MSVC versions
warn that it is unknown.

Fixes: #20692
2020-05-11 13:31:15 -04:00
Jiri Malak
4adfd2a3aa OpenWatcom: Add cross-compilation support for Windows
Add system header files directories for cross-compilation
2020-05-06 13:10:43 -04:00
Jiri Malak
43c3243c2d OpenWatcom: Fix Linux support file
Fix CMAKE_SHARED_LINKER_FLAGS_INIT macro
Fix executable file name for Linux to be without extension
Add system header files directory for cross-compilation
2020-05-06 13:09:58 -04:00
Jiri Malak
d26eea220a OpenWatcom: Add OS/2 target support
OS/2 16-bit and 32-bit target support files for cross-compilation by
OpenWatcom.

It is used if CMAKE_SYSTEM_NAME=OS2 is defined.

If CMAKE_SYSTEM_PROCESSOR=I86 is defined then 16-bit OS/2 target is
used, otherwise 32-bit OS/2 target is used.
2020-05-06 13:09:28 -04:00
Jiri Malak
0ab583d787 OpenWatcom: Add DOS target support
DOS 16-bit and 32-bit target support files for cross-compilation by
OpenWatcom.

It is used if CMAKE_SYSTEM_NAME=DOS is defined.

If CMAKE_SYSTEM_PROCESSOR=I86 is defined then 16-bit DOS target is used,
otherwise 32-bit DOS target is used.
2020-05-06 13:09:00 -04:00
Jiri Malak
4197aadecb OpenWatcom: Add Linux support
It is native Linux support for Linux host executable only (only static
library support, no shared library support).
2020-04-29 07:56:15 -04:00
Jiri Malak
7aa9e89b1c OpenWatcom: Move non-Windows settings to Modules/Compiler
Restructure OpenWatcom toolchain support files to simplify adding of new
targets DOS, OS/2 and Linux including cross-compilation.
2020-04-28 09:36:04 -04:00
Marc Chevrier
4248bb452a CUDA: Device linking use now link options
properties LINK_OPTIONS and INTERFACE_LINK_OPTIONS are propagated
to the device link step.

To control which options are selected for normal link and device link steps,
the $<DEVICE_LINK> and $<HOST_LINK> generator expressions can be used.

Fixes: #18265
2020-04-19 15:53:11 +02:00
Brad King
ea2f95f4b9 Merge topic 'ios_multi_arch_fix'
170e598add iOS: Fix detection of supported SDK architectures

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Merge-request: !4615
2020-04-17 08:07:29 -04:00
Alexandru Croitor
170e598add iOS: Fix detection of supported SDK architectures
Instead of relying on SDKSettings.plist which does not contain the
certain architectures, deduce the supported architectures by
inspecting libSystem.tbd and libSystem.dylib.

.tbd files are text files, so just parse out the archs string.
.dylib files can be fat or non-fat, so use lipo -info to extract
the architectures and parse lipo output.

Fixes: #20588
2020-04-16 07:51:03 -04:00
Brad King
5e70315fa8 Merge topic 'support_pseudo_sysroots'
8cc384f629 Compilers: Add paths from -print-sysroot to system prefix path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4585
2020-04-15 09:53:08 -04:00
Robert Maynard
8cc384f629 Compilers: Add paths from -print-sysroot to system prefix path 2020-04-14 13:48:28 -04:00
Brad King
da25220d83 Merge branch 'backport-3.17-apple-arch-sysroots' into apple-arch-sysroots 2020-04-08 13:44:42 -04:00
Brad King
45fa9b32ca Apple: Improve handling of missing SDKs in CMAKE_APPLE_ARCH_SYSROOTS
Use `<arch>-SDK-NOTFOUND` instead of an empty string as a placeholder in
`CMAKE_APPLE_ARCH_SYSROOTS` for architectures whose SDK is not found.
This ensures the length of `CMAKE_APPLE_ARCH_SYSROOTS` matches the
length of `CMAKE_OSX_ARCHITECTURES`.  It also makes the missing SDKs
more visible in the value.

Issue: #20534
2020-04-08 11:51:02 -04:00
Brad King
c0438d272d Merge topic 'llvm-rc-include-path'
35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4570
2020-04-07 08:00:45 -04:00
Thomas Bernard
35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing
Since commit 1c2d031cbd (Add -E cmake_llvm_rc to preprocess files for
llvm-rc, 2020-01-14, v3.17.0-rc1~24^2) with llvm-rc we explicitly
preprocess RC source files and then compile separately without -I flags.
This broke cases where the RC source references data files adjacent to
itself or in the include path.

This change adds the expansion of the include paths when calling the
llvm-rc in order for the resource files to be picked up correctly by
llvm-rc.  Since the RC compiled file is first preprocessed, the file
being compiled by llvm-rc resides in the build directory. In order for
llvm-rc to find the resource data specified relative to the .rc file
being compiled, the source file path is preppended in the include list
so that the original source path takes priority over all the other
includes paths specified.

A space was added in the CMAKE_INCLUDE_FLAG_RC to make the include
directive work properly for llvm-rc. Checks on the rc.exe showed that
the syntax change doesn't affect it's proper operation.

Fixes: #20529
2020-04-06 21:19:12 +02:00
Brad King
0188df97e8 Merge topic 'llvm_rc_pp'
4bef0e6450 llvm-rc: Enable preprocessing if CMAKE_RC_COMPILER_INIT is an absolute path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4535
2020-03-30 13:22:02 -04:00
Lucas Wang
4bef0e6450 llvm-rc: Enable preprocessing if CMAKE_RC_COMPILER_INIT is an absolute path
`CMAKE_RC_COMPILER_INIT` and `CMAKE_RC_COMPILER` can be set by user,
for example `llvm-rc-10` and `D:\LLVM\bin\llvm-rc.exe`.
2020-03-27 08:54:58 -04:00
Brad King
ab96bbff2c Merge topic 'llvm-rc-depfile'
2c724c3aea llvm-rc: Write depfile to location specified by the generator
4cc876540e llvm-rc: Select preprocessor from active languages

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4524
2020-03-27 07:38:22 -04:00
Brad King
6257d43ffd Merge topic 'compile-commands-collapse-whitespace'
e565053bce Ninja: Remove unnecessary newlines in compile commands
5d4bab500e Avoid consecutive whitespace in rules
d8622fbd0f Modules: Collapse consecutive whitespace in strings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4512
2020-03-26 09:13:45 -04:00
Thomas Bernard
2c724c3aea llvm-rc: Write depfile to location specified by the generator
Move the depfile flags to `CMAKE_DEPFILE_FLAGS_RC` so that they
are only usedwith generators that use depfiles.  Also switch to
using the `<DEPFILE>` placeholder for the location of the depfile
so that it goes where the generator expects.

Fixes: #20493
2020-03-26 07:26:21 -04:00
Thomas Bernard
4cc876540e llvm-rc: Select preprocessor from active languages
The llvm-rc preprocessor is selected according to the
CMAKE_C_COMPILER_ID / CMAKE_CXX_COMPILER_ID which are only defined when
the C or CXX language is active.
2020-03-26 07:25:33 -04:00
Brad King
af4adf6aa9 MinGW: Fix default windres selection when cross-compiling
When cross-compiling to MinGW, select the `windres` tool named with the
toolchain's prefix.

Fixes: #20500
2020-03-25 07:21:01 -04:00
Brad King
0251ddadab MinGW: Drop unnecessary windres selection code with Unix Makefiles
Since commit 957c2aac7f (RC: Simplify selection of resource compiler
based on C/C++ toolchain, 2015-05-07, v3.3.0-rc1~93^2~5) we select
windres as the RC compiler on MinGW via `CMAKE_RC_COMPILER_INIT`.  Drop
the special case from commit be9afbf453 (Find mingw's windres also when
Unix Makefiles are used, 2012-08-27, v2.8.10~152^2).
2020-03-25 07:21:01 -04:00
Daan De Meyer
d8622fbd0f Modules: Collapse consecutive whitespace in strings 2020-03-23 21:34:17 +01: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
Brad King
022a935f3a Merge topic 'msvc-librarian'
55196a1440 MSVC: Use 'lib' instead of 'link /lib' to create static libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4409
2020-03-04 08:28:01 -05:00
Francisco Facioni
55196a1440 MSVC: Use 'lib' instead of 'link /lib' to create static libraries
`link.exe /lib` is an undocumented flag and it just calls `lib.exe`.
Also `link.exe` doesn't parse the `/lib` option correctly when in a
response file.
2020-03-03 08:31:13 -05:00
Thomas Bernard
ee70c5de4d llvm-rc: Forward DEFINES instead of FLAGS
Since commit 1c2d031cbd (Add -E cmake_llvm_rc to preprocess files for
llvm-rc, 2020-01-14, v3.17.0-rc1~24^2) we pass the full target `<FLAGS>`
to the llvm-rc resource compiler, but we should pass only `<DEFINES>`.

Fixes: #20414
2020-03-03 08:12:25 -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
Yauheni Khnykin
5c2a92f44f Swift: Exclude SDK include paths
Populate `CMAKE_Swift_IMPLICIT_INCLUDE_DIRECTORIES` with the macOS SDK's
include directory so that we filter such implicit directories out of
Swift targets.

Fixes: #19845
2020-02-10 10:32:37 -05:00
Brad King
94be195a54 Merge topic 'llvm-rc-preprocess'
1c2d031cbd Add -E cmake_llvm_rc to preprocess files for llvm-rc

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4219
2020-02-05 09:10:16 -05:00
Brad King
b27004231d Merge topic 'sdcc-no-default-target'
18d2e6fc8f SDCC: Remove default flags for a specific target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4321
2020-02-05 09:08:13 -05:00
Brad King
a8bcfddb2b Merge topic 'android-ndk-r19-binutils'
e3d3b7ddeb Android: Fix binutils selection with NDK r19+ unified toolchain

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4318
2020-02-04 08:26:40 -05:00
Brad King
24d57c2257 Merge topic 'android-ndk-r19-binutils' into release-3.16
e3d3b7ddeb Android: Fix binutils selection with NDK r19+ unified toolchain

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4318
2020-02-04 08:26:39 -05:00
Thomas Bernard
1c2d031cbd Add -E cmake_llvm_rc to preprocess files for llvm-rc
llvm-rc requires preprocessed rc files. The CMake command line tool
cmake_llvm_rc enables channing the preprocessor call and the resource
compiler and make this appear as single compilation step.

When llvm-rc is detected as resource compiler, the RC compilation step
is set to use this command.
2020-02-04 08:19:12 -05:00
fruit
18d2e6fc8f SDCC: Remove default flags for a specific target
Remove defaults for a specific target (8051) because they are incorrect
for other targets.

Fixes: #20308
2020-02-04 07:25:24 -05:00
Brad King
e3d3b7ddeb Android: Fix binutils selection with NDK r19+ unified toolchain
In commit 97bca2f9fa (Android: Use unified toolchain in NDK r19+,
2019-07-26, v3.16.0-rc1~342^2) we hard-coded use of the unified
toolchain for NDK r19+ and skipped most of the old detection logic.
However, in that fast path we left out setting `_CMAKE_TOOLCHAIN_PREFIX`
for `CMakeFindBinutils` to select the matching binutils.  Add it.

Fixes: #20038
2020-02-03 14:35:12 -05:00
Brad King
b81aef19de Merge topic 'windows-gnu-asm'
97de48b528 Tests: Update Assembler code generation to select MSVC runtime library
6348ffb9e5 ASM: Hook up Windows-specific GNU/Clang compiler information modules

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4287
2020-02-03 11:51:34 -05:00
Martin Storsjö
6348ffb9e5 ASM: Hook up Windows-specific GNU/Clang compiler information modules
This allows building .s/.S assembly code, and makes sure that the
`-fPIC` option isn't passed to the compiler (as it errors out on
Clang and causes a loud warning on GCC).
2020-01-31 14:37:34 -05:00