summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-NVIDIA-CUDA.cmake
Commit message (Collapse)AuthorAgeFilesLines
* Add options to specify linker toolMarc Chevrier2023-10-131-0/+6
| | | | | | | | | | | | | | | | | | Offer the capability, through variable `CMAKE_LINKER_TYPE`, as well as the target property `LINKER_TYPE` to specify which linker must be used. The implementation of this capability is specified by variables specific to the language and linker type: `CMAKE_<LANG>_USING_LINKER_<TYPE>`. Some definitions are provided as part of `CMake`. For example, to select the `LLVM` linker rather than the standard one, the type `LLD` should be specified through the variable `CMAKE_LINKER_TYPE`. And, on `Apple`, `Linux` and some environments on `Windows`, the variable `CMAKE_<LANG>_USING_LINKER_LLD` has value `-fuse-ld=lld`. And for `Windows` environments based on `MSVC`, where the linker is used directly, the tool `lld-link.exe` will be used rather than `link.exe`. Fixes: #19174, #24254, #24990
* MSVC: Add abstraction for debug information formatGlen Chung2022-09-141-2/+12
| | | | | | | | | | | | | | | | Replace our hard-coded default for `/Zi` with a first-class abstraction to select the debug information format an enumeration of logical names. We've long hesitated to do this because the idea of "debug information format" touches on related concepts on several platforms. Avoid that scope creep by simply defining an abstraction that applies only when targeting the MSVC ABI on Windows. Removing the old default flag requires a policy because existing projects may rely on string processing to edit them and choose a runtime library under the old behavior. Add policy CMP0141 to provide compatibility. Fixes: #10189
* CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATIONRobert Maynard2021-10-201-6/+2
| | | | | | The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION` now aren't mutually exclusive and can now be used together on the same target.
* Platform/Windows-NVIDIA-CUDA: Remove duplicated codeRaul Tambre2021-02-141-9/+1
| | | | | | 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.
* CUDA: Fix spelling __IMPLICT_ -> __IMPLICIT_Raul Tambre2021-02-141-16/+16
|
* Merge branch 'backport-cuda-default-runtime' into cuda-default-runtimeBrad King2020-05-221-1/+0
|\
| * CUDA: Compute CMAKE_CUDA_RUNTIME_LIBRARY default from toolchainRobert Maynard2020-05-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | CUDA: Add support for Clang compilerRaul Tambre2020-05-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Device linking use now link optionsMarc Chevrier2020-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | 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
* | CUDA: Abstract language flag to compiler modulesRaul Tambre2020-03-111-4/+4
| | | | | | | | | | Separate this detail out into compiler-specific modules. Required for Clang support, as it uses slightly different language flags.
* | MSVC: Use 'lib' instead of 'link /lib' to create static librariesFrancisco Facioni2020-03-031-1/+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: Add abstraction for cuda runtime selectionRobert Maynard2020-01-271-0/+5
| | | | | 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: forward unknown flags to host compiler when possible.Robert Maynard2019-11-291-12/+5
| | | | | | | | | | 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.
* CUDA: Implement MSVC runtime library abstractionBrad King2019-06-261-4/+19
| | | | | | | | | In commit fb3370b6a1 (MSVC: Add abstraction for runtime library selection, 2019-04-10, v3.15.0-rc1~229^2) we overlooked updating flags for CUDA on Windows, where nvcc uses MSVC as the host compiler. Add them now and update the MSVCRuntimeLibrary test to cover CUDA. Fixes: #19428
* MSVC: Do not add /W3 to CMAKE_<LANG>_FLAGS by defaultBrad King2019-04-191-1/+10
| | | | | | | | | | | | | | We do not add default warning flags on other compilers, and having a warning flag in the default flags makes it hard for projects to customize the warning level. They need to use string processing to remove `/W3` from `CMAKE_{C,CXX}_FLAGS`. Therefore we should drop it. However, projects may be using string processing to replace `/W3` with another flag, so we cannot simply drop it. Add a policy to drop it in a compatible way. Fixes: #18317
* MSVC: Respect CMAKE_RC_COMPILER and CMAKE_MT in vs_link_{dll,exe}Mateusz Zych2018-10-291-2/+2
| | | | | | | | | | | | 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: Enable RC language on WindowsBrad King2018-10-291-0/+2
| | | | | We need the resource compiler to place manifests in binaries. Make sure it is available.
* CUDA: Avoid using deprecated cublas_device to identify device lib dirsRobert Maynard2018-08-231-1/+1
| | | | | | | Use `curand_static` to identify directories containing device libraries because `cublas_device` is deprecated and will be removed in the future. Issue: #18290
* CUDA: Drop unused/broken platform link flags placeholderBrad King2018-05-251-4/+4
| | | | | | | | | | | | | | | | The `<CMAKE_CUDA_LINK_FLAGS>` placeholder in CUDA rule variables comes from the `<CMAKE_CXX_LINK_FLAGS>` placeholder from which the CUDA rule variables were originally derived. It is not a public interface for adding link flags so no projects should be using it. It is needed for platform information modules to specify platform-specific link flags for the language. None of our platform modules set it, so it is unused. Furthermore, it is broken as currently implemented. Some of the contexts in which it is used need `-Xlinker` and some do not. Therefore it is not possible to use the placeholder at all. Simply remove it for now. If some need for platform-specific CUDA link flags arises a new solution will be needed.
* CUDA: Pass host linker directories to device linkerBrad King2018-03-281-2/+17
| | | | | | | | | In some environments, libraries containing device code are installed in directories searched by the host linker but not passed by nvcc to nvlink. Make these libraries available by explicitly passing the host linker search directories during device linking. Issue: #16317
* CUDA: When linking device code suppress CUDA 8.0+ deprecation warningsRobert Maynard2017-06-131-2/+10
| | | | | | The CUDA compiler automatic deprecation warnings are pure noise when doing device linking, and should be suppressed to reduce the amount of confusion from users.
* CUDA: Fix default compiler flags on WindowsBrad King2017-02-151-5/+7
| | | | | | | Fix the default values of `CMAKE_CUDA_FLAGS[_<CONFIG>]` on Windows to make the host compiler flags match those produced for C++ by the `Platform/Windows-MSVC` module. This makes the flags consistent with those used for C++.
* CUDA: Link to standard system libraries when linking as CUDABrad King2017-02-141-0/+2
| | | | | | | On Windows with MSVC-like host compilers we must honor the standard libraries chosen by the `Platform/Windows-MSVC` module. Otherwise C code linked into the CUDA binary that expects to have these libraries available may not link.
* CUDA: Now pass correct FLAGS when device link cuda executables.Robert Maynard2017-01-121-1/+1
| | | | | | | | 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: Populate NVIDIA compiler information on WindowsBrad King2017-01-121-0/+42
Port Windows-specific compilation and linking rules over from the `Platform/Windows-MSVC` module and adapt it for NVIDIA CUDA. On Windows nvcc and its host compiler (MSVC) do not understand or use options like `-fPIC` or `-std=`, so condition those out.