Commit Graph

1204 Commits

Author SHA1 Message Date
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
746906242d Android: Detect NDK version number
Report it in `CMAKE_ANDROID_NDK_VERSION`.
2021-03-03 10:26:36 -05:00
Raul Tambre
af38d5a1d4 Platform/Windows-NVIDIA-CUDA: Remove duplicated code
Some of the things are set in Platform/NVIDIA-CUDA and since we aren't setting
them to different values there's no point in overriding them.
Also fixed an unset() copy-paste error.
2021-02-14 11:53:26 +02:00
Raul Tambre
4dc1c9e525 CUDA: Fix spelling __IMPLICT_ -> __IMPLICIT_ 2021-02-14 11:53:24 +02: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
Robert Maynard
657fc3a9a7 CMakeDetermineCompilerABI: Parse library arch from versioned paths
Teach CMake how to extract `CMAKE_<LANG>_LIBRARY_ARCHITECTURE` from
versioned paths such as `/usr/lib/gcc/x86_64-linux-gnu/9`. These kind of
paths are generated by NVHPC compilers.
2021-02-04 15:17:49 -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
Brad King
016c71c681 Merge topic 'intel-fortran-nofor-main'
2a5955ac09 Intel: Replace deprecated Fortran flag -nofor_main with -nofor-main

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5729
2021-01-25 11:40:14 -05:00
Brad King
2a5955ac09 Intel: Replace deprecated Fortran flag -nofor_main with -nofor-main
The `-nofor_main` flag was originally added by commit ccdd3e943d (Fix
Intel Fortran SHARED libraries on Linux, 2009-10-27, v2.8.2~915).  Since
then, Intel Fortran renamed the option to `-nofor-main` and deprecated
the old name.  The new name has been available for a long time, so
we can just switch to it.

Fixes: #21735
2021-01-22 09:38:57 -05:00
Brad King
5a1b257fe7 Merge topic 'msvc-arm64ec-platform-support'
4ea3a88625 MSVC: Add support for targeting ARM64EC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5708
2021-01-22 08:38:21 -05:00
Moyo Okeremi 😊
4ea3a88625 MSVC: Add support for targeting ARM64EC 2021-01-20 16:43:35 -08:00
Raul Tambre
acfb54bb2f Clang: Support WIN32_EXECUTABLE
Fixes #21613.
2020-12-23 12:39:09 +02:00
Brad King
41d8c20221 Merge topic 'macos-homebrew-apple-silicon'
1a5c1a68b6 macOS: Add /opt/homebrew to CMAKE_SYSTEM_PREFIX_PATH on Apple Silicon

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Fons Rademakers <fons.rademakers@cern.ch>
Merge-request: !5602
2020-12-14 07:10:04 -05:00
Brad King
1a5c1a68b6 macOS: Add /opt/homebrew to CMAKE_SYSTEM_PREFIX_PATH on Apple Silicon
According to https://brew.sh/2020/12/01/homebrew-2.6.0/ the `/opt/homebrew`
directory is recommended for installing ARM architecture brew packages.

Fixes: #21585
2020-12-11 13:07:17 -05:00
Brad King
794aa36b1f Merge topic 'apple-silicon-host-arch'
b7f0327dcd Tests: Cover macOS host architecture selection on Apple Silicon hosts
5f882f6ce5 macOS: Offer control over host architecture on Apple Silicon hosts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5589
2020-12-11 13:05:34 -05:00
Brad King
5f882f6ce5 macOS: Offer control over host architecture on Apple Silicon hosts
Since commit b6c60f14b6 (macOS: Default to arm64 architecture on Apple
Silicon hosts, 2020-09-28, v3.19.0-rc1~63^2) we use `sysctl` to detect
that we are running on Apple Silicon in a way that pierces Rosetta.
This always sets `CMAKE_HOST_SYSTEM_PROCESSOR` to be `arm64` on such
hosts.  However, macOS offers strong support for running processes under
an emulated `x86_64` architecture.

Teach CMake to select either `arm64` or `x86_64` as the host
architecture on Apple Silicon based on the architecture of its own
process.  When CMake is built as a universal binary, macOS will select
whichever slice (architecture) is appropriate under the user's shell,
and `CMAKE_HOST_SYSTEM_PROCESSOR` will match.

Also offer a `CMAKE_APPLE_SILICON_PROCESSOR` variable and environment
variable to provide users with explicit control over the host
architecture selection regardless of CMake's own architecture.

Finally, if `CMAKE_OSX_ARCHITECTURES` is not set, pass explicit flags to
the toolchain to use selected host architecture instead of letting the
toolchain pick.

