summaryrefslogtreecommitdiff
path: root/Modules/CMakeCUDACompiler.cmake.in
Commit message (Collapse)AuthorAgeFilesLines
* Link step: use linker dependency linker fileMarc Chevrier2023-05-031-0/+1
| | | | | | Based on work done by @ben.boeckel (!8051) Fixes: #22217
* CUDA: Add support for CUDA_ARCHITECTURES=nativeBrad King2022-03-101-0/+1
| | | | | | | | | | | CUDA 11.6 added the `nvcc -arch=native` flag to automatically compile for the host GPUs' architectures. Add support for specifying this special `native` value in `CMAKE_CUDA_ARCHITECTURES` and `CUDA_ARCHITECTURES`. During the compiler ABI detection step, detect the native architectures so we can pass them explicitly when using Clang or older versions of nvcc. Fixes: #22375
* CUDA: Generic all and all-major supportRaul Tambre2022-02-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags, 2021-08-17) added all and all-major options to CUDA_ARCHITECTURES. These are fairly generic and likely to see real-world use by distributors. Thus it's desirable to support these also for Clang and older NVCC versions. The supported architectures are dependent on the toolkit version. We determine the toolkit version prior to compiler detection. For NVCC we get the version from the vendor identification output, but for Clang we need to invoke NVCC separately. The architecture information is mostly based on the Wikipedia list with the earliest supported version being CUDA 7.0. This could be documented and expanded in the future to allow projects to query CUDA toolkit version and architecture information. For Clang we additionally constrain based on its support. Additionally the architecture mismatch detection logic is fixed, improved and updated for generic support: * Commit 01428c55 (CUDA: Fail fast if CMAKE_CUDA_ARCHITECTURES doesn't work during detection, 2020-08-29) enabled CMAKE_CUDA_COMPILER_ID_REQUIRE_SUCCESS if CMAKE_CUDA_ARCHITECTURES is specified. This results in CMakeDetermineCompilerID.cmake printing the compiler error and our code for presenting the mismatch in a user-friendly way being useless. The custom logic seems preferable so go back to not enabling it. * Commit 14d8a276 (CUDA: Support nvcc 11.5 new -arch=all|all-major flags, 2021-08-17) tried to support CMP0054 but forgot to add x to the interpolated result. Thus the conditions would always evaluate to false. This is fixed as a byproduct of removing NVIDIA specific checks, improving the error message and replacing architectures_mode with a simpler architectures_explicit. Visual Studio support omits testing the flags during detection due to complexities in determining the toolkit version when using it. A long-term proper implementation would be #23161. Implements #22860.
* CompilerID: Compiler extensions default detectionRaul Tambre2021-09-281-0/+1
|
* CUDA, CXX, OBJCXX: C++23 support with Clang 12Raul Tambre2020-12-081-0/+1
| | | | | Clang 12 landed initial support for C++23 language mode flag -std={c|gnu}++2b in commit 6627a3c2873fdf7ccba1a1573371079be48b36e8.
* CMakeDetermineCompilerABI: Detect byte order as part of checkBrad King2020-11-041-0/+1
| | | | | | | We already detect `sizeof(void*)`. Detect the byte order as part of the same check. Issue: #21392
* CUDA: Clang separable compilationRaul Tambre2020-09-241-0/+3
| | | | | | | | | | | | For NVCC the compiler takes care of device linking when passed the "-dlink" flag. Clang doesn't support such magic and requires the buildsystem to do the work that NVCC does behind the scenes. The implementation is based on Bazel's device linking documentation: https://github.com/tensorflow/tensorflow/blob/7cabcdf073abad8c46e9dda62bb8fa4682d2061e/third_party/nccl/build_defs.bzl.tpl#L259 Closes: #20726
* CUDA: Determine CUDA toolkit location for NVCCRaul Tambre2020-06-121-0/+3
| | | | | Similar to how we already do for Clang. Avoids a lot of redundant work in FindCUDAToolkit.
* Merge branch 'backport-cuda-default-runtime' into cuda-default-runtimeBrad King2020-05-221-0/+2
|\
| * CUDA: Compute CMAKE_CUDA_RUNTIME_LIBRARY default from toolchainRobert Maynard2020-05-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Compilers: Add paths from -print-sysroot to system prefix pathRobert Maynard2020-04-141-0/+1
| |
* | MSVC: Use 'lib' instead of 'link /lib' to create static librariesFrancisco Facioni2020-03-031-0/+1
|/ | | | | | `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.
* CUDA: Persist SIZEOF_VOID_P and PLATFORM_ABIRobert Maynard2019-12-161-0/+13
| | | | | | | The CUDA language failed to persist CMAKE_SIZEOF_VOID_P and CMAKE_INTERNAL_PLATFORM_ABI, causing find_ calls to fail when the only enabled language was CUDA. This specifically occurred when having to locate libraries inside `lib64` directories.
* CUDA: Add cuda meta-features (e.g. ``cuda_std_11``) supportRobert Maynard2019-12-101-0/+7
|
* CUDA: persist CMAKE_LIBRARY_ARCHITECTURE and CUDA versionRobert Maynard2019-11-261-0/+5
| | | | | | The CUDA language failed to persist CMAKE_CUDA_LIBRARY_ARCHITECTURE and CMAKE_LIBRARY_ARCHITECTURE, causing find_ calls to fail when the only enabled language was CUDA.
* Compute implicit include directories from compiler outputChuck Cranor2019-01-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - CMakeParseImplicitIncludeInfo.cmake: new parser that extracts the compiler's include path from verbose output. If the parser cannot parse the output, we fall back to the old behavior. On osx we skip over framework directories (handled elsewhere). - CMakeDetermineCompilerABI.cmake: - use verbose flag in try_compile for ${src} - use new cmake_parse_implicit_include_info() to attempt extract implicit include directory path and if successful set CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES - CMakeCCompiler.cmake.in and CMakeCXXCompiler.cmake.in - preserve CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES value between runs in the same way CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES is preserved - Tests/RunCMake/ParseImplicitIncludeInfo: tests for parse based on the older Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in. The test runs a set of verbose compiler outputs collected from various machines through the parser and checks the results. New compiler files can be added by dropping input/output files in the ParseImplicitIncludeInfo/data subdirectory and then adding the new set of files to the ${targets} list in ParseImplicitIncludeInfo.cmake. There is a helper CMakeLists.txt in ParseImplicitIncludeInfo/data that can help with the generation of test input files. NOTE: the standard cmake pre-commit hook rejects verbose compiler output with trailing spaces... you have to manually edit them out. This shouldn't impact the test. Note that both the parser and the test code can use CMAKE_${LANG}_COMPILER_* variables such as ${CMAKE_CXX_COMPILER_ID} to decide how to parse verbose compiler output. For the test code, this requires us to save the variables values in the test input files. Fixes: #16291
* MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}Mateusz Zych2018-10-291-0/+1
| | | | | | | | | | | | CMake commands vs_link_dll and vs_link_exe, performing linking on MSVC, are responsible for calling resource compiler and manifest tool. Before this commit, both of these tools were called directly, with the expectation that they are available in the `PATH`. This has been fixed by respecting CMake variables `CMAKE_RC_COMPILER` and `CMAKE_MT` defining paths to these tools. Fixes: #17804
* CUDA: Find CMAKE_LINKER on WindowsBrad King2018-10-291-0/+2
| | | | | We use this in `Modules/Platform/Windows-NVIDIA-CUDA.cmake`, so make sure it is available.
* CUDA: Set CMAKE_CUDA_COMPILER_LOADED variable when language is enabledHenry Schreiner2018-04-131-0/+1
| | | | We already do this for C, CXX, Fortran, etc.
* CUDA: Detect the toolkit include directoriesRobert Maynard2017-02-101-0/+2
| | | | | The `nvcc -v` output provides what include directories need to be added to use the CUDA toolkit from other languages ( C/C++ ).
* CUDA: set linker preference between C and C++Robert Maynard2017-01-241-1/+1
|
* CUDA: Now pass correct FLAGS when device link cuda executables.Robert Maynard2017-01-121-0/+2
| | | | | | | | Previously we had a two issues when building cuda executables that required separable compilation. The first was that we didn't propagate FLAGS causing any -arch / -gencode flags to be dropped, and secondly generators such as ninja would use the CXX language flags instead of CUDA when the executable was mixed language.
* CUDA: Detect MSVC architecture idBrad King2017-01-121-0/+1
|
* CUDA: Detect use of MSVC host compilerBrad King2017-01-121-0/+2
| | | | Report it in `CMAKE_CUDA_SIMULATE_{ID,VERSION}`.
* CUDA: Prefer environment variables CUDACXX and CUDAHOSTCXX.Robert Maynard2016-11-141-0/+1
|
* CUDA: Use the host compiler for linking CUDA executables and shared libs.Robert Maynard2016-11-141-0/+6
|
* CUDA: We now properly perform CUDA compiler identification.Robert Maynard2016-11-141-0/+5
|
* CUDA: Add support language levels (98/11)Robert Maynard2016-11-141-0/+1
|
* CUDA: Add basic CUDA language support for *NIX systems.Robert Maynard2016-11-141-0/+7