# Autogenerated wrapper script for glslang_jll for i686-linux-gnu-cxx03
export glslangValidator, slibGenericCodeGen, slibHLSL, slibMachineIndependent, slibOGLCompiler, slibOSDependent, slibglslang

## Global variables
PATH = ""
LIBPATH = ""
LIBPATH_env = "LD_LIBRARY_PATH"
LIBPATH_default = ""

# Relative path to `glslangValidator`
const glslangValidator_splitpath = ["bin", "glslangValidator"]

# This will be filled out by __init__() for all products, as it must be done at runtime
glslangValidator_path = ""

# glslangValidator-specific global declaration
function glslangValidator(f::Function; adjust_PATH::Bool = true, adjust_LIBPATH::Bool = true)
    global PATH, LIBPATH
    env_mapping = Dict{String,String}()
    if adjust_PATH
        if !isempty(get(ENV, "PATH", ""))
            env_mapping["PATH"] = string(PATH, ':', ENV["PATH"])
        else
            env_mapping["PATH"] = PATH
        end
    end
    if adjust_LIBPATH
        LIBPATH_base = get(ENV, LIBPATH_env, expanduser(LIBPATH_default))
        if !isempty(LIBPATH_base)
            env_mapping[LIBPATH_env] = string(LIBPATH, ':', LIBPATH_base)
        else
            env_mapping[LIBPATH_env] = LIBPATH
        end
    end
    withenv(env_mapping...) do
        f(glslangValidator_path)
    end
end


# Relative path to `slibGenericCodeGen`
const slibGenericCodeGen_splitpath = ["lib", "libGenericCodeGen.a"]

# This will be filled out by __init__() for all products, as it must be done at runtime
slibGenericCodeGen_path = ""

# slibGenericCodeGen-specific global declaration
# This will be filled out by __init__()
slibGenericCodeGen = ""


# Relative path to `slibHLSL`
const slibHLSL_splitpath = ["lib", "libHLSL.a"]

# This will be filled out by __init__() for all products, as it must be done at runtime
slibHLSL_path = ""

# slibHLSL-specific global declaration
# This will be filled out by __init__()
slibHLSL = ""


# Relative path to `slibMachineIndependent`
const slibMachineIndependent_splitpath = ["lib", "libMachineIndependent.a"]

# This will be filled out by __init__() for all products, as it must be done at runtime
slibMachineIndependent_path = ""

# slibMachineIndependent-specific global declaration
# This will be filled out by __init__()
slibMachineIndependent = ""


# Relative path to `slibOGLCompiler`
const slibOGLCompiler_splitpath = ["lib", "libOGLCompiler.a"]

# This will be filled out by __init__() for all products, as it must be done at runtime
slibOGLCompiler_path = ""

# slibOGLCompiler-specific global declaration
# This will be filled out by __init__()
slibOGLCompiler = ""


# Relative path to `slibOSDependent`
const slibOSDependent_splitpath = ["lib", "libOSDependent.a"]

# This will be filled out by __init__() for all products, as it must be done at runtime
slibOSDependent_path = ""

# slibOSDependent-specific global declaration
# This will be filled out by __init__()
slibOSDependent = ""


# Relative path to `slibglslang`
const slibglslang_splitpath = ["lib", "libglslang.a"]

# This will be filled out by __init__() for all products, as it must be done at runtime
slibglslang_path = ""

# slibglslang-specific global declaration
# This will be filled out by __init__()
slibglslang = ""


"""
Open all libraries
"""
function __init__()
    global artifact_dir = abspath(artifact"glslang")

    # Initialize PATH and LIBPATH environment variable listings
    global PATH_list, LIBPATH_list
    global glslangValidator_path = normpath(joinpath(artifact_dir, glslangValidator_splitpath...))

    push!(PATH_list, dirname(glslangValidator_path))
    global slibGenericCodeGen_path = normpath(joinpath(artifact_dir, slibGenericCodeGen_splitpath...))

    global slibGenericCodeGen = slibGenericCodeGen_path
    global slibHLSL_path = normpath(joinpath(artifact_dir, slibHLSL_splitpath...))

    global slibHLSL = slibHLSL_path
    global slibMachineIndependent_path = normpath(joinpath(artifact_dir, slibMachineIndependent_splitpath...))

    global slibMachineIndependent = slibMachineIndependent_path
    global slibOGLCompiler_path = normpath(joinpath(artifact_dir, slibOGLCompiler_splitpath...))

    global slibOGLCompiler = slibOGLCompiler_path
    global slibOSDependent_path = normpath(joinpath(artifact_dir, slibOSDependent_splitpath...))

    global slibOSDependent = slibOSDependent_path
    global slibglslang_path = normpath(joinpath(artifact_dir, slibglslang_splitpath...))

    global slibglslang = slibglslang_path
    # Filter out duplicate and empty entries in our PATH and LIBPATH entries
    filter!(!isempty, unique!(PATH_list))
    filter!(!isempty, unique!(LIBPATH_list))
    global PATH = join(PATH_list, ':')
    global LIBPATH = join(vcat(LIBPATH_list, [joinpath(Sys.BINDIR, Base.LIBDIR, "julia"), joinpath(Sys.BINDIR, Base.LIBDIR)]), ':')
end  # __init__()