Fixes: #21554
2020-12-10 12:08:13 -05:00
Brad King
76685b985d Merge topic 'explicit-LANGUAGE-flag'
48aac247e9 Compile with explicit language flag when source LANGUAGE property is set
2e67a75acd Embarcadero: Simplify addition of -P flag for C++

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5522
2020-12-04 08:27:55 -05:00
Brad King
a64f5aeea5 Merge topic 'llvm-rc-preprocess-as-c'
bdfa5ac7f6 Merge branch 'master' into llvm-rc-preprocess-as-c
f7ff0d34f0 llvm-rc: Force C language for the clang gnu frontend

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5564
2020-12-03 08:37:21 -05:00
Brad King
2e67a75acd Embarcadero: Simplify addition of -P flag for C++ 2020-12-02 10:19:16 -05:00
Brad King
9e76ad9ccd Merge topic 'ninja-deps-updates'
f8d8faff8d Ninja Generators: Homogenize configuration with Makefiles

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5557
2020-12-02 09:29:16 -05:00
Brad King
bdfa5ac7f6 Merge branch 'master' into llvm-rc-preprocess-as-c 2020-12-02 08:21:12 -05:00
Thomas Bernard
f7ff0d34f0 llvm-rc: Force C language for the clang gnu frontend
When preprocessing the rc file using the clang gnu front end we need to
force the source file type to a c file for the preprocessing to take
place.

Fixes: #21472
2020-12-02 08:19:44 -05:00
Marc Chevrier
f8d8faff8d Ninja Generators: Homogenize configuration with Makefiles
* Use same configuration variables to configure dependencies
* Abstract Ninja deps format from compiler one
2020-12-01 15:50:01 +01:00
Brad King
644f190abb Merge topic 'windows-clang-LINKER-prefix'
9ac9876757 Clang on Windows: 'LINKER:' prefix must be honored

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5551
2020-12-01 09:32:08 -05:00
Marc Chevrier
9ac9876757 Clang on Windows: 'LINKER:' prefix must be honored
Fixes: #21094
2020-11-30 15:31:45 +01: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
3401403f69 Refactoring: Introduce place-holder for dependency target.
These changes are in preparation of compiler generated dependencies support
for Makefiles generators

* compiler output and dependency target can be different for Makefiles generators
* resolve inconsistency naming for dependency file place-holder
2020-11-28 16:02:58 +01:00
Brad King
c00a6d3967 MSVC: Do not add /GR to CMAKE_CXX_FLAGS by default
The `/GR` flag has been on by default since MSVC cl 14.0 from VS 2005.
Remove it from the default flags to make it easier for projects to pass
`/GR-` themselves to turn it off.

Projects may be using string processing to replace `/GR` with another
flag, so we cannot simply drop it.  Add a policy to drop it in a
compatible way.

Fixes: #21428
2020-11-13 11:46:23 -05:00
Brad King
6114c8e994 MSVC: Factor out initialization of /GR flag 2020-11-13 10:50:25 -05:00
Haibo Huang
3a2bb717ee Android: load ABI information from abis.cmake
They are added to NDK and planned to release in r23:
https://android-review.googlesource.com/c/platform/ndk/+/1493421
2020-11-11 17:11:45 -08:00
Brad King
566ad7c61e Merge topic 'android-abi'
a585b75df9 Android: Use NDK_KNOWN_DEVICE_ABI{32,64}S instead of NDK_DEFAULT_ABIS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5488
2020-11-11 09:33:02 -05:00
Haibo Huang
a585b75df9 Android: Use NDK_KNOWN_DEVICE_ABI{32,64}S instead of NDK_DEFAULT_ABIS
Revise logic from commit 1ab574a0f4 (Android: Add support for NDK r22,
2020-10-07, v3.19.0-rc1~18^2) that loads ABI tables from the NDK.

`NDK_DEFAULT_ABIS` means the abis to build by default.
Use `NDK_KNOWN_DEVICE_ABI{32,64}S` instead.

In practise they have never been different. Fix to make it more precise.
2020-11-10 11:05:36 -08:00
Brad King
f4f3fca99f Merge topic 'android-root'
cbc51a8be3 Android: restructure android search paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: huangqinjin <huangqinjin@gmail.com>
Merge-request: !5479
2020-11-10 09:42:31 -05:00
Haibo Huang
cbc51a8be3 Android: restructure android search paths
1. Set CMAKE_FIND_ROOT_PATH unconditionally.

