Skip to content

Commit 623087e

Browse files
Fedrclaude
andauthored
Fall back to the CUDA_PATH toolkit when the preferred CUDA version is not installed (#6360)
* Fall back to the CUDA_PATH toolkit when the preferred CUDA version is not installed Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Document CUDA version fallback in the Windows setup guide Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 5601059 commit 623087e

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

doxygen/general_pages/CppSetupGuide.dox

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ xcopy C:\meshlib-built\install\app\$(Configuration)\*.dll $(TargetDir)
4141
- Include support for the C++ programming language.
4242
- Ensure the English language pack is installed (required for `vcpkg`).
4343
3. **CUDA Toolkit**
44-
- For **Visual Studio 2019**: Install [CUDA v11.4](https://developer.nvidia.com/cuda-11-4-0-download-archive)
45-
- For **Visual Studio 2022**: Install [CUDA v12.0](https://developer.nvidia.com/cuda-12-0-0-download-archive)
46-
- For **Visual Studio 2026**: Install [CUDA v13.2](https://developer.nvidia.com/cuda-13-2-0-download-archive)
47-
\n Choose the appropriate version based on your Visual Studio installation.
44+
- Recommended CUDA versions (the ones MeshLib CI builds with):
45+
- For **Visual Studio 2019**: Install [CUDA v11.4](https://developer.nvidia.com/cuda-11-4-0-download-archive)
46+
- For **Visual Studio 2022**: Install [CUDA v12.0](https://developer.nvidia.com/cuda-12-0-0-download-archive)
47+
- For **Visual Studio 2026**: Install [CUDA v13.2](https://developer.nvidia.com/cuda-13-2-0-download-archive)
48+
- Other CUDA versions work as well: if the recommended one is not installed, the build automatically falls back to the toolkit pointed to by the `CUDA_PATH` environment variable, which the NVIDIA installer keeps at the latest installed version.
49+
- In the CUDA installer, keep the **Visual Studio Integration** component enabled: the Visual Studio build needs it.
4850
4. **vcpkg**
4951
- To install `vcpkg`, follow these steps:
5052
1. **Open a command prompt (CMD) or PowerShell window**.

source/platform.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
<PreferredToolArchitecture>x86</PreferredToolArchitecture> <!-- Using 32-bit build tools reduces memory consumption and fixes error C3859: Failed to create virtual memory for PCH -->
2323
</PropertyGroup>
2424
<Import Project="$(CustomPlatfotmPropertyDir)\CustomMRPlatform.props" Condition="'$(CustomPlatfotmPropertyDir)' != ''"/>
25+
<!-- If the CUDA version selected above has no MSBuild integration in this Visual Studio, fall back
26+
to the toolkit pointed to by the CUDA_PATH environment variable (the NVIDIA installer keeps it
27+
at the latest installed version), when that version's integration is present. -->
28+
<PropertyGroup Condition="('$(MRCudaVersion)' == '' OR !Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(MRCudaVersion).props')) AND '$(CUDA_PATH)' != ''">
29+
<_MRCudaVersionFromCudaPath>$([System.IO.Path]::GetFileName('$(CUDA_PATH)').TrimStart('v'))</_MRCudaVersionFromCudaPath>
30+
<MRCudaVersion Condition="Exists('$(VCTargetsPath)\BuildCustomizations\CUDA $(_MRCudaVersionFromCudaPath).props')">$(_MRCudaVersionFromCudaPath)</MRCudaVersion>
31+
</PropertyGroup>
2532
<!-- Remaining GPU architectures to match the CMake build (cmake/Modules/ConfigureCuda.cmake): the CUDA
2633
props' unconditional default CodeGeneration (compute_52,sm_52; compute_75,sm_75 on CUDA 13+) already
2734
supplies the oldest SASS+PTX; these add the newer SASS targets plus PTX for the newest one. -->

0 commit comments

Comments
 (0)