ROOTprefs
Introduction
The ROOTprefs
package is used to set shared library installation preferences for ROOT.jl. Preferences must be set before the ROOT
module is imported, which is why methods for setting them are provided in a separate package.
ROOT.jl
offers a Julia interface to the C++ ROOT framework. This package requires the C++ ROOT shared libraries and a shared library that provides the Julia bindings based on CxxWrap.
The ROOT_jll
and ROOT_julia_jll
packages, which are installed by the Julia package manager when adding ROOT.jl
, provide the shared libraries for Linux. An alternative option, currently the only one available on macOS, is to use a standard ROOT C++ software installation (not ROOT_jll
). In this case, the C++-Julia interface shared library is built on-the-fly the first time the ROOT module is imported.
The ROOTprefs
Julia package provides the methods to customize how the C++ shared libraries are provided. In particular, see the set_use_root_jll(enable=true)
and set_ROOTSYS(path=nothing)
methods. Preferences are stored in the LocalPreferences.toml
file of the active Julia project.
Usage
The main switch
To use shared libraries from the jll
packages, if available for your platform, call set_use_root_jll()
. To use externally installed ROOT software and compile on the fly the library for the Julia bindings, call `userootjll(false)(@ref)'.
Specifying external ROOT installation location
The external ROOT installation location, also known as ROOTSYS
, can be set by calling set_ROOTSYS(path)
. When not set, if the ROOTSYS
environment variable is defined and points to a ROOT installation with a suitable version or a ROOT installation with a suitable version is accessible from the environement (executables in the PATH
), then the location will be set according at first import of the ROOT
package.
Functions
The complete set of methods provided by ROOTprefs
follows.
ROOTprefs.get_ROOTSYS
— Methodget_ROOTSYS()
Retrieve the ROOTSYS preference (see set_ROOTSYS()
.
ROOTprefs.get_check_root_version
— Methodgetcheckroot_version()
Retrieve the ROOT version check setting (see set_check_root_version()
.
ROOTprefs.get_clean_after_build
— Methodsetcleanafter_build(enable=true)
Retrieve the clean-after-build setting. See set_clean_after_build()
.
ROOTprefs.get_use_root_jll
— Methodget_use_root_jll()
Retrieve the jll mode setting. Return true
if enable, false
if disables.
@see set_use_root_jll()
.
ROOTprefs.set_ROOTSYS
— Functionset_ROOTSYS(path=nothing)
Set the path of the ROOT C++ libraries installation, also known as ROOTSYS, when it is handle by the Julia package manager with the jll packages (see [`setuserootjll(enable)`](@ref).
The Julia ROOT package will use the command $ROOTSYS/bin/root-config
, where $ROOTSYS
is the path set by this function, to locate the ROOT C++ libraries (typically in $ROOTSYS/lib
).
When called without argument and the ROOTSYS environment variable is set, its value will be used. In case this variable is not set, the root-config
command will be searched in the system binary paths (defined by the PATH environment variable) and ROOTSYS preference will be set according.
By default, the presence of the root-config
command in $ROOTSYS/bin/root-config
is checked (except if path
is the empty string). Pass nocheck=true
as argument to disable the check.
Before installing a new version, call set_use_root_jll(false)
to disable the ROOT_jll mode, and execute try import ROOT; catch; end
. This will tell you the supported versions if possibly installed one is not supported.
ROOTprefs.set_check_root_version
— Functionsetcheckroot_version(enable=true)
Enable or disable the ROOT C++ library version check for the non-jll mode. By default, the Julia ROOT package checks that the version of the ROOT C++ libraries set by set_ROOTSYS()
matches with the version(s) it was validated for and throw an exception on import
if it does not. Use this function to disable (or re-enable) the check.
ROOTprefs.set_clean_after_build
— Functionsetcleanafter_build(enable=true)
Enable or disable the deletion of the intermediate build products after the shared library is built (the default).
ROOTprefs.set_use_root_jll
— Functionset_use_root_jll(enable=true)
Enable or disable the jll mode (default when the platform is supported by jll).
The Julia ROOT package needs the C++ ROOT libraries to run. Prebuilt ROOT libraries are provided in the JuliaBinaryWrappers repository as Julia packages. In the jll mode, the native package manager of Julia installs automatically the ROOT libraries on the machine. This mode is currently supported for Linux on x86 architecture.
When disabled, or if the platform is not supported by the jll mode, the C++ libraries must be installed on the machine before installing the Julia ROOT package and the ROOTSYS preference must be set using set_ROOTSYS()
function.
ROOTprefs.ROOTprefs
— ModuleROOTprefs
Main module of the ROOTprefs
Julia package.