Skip to content

Commit

Permalink
Link high level library (#573)
Browse files Browse the repository at this point in the history
* Link high level library

* Improve checking of deps and remove unecessary calls related to hl library
  • Loading branch information
musm committed Aug 23, 2019
1 parent 94275e7 commit e1bae31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
2 changes: 2 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const verbose = "--verbose" in ARGS
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
products = [
LibraryProduct(prefix, ["libhdf5"], :libhdf5),
LibraryProduct(prefix, ["libhdf5_hl"], :libhdf5_hl),
]

verbose && force_compile && @info("Forcing compilation from source.")
Expand Down Expand Up @@ -57,6 +58,7 @@ if dl_info === nothing && unsatisfied || force_compile
libname = "libhdf5_from_src"
products = [
LibraryProduct(prefix, [libname], :libhdf5)
LibraryProduct(prefix, [libname*"_hl"], :libhdf5_hl)
]
source_path = joinpath(prefix, "downloads", "src.tar.gz")
if !isfile(source_path) || !verify(source_path, source_hash; verbose=verbose) || unsatisfied
Expand Down
24 changes: 6 additions & 18 deletions src/HDF5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,11 @@ export
include("datafile.jl")

### Load and initialize the HDF library ###
const depsfile = joinpath(dirname(@__DIR__), "deps", "deps.jl")
if isfile(depsfile)
include(depsfile)
else
error("HDF5 not properly installed. Please run Pkg.build(\"HDF5\")")
end

let d = dirname(libhdf5), b = basename(libhdf5)
base,ext = split(b, ".", limit=2)
hl = joinpath(d, "libhdf5_hl.$ext")
global const libhdf5_hl = isfile(hl) ? hl : ""
end

function init_libhdf5()
status = ccall((:H5open, libhdf5), Cint, ())
status < 0 && error("Can't initialize the HDF5 library")
return nothing
const depsjl_path = joinpath(@__DIR__, "..", "deps", "deps.jl")
if !isfile(depsjl_path)
error("HDF5 not installed properly, run Pkg.build(\"HDF5\"), restart Julia and try again")
end
include(depsjl_path)

function h5_get_libversion()
majnum, minnum, relnum = Ref{Cuint}(), Ref{Cuint}(), Ref{Cuint}()
Expand Down Expand Up @@ -2580,7 +2567,8 @@ function __init__()
ENV["HDF5_USE_FILE_LOCKING"] = "FALSE"
end

init_libhdf5()
check_deps()

register_blosc()

# Turn off automatic error printing
Expand Down

0 comments on commit e1bae31

Please sign in to comment.