Move Vulkan stuff inside if (GGML_VULKAN)

This commit is contained in:
Iwan Kawrakow
2025-07-02 17:06:05 +03:00
parent 3248a35992
commit 7166c65083

View File

@@ -643,8 +643,6 @@ if (GGML_RPC)
set(GGML_SOURCES_RPC ggml-rpc.cpp)
endif()
find_package(Vulkan COMPONENTS glslc REQUIRED)
function(detect_host_compiler)
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
find_program(HOST_C_COMPILER NAMES cl gcc clang NO_CMAKE_FIND_ROOT_PATH)
@@ -657,6 +655,12 @@ function(detect_host_compiler)
set(HOST_CXX_COMPILER "${HOST_CXX_COMPILER}" PARENT_SCOPE)
endfunction()
if (GGML_VULKAN)
find_package(Vulkan COMPONENTS glslc REQUIRED)
if (Vulkan_FOUND)
message(STATUS "Vulkan found")
# Function to test shader extension support
# Parameters:
# EXTENSION_NAME - Name of the extension to test (e.g., "GL_EXT_integer_dot_product")
@@ -683,12 +687,6 @@ function(test_shader_extension_support EXTENSION_NAME TEST_SHADER_FILE RESULT_VA
endif()
endfunction()
if (GGML_VULKAN)
find_package(Vulkan COMPONENTS glslc REQUIRED)
if (Vulkan_FOUND)
message(STATUS "Vulkan found")
# add vulkan test
set(VULKAN_SHADER_GEN_CMAKE_ARGS "")
@@ -718,9 +716,6 @@ if (GGML_VULKAN)
"GGML_VULKAN_BFLOAT16_GLSLC_SUPPORT"
)
# end vulkan test
list(APPEND GGML_CDEF_PUBLIC GGML_USE_VULKAN)