Skip to content

Commit

Permalink
Merge pull request #29 from JuliaGPU/sdk-path
Browse files Browse the repository at this point in the history
Add support for custom Vulkan SDK names
  • Loading branch information
Gnimuc authored Oct 4, 2020
2 parents bfa31ff + 2b23625 commit 02ea572
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/LibVulkan.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,27 @@ module LibVulkan

import Libdl

paths = String[]
const libvulkan = Libdl.find_library(["libvulkan", "vulkan", "vulkan-1", "libvulkan.so.1", "libMoltenVK"], paths)
@assert libvulkan != ""
@static if Sys.iswindows()
const libvulkan = "vulkan-1.dll"
elseif Sys.isapple()
const libvulkan = "libvulkan.dylib"
elseif Sys.islinux()
const libvulkan = "libvulkan.so.1"
else
const libvulkan = "libvulkan"
end

libvulkan_handle = C_NULL

function __init__()
libname = get(ENV, "JULIA_VULKAN_SDK_LIBNAME", "")
locations = get(ENV, "JULIA_VULKAN_SDK_SEARCH_PATH", "")
if isempty(libname)
libname = Libdl.find_library(["libvulkan", "vulkan", "vulkan-1", "libvulkan.so.1"], locations)
end
@assert libname != "" "cannot detect Vulkan SDK."
global libvulkan_handle = Libdl.dlopen(libname)
end

using CEnum

Expand Down

0 comments on commit 02ea572

Please sign in to comment.