summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeTestCUDACompiler.cmake
Commit message (Collapse)AuthorAgeFilesLines
* CUDA: Factor out helper for detecting native CUDA architecturesBrad King2023-09-211-45/+4
| | | | Prepare to use it for other languages.
* CUDA: Factor out helper to filter implicit link librariesBrad King2023-09-211-2/+2
| | | | Prepare to use it for other languages.
* CUDA: Factor out helper to parse NVCC implicit compiler and linker flagsBrad King2023-09-211-11/+3
| | | | Prepare to use it for other languages.
* Modules: Record system inspection steps in the configure logBrad King2023-01-181-1/+1
| | | | | | | | Replace old-style `file(APPEND .../CMake{Output,Error}.log)` logging with calls to `message(CONFIGURE_LOG)` to record the steps in the `CMakeConfigureLog.yaml` configure log instead. Issue: #23200
* Modules: Drop redundant check logging to CMakeOutput.log and CMakeError.logBrad King2023-01-181-6/+0
| | | | | | | | | | `try_compile` and `try_run` now automatically log checks using them to `CMakeConfigureLog.yaml`. Add `LOG_DESCRIPTION` arguments to some `try_compile` calls to replace the description previously written to the old logs. Issue: #23200
* CUDA: Revert "Always mark cuda toolkit as system include"Robert Maynard2022-10-171-2/+4
| | | | | | | | We need to revert this change as it can disable error messages when compiling invalid CUDA code. This reverts commit ea659b155d (CUDA: Always mark cuda toolkit as system include, 2022-06-27, v3.25.0-rc1~269^2).
* Modules: Use new SOURCES_FROM_* try_compile (1/2)Matthew Woehlke2022-09-271-2/+3
| | | | | | | | | | | Modify some modules that ship with CMake to use the new SOURCES_FROM_* arguments to try_compile / try_run as added by commits cb14ae2b87 (try_compile: Add SOURCE_FROM_{ARG,VAR}, 2022-09-21) and 611d801790 (try_compile: Add SOURCE_FROM_FILE, 2022-09-22). This covers users which previously either used an existing file (but sometimes needed to rename it), or which wrote out their source in entirety. It does NOT cover users that actually need configure_file functionality, as those will be more involved to update and will thus be tackled in part 2.
* Modules: Use new keyword-dispatched try_compile signatureMatthew Woehlke2022-09-141-2/+2
| | | | | | | | | | | Modify most of the modules that ship with CMake to use the new try_compile / try_run signatures added by commit aa9220d3a0 (try_compile: Add keyword-dispatched signature, 2022-09-02). This improves debugging by each invocation using its own directory so that the results of multiple invocations can be retained. This does not cover any invocations which provide an entire project, as that flavor of try_compile has not yet been updated.
* CUDA: Always mark cuda toolkit as system includeRobert Maynard2022-08-181-4/+2
| | | | Fixes: #23731
* CUDA: native/all/all-major generates minimal set of ptx codeRobert Maynard2022-05-031-0/+1
| | | | Fixes #23459
* ci: Clamp CUDA 'native' architecture to values supported by its toolkitBrad King2022-03-161-1/+21
| | | | | | | | | | | | | | | | | | | The `native` architecture compiles for the host's GPUs, but our CI jobs may may run on hosts with GPUs newer than supported by their version of the CUDA toolkit. Add an undocumented environment variable to tell CMake to clamp the native architecture to that supported by the toolkit. Without this, we may try to compile for architectures not supported by the CUDA Toolkit, which fails. Since commit d1b48bfabd (CUDA: Add support for CUDA_ARCHITECTURES=native, 2022-03-04), our CUDA 9.2 CI job fails when it runs on a CI host with a GPU architecture newer than that CUDA 9.2 supports. Clamping the architecture level fixes that. Do not document this clamp behavior publicly, at least for now. Users can be responsible for building with a CUDA toolkit recent enough to support their host's GPUs. Issue: #22375
* CUDA: Add support for CUDA_ARCHITECTURES=nativeBrad King2022-03-101-0/+25
| | | | | | | | | | | 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
* enable_language: Fix test for working compiler with CMP0126 NEW behaviorBrad King2021-07-151-0/+4
| | | | | | | | | | | | | | Update the logic that converts a `try_compile` result from a cache entry to a normal variable to tolerate an existing normal variable under CMP0126 NEW behavior. Otherwise the `try_compile` result is ignored because CMake uses the false value of the normal variable, and CMake incorrectly reports that the compiler does not work. This went unnoticed for some languages (e.g. C and CXX) because the check for a working compiler is skipped if ABI detection works. It does affect other languages (e.g. CSharp). Fixes: #22423
* enable_language: Assume compiler works if ABI detection compilesBrad King2020-05-251-51/+51
| | | | | | | | | | | | | | | We run a `try_compile` with a tiny test source to check if the compiler works so that we can fail early if it does not. When the compiler does work, we immediately `try_compile` the ABI detection source. In the common case that both steps work, we gain no useful information from the first one and the work was wasted. Re-order the checks to try the ABI detection first. If it works then assume the compiler works and skip the dedicated check. If the ABI check fails then proceed with the normal test for a working compiler so the diagnostic can be shown as before. Fixes: #18703
* CUDA: Refactor implicit library filteringBrad King2020-05-221-15/+3
| | | | | | Filter CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES just after it is computed. Re-use the same exclusion list for filtering CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES to avoid duplication.
* CUDA: Add support for Clang compilerRaul Tambre2020-05-151-2/+7
| | | | | | | | | | | | | | | | | | | 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
* CUDA: Remove toolkit include dirs from implicit include dirs only with NVIDIABrad King2020-05-151-10/+12
| | | | | | | | | | The special case added by commit 87df637078 (CUDA: Do not treat CUDA toolkit include directories as implicit, 2020-02-02, v3.17.0-rc1~31^2) breaks CMake's protections against changing the compiler's implicit include directory order. Do this only for the NVIDIA compiler where it is needed as a workaround to another problem. That compiler does not put the host compiler's implicit include directories in `-I` paths so we do not detect them as `CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES` anyway.
* CUDA: Do not treat CUDA toolkit include directories as implicitRobert Maynard2020-02-031-0/+12
| | | | | | | | | CMake properly detects the toolkit directories as implicit system includes, but CUDA compilers don't add explicit `-isystem` markups to these directories when compiling CUDA code. Due to this limitation, allow users to explicitly specify these directories as SYSTEM dirs. Fixes: #16464, #19864
* CUDA: Add abstraction for cuda runtime selectionRobert Maynard2020-01-271-0/+11
| | | | | 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.
* CUDA: Add cuda meta-features (e.g. ``cuda_std_11``) supportRobert Maynard2019-12-101-0/+3
|
* Refactor: Use added message types in various modulesAlex Turbov2019-11-021-3/+3
| | | | Co-Authored-By: Craig Scott <craig.scott@crascit.com>
* Maint: misc. typosluz.paz2018-02-161-1/+1
| | | | Found via `codespell`
* Improve formatting of compiler failure error messageBrad King2017-09-191-2/+3
| | | | | | When we report that a compiler was unable to build a simple test program, indent the output of the attempt so that our message formatting will show it as a pre-formatted block.
* CUDA: Detect implicit link information on WindowsBrad King2017-01-121-0/+5
| | | | | The `nvcc -v` output on Windows uses response files, so load the one we need to extract the full link line.
* CUDA: We now properly perform CUDA compiler identification.Robert Maynard2016-11-141-0/+13
|
* CUDA: Add basic CUDA language support for *NIX systems.Robert Maynard2016-11-141-0/+58