Revise the implementation from commit a7f41a7ee4 (Android: Fix find_*
search order within NDK for unified toolchains, 2020-10-13).  In the old
implementation, if people set CMAKE_FIND_ROOT_PATH, CMAKE_ANDROID_NDK
won't be added to find root. And all paths added to CMAKE_SYSTEM_*_PATH
below will be rerooted to the user specified root.

2. Add api level specific library path to CMAKE_SYSTEM_PREFIX_PATH.

As the discussion in [1], some people want the paths added by
UnixPaths.cmake. They install their libraries according to
GNUInstallDirs [2].

As a result, we cannot clear CMAKE_SYSTEM_PREFIX_PATH. It includes /usr
so no matter what we specify in CMAKE_SYSTEM_LIBRARY_PATH,
/usr/lib/<arch> will be searched first.

The author also pointed out a way to solve this issue [3]. In addition
to other paths, CMake also searches <root>/<prefix> [4]. So we can add
the API specific lib path to the beginning of CMAKE_SYSTEM_PREFIX_PATH,
to have it searched first.

[1] https://android-review.googlesource.com/c/platform/ndk/+/1486800
[2] https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
[3] https://github.com/android/ndk/issues/1179#issuecomment-613435081
[4] 11425041f0/Source/cmSearchPath.cxx (L202)
2020-11-09 08:15:46 -05:00
Brad King
d0391599a8 Merge topic 'android-flags'
94d87afece Android: allow NDK to control cflags / ldflags
85e5139aba Android: Move *_LLVM_TRIPLE to the centralized table

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5461
2020-11-09 07:58:49 -05:00
Brad King
7b6a9ac8e7 Merge topic 'android-build-type'
3dae826e43 Android: default to RelWithDebInfo

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5465
2020-11-06 08:03:27 -05:00
Brad King
e0438b05de Merge topic 'apple-v4-tbd-file-arch-lookup'
4c6797e03e Apple: Update SDK architecture detection for tbd file version 4

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5470
2020-11-06 07:58:55 -05:00
Haibo Huang
94d87afece Android: allow NDK to control cflags / ldflags 2020-11-05 19:45:28 -08:00
Haibo Huang
85e5139aba Android: Move *_LLVM_TRIPLE to the centralized table
This allows us to skip `abi-*.cmake` in the next change.
In the future we may move all this information to the NDK.
2020-11-05 19:45:09 -08:00
Tor Arne Vestbø
4c6797e03e Apple: Update SDK architecture detection for tbd file version 4
Extend the `.tbd` parsing from commit 170e598add (iOS: Fix detection of
supported SDK architectures, 2020-04-16, v3.17.2~11^2) to support `.tbd`
file version 4.
2020-11-05 10:21:23 -05:00
Haibo Huang
3dae826e43 Android: default to RelWithDebInfo 2020-11-04 14:20:13 -08:00
Haibo Huang
4dca078829 Android: Link c++abi and android_support when necessary
For older NDKs we used `__android_stl_lib` to link these libraries, but
the `CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED` code path does not use that.
Link the libraries the way the NDK toolchain file does:

  43b2de34ef/build/cmake/android.toolchain.cmake (368)
2020-11-04 14:21:26 -05:00
Haibo Huang
738caa4d48 Android: Add options to control exceptions/rtti
With the NDK's `android.toolchain.cmake`, the user can control whether
exceptions/rtti is enabled using `ANDROID_CPP_FEATURES`:

  43b2de34ef/build/cmake/android.toolchain.cmake (548)

Add `CMAKE_ANDROID_RTTI` and `CMAKE_ANDROID_EXCEPTIONS` to support that.
2020-11-04 14:18:03 -05:00
Haibo Huang
707a06761f Android: add NDK hooks
This change adds hooks to key Android support files, so that NDK can
inject information or change cmake behaviors.
2020-10-29 17:52:41 -07:00
Thomas Bernard
ea03f50842 llvm_rc: add llvm_rc option filter to correctly pick up all options
Fixes: #21315
2020-10-28 07:19:31 -04:00
Haibo Huang
a7f41a7ee4 Android: Fix find_* search order within NDK for unified toolchains 2020-10-23 09:36:48 -04:00
Haibo Huang
5cdf37e4cc Android: Root searches within the NDK for unified toolchains
Set `CMAKE_FIND_ROOT_PATH_MODE_*` appropriately.
2020-10-23 09:36:40 -04:00
Haibo Huang
8e4aa63c7b Android: show supported API level in error message 2020-10-13 08:40:44 -04:00