Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
grasph committed Jan 30, 2025
1 parent f959448 commit 632a76b
Showing 3 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/CxxBuild.jl
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ function get_or_build_libroot_julia()
#Below, we process differently if root_jll mode is enabled or not
#in order to adapt the error message.
if is_root_jll_used() #jll mode but platform not supported.
use_root_jll!()
use_root_jll!(false)
try
rootsys = check_rootsys()
@error("ROOT binaries not found in ROOT_jll for this platform. The wrapper will be compiled to use the ROOT libraries installed in $rootsys. The mode 'use_root_jll' has been disabled (can be reenabled with use_root_jll!()).")
@@ -206,7 +206,7 @@ function get_or_build_libroot_julia()
try
rootsys = check_rootsys()
catch e
if e isa ErrorException && hasfield(e, :msg)
if e isa ErrorException
@error(e.msg)
return ""
else
13 changes: 9 additions & 4 deletions src/ROOT.jl
Original file line number Diff line number Diff line change
@@ -28,6 +28,13 @@ Path of the shared library containing the C++ code interfacing the Julia ROOT pa
"""
const libroot_julia_path = Internals.CxxBuild.get_or_build_libroot_julia()

"""
`libroot_julia_from_jll`
Flag telling if the package was precompiled with the C++ wrapper library from the jll package (true) or built for an external C++ ROOT installation (false).
"""
const libroot_julia_from_jll = is_root_jll_used() && Internals.CxxBuild.is_jll_supported()

# Display libroot_julia_path value on precompilation
@info "ROOT wrapper library: $libroot_julia_path"

@@ -48,9 +55,7 @@ else

include_dependency(libroot_julia_path)

if is_root_jll_used()
Internals.loadlibdeps()
end
libroot_julia_from_jll && Internals.loadlibdeps()
@wrapmodule(()->libroot_julia_path)

include("iROOT.jl")
@@ -76,7 +81,7 @@ function __init__()
if isempty(libroot_julia_path)
@error "Failed to load or build C++ librairies and no function imported. See above error message to fix the issue.\nBEWARE: Julia needs to be restarted for the fix to take effect."
else
Internals.loadlibdeps()
libroot_julia_from_jll && Internals.loadlibdeps()
@initcxx
global gROOT = ROOT!GetROOT()
isinteractive() && _init_event_loop()
29 changes: 15 additions & 14 deletions src/internals.jl
Original file line number Diff line number Diff line change
@@ -3,22 +3,23 @@ module Internals
import Libdl
import ROOT_jll


include("CxxBuild.jl")

function loadlibdeps()
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libCore"), Libdl.RTLD_GLOBAL)
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libImt"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libHist"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libGraf"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libGraf3d"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libROOTVecOps.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libTree.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libTreePlayer.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libRint.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libPostscript.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libPhysics.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libROOTDataFrame.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libGeom.so"))
@static if isdefined(ROOT_jll, :find_artifact_dir) #not defined on platforms not supported by the jll
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libCore"), Libdl.RTLD_GLOBAL)
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libImt"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libHist"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libGraf"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libGraf3d"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libROOTVecOps.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libTree.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libTreePlayer.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libRint.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libPostscript.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libPhysics.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libROOTDataFrame.so"))
Libdl.dlopen(joinpath(ROOT_jll.find_artifact_dir(), "lib", "libGeom.so"))
end
end
end

0 comments on commit 632a76b

Please sign in to comment.