Remove hardcoded compiler paths from CMakePresets.json for portability

- Remove CMAKE_C_COMPILER and CMAKE_CXX_COMPILER from CUDA 11 presets
- Allows CMake to auto-detect system GCC instead of hardcoding /usr/local/bin/gcc
- Improves portability across different systems (host, Docker containers, etc.)
- Users can still override compiler via CC/CXX environment variables if needed
This commit is contained in:
Shang Chieh Tseng
2025-11-06 23:38:46 +08:00
parent 92ba15bcb1
commit 5744fb792a

View File

@@ -12,35 +12,31 @@
},
{
"name": "CPU",
"inherits": [ "Default" ]
"inherits": ["Default"]
},
{
"name": "CUDA",
"inherits": [ "Default" ]
"inherits": ["Default"]
},
{
"name": "CUDA 11",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"cacheVariables": {
"CMAKE_C_COMPILER": "/usr/local/bin/gcc",
"CMAKE_CXX_COMPILER": "/usr/local/bin/g++",
"CMAKE_CUDA_ARCHITECTURES": "37-virtual;50-virtual;60-virtual;61-virtual;70-virtual;75-virtual;80-virtual;86-virtual",
"CMAKE_CUDA_FLAGS": "-Wno-deprecated-gpu-targets -t 2"
}
},
{
"name": "CUDA 11 K80",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"cacheVariables": {
"CMAKE_C_COMPILER": "/usr/local/bin/gcc",
"CMAKE_CXX_COMPILER": "/usr/local/bin/g++",
"CMAKE_CUDA_ARCHITECTURES": "37",
"CMAKE_CUDA_FLAGS": "-Wno-deprecated-gpu-targets -t 2"
}
},
{
"name": "CUDA 12",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"cacheVariables": {
"CMAKE_CUDA_ARCHITECTURES": "50;52;60;61;70;75;80;86;89;90;90a;120",
"CMAKE_CUDA_FLAGS": "-Wno-deprecated-gpu-targets -t 2"
@@ -48,7 +44,7 @@
},
{
"name": "CUDA 13",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"cacheVariables": {
"CMAKE_CUDA_ARCHITECTURES": "75-virtual;80-virtual;86-virtual;87-virtual;89-virtual;90-virtual;90a-virtual;100-virtual;103-virtual;110-virtual;120-virtual;121-virtual",
"CMAKE_CUDA_FLAGS": "-t 2"
@@ -56,28 +52,28 @@
},
{
"name": "JetPack 5",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"cacheVariables": {
"CMAKE_CUDA_ARCHITECTURES": "72;87"
}
},
{
"name": "JetPack 6",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"cacheVariables": {
"CMAKE_CUDA_ARCHITECTURES": "87"
}
},
{
"name": "ROCm",
"inherits": [ "Default" ],
"inherits": ["Default"],
"cacheVariables": {
"CMAKE_HIP_PLATFORM": "amd"
}
},
{
"name": "ROCm 6",
"inherits": [ "ROCm" ],
"inherits": ["ROCm"],
"cacheVariables": {
"CMAKE_HIP_FLAGS": "-parallel-jobs=4",
"AMDGPU_TARGETS": "gfx940;gfx941;gfx942;gfx1010;gfx1012;gfx1030;gfx1100;gfx1101;gfx1102;gfx1151;gfx1200;gfx1201;gfx908:xnack-;gfx90a:xnack+;gfx90a:xnack-"
@@ -85,7 +81,7 @@
},
{
"name": "Vulkan",
"inherits": [ "Default" ]
"inherits": ["Default"]
}
],
"buildPresets": [
@@ -97,56 +93,56 @@
{
"name": "CPU",
"configurePreset": "Default",
"targets": [ "ggml-cpu" ]
"targets": ["ggml-cpu"]
},
{
"name": "CUDA",
"configurePreset": "CUDA",
"targets": [ "ggml-cuda" ]
"targets": ["ggml-cuda"]
},
{
"name": "CUDA 11",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"configurePreset": "CUDA 11"
},
{
"name": "CUDA 11 K80",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"configurePreset": "CUDA 11 K80"
},
{
"name": "CUDA 12",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"configurePreset": "CUDA 12"
},
{
"name": "CUDA 13",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"configurePreset": "CUDA 13"
},
{
"name": "JetPack 5",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"configurePreset": "JetPack 5"
},
{
"name": "JetPack 6",
"inherits": [ "CUDA" ],
"inherits": ["CUDA"],
"configurePreset": "JetPack 6"
},
{
"name": "ROCm",
"configurePreset": "ROCm",
"targets": [ "ggml-hip" ]
"targets": ["ggml-hip"]
},
{
"name": "ROCm 6",
"inherits": [ "ROCm" ],
"inherits": ["ROCm"],
"configurePreset": "ROCm 6"
},
{
"name": "Vulkan",
"targets": [ "ggml-vulkan" ],
"targets": ["ggml-vulkan"],
"configurePreset": "Vulkan"
}
]