# Autogenerated wrapper script for SPIRV_Headers_jll for any
export spirv_xml

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

# Relative path to `spirv_xml`
const spirv_xml_splitpath = ["include", "spirv", "spir-v.xml"]

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

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


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

    # Initialize PATH and LIBPATH environment variable listings
    global PATH_list, LIBPATH_list
    # We first need to add to LIBPATH_list the libraries provided by Julia
    append!(LIBPATH_list, [joinpath(Sys.BINDIR, Base.LIBDIR, "julia"), joinpath(Sys.BINDIR, Base.LIBDIR)])
    global spirv_xml_path = normpath(joinpath(artifact_dir, spirv_xml_splitpath...))

    global spirv_xml = spirv_xml_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(LIBPATH_list, ':')

    # Add each element of LIBPATH to our DL_LOAD_PATH (necessary on platforms
    # that don't honor our "already opened" trick)
    #for lp in LIBPATH_list
    #    push!(DL_LOAD_PATH, lp)
    #end
end  # __init__()

