From a28d689525e7d06aaaf1597b84180db522040dc5 Mon Sep 17 00:00:00 2001 From: Dominique Orban Date: Mon, 11 May 2020 08:24:55 -0400 Subject: [PATCH] print CUTEst environment variables closes #225 --- src/CUTEst.jl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/CUTEst.jl b/src/CUTEst.jl index b958d110..baa22448 100644 --- a/src/CUTEst.jl +++ b/src/CUTEst.jl @@ -14,7 +14,7 @@ import Libdl.dlsym # Only one problem can be interfaced at any given time. global cutest_instances = 0 -export CUTEstModel, sifdecoder, fetch_sif_problems +export CUTEstModel, sifdecoder, fetch_sif_problems, export_cutest_env mutable struct CUTEstModel <: AbstractNLPModel meta :: NLPModelMeta @@ -112,6 +112,26 @@ include("core_interface.jl") include("julia_interface.jl") include("classification.jl") +""" + export_cutest_env() + +Print environment variables to add to the user's `~/.bashrc` +in order to use CUTEst as installed by CUTEst.jl from outside +Julia. +""" +function export_cutest_env(io::IO=stdout) + print(io, "# CUTEst settings: copy and paste the following into your ~/.bashrc\n#\n") + for var ∈ ("ARCHDEFS", "SIFDECODE", "CUTEST", "MYARCH", "MASTSIF") + print(io, "export $var=$(ENV["$var"])\n") + end + print(io, "export PATH=\${SIFDECODE}/bin:\${CUTEST}/bin:\${PATH}\n") + if Sys.isapple() + print(io, "run_sifdecoder() { bash -c \"export $(CUTEst_jll.LIBPATH_env)=$(CUTEst_jll.LIBPATH); source \$SIFDECODE/bin/sifdecoder \$@\"; }\n") + print(io, "#\n# to decode a problem, use run_sifdecoder followed by any options accepted by the decoder") + end + nothing +end + """ fetch_sif_problems()