Skip to content

Commit

Permalink
indent
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Sep 22, 2022
1 parent 2b74d7a commit 0dd7659
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 57 deletions.
101 changes: 50 additions & 51 deletions GRPreferences/src/GRPreferences.jl
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
module GRPreferences
using Preferences
using Preferences

const os = if Sys.KERNEL == :NT
:Windows
else
Sys.KERNEL
end
const os = if Sys.KERNEL == :NT
:Windows
else
Sys.KERNEL
end

extension() = if os :Windows
".dll"
elseif os :Darwin
".dylib"
else
".so"
end
extension() = if os :Windows
".dll"
elseif os :Darwin
".dylib"
else
".so"
end

loadpath(grdir) = if os :Windows
joinpath(grdir, "bin")
elseif os :Darwin
joinpath(grdir, "lib")
else
joinpath(grdir, "lib")
end
loadpath(grdir) = if os :Windows
joinpath(grdir, "bin")
elseif os :Darwin
joinpath(grdir, "lib")
else
joinpath(grdir, "lib")
end

const binary = @load_preference("binary", "GR_jll")
const libGR = @load_preference("libGR", "libGR" * extension())
const libGR3 = @load_preference("libGR3", "libGR3" * extension())
const libGRM = @load_preference("libGRM", "libGRM" * extension())
const binary = @load_preference("binary", "GR_jll")
const libGR = @load_preference("libGR", "libGR" * extension())
const libGR3 = @load_preference("libGR3", "libGR3" * extension())
const libGRM = @load_preference("libGRM", "libGRM" * extension())

function use_system_binary(grdir; export_prefs = false, force = false)
grdir = loadpath(grdir)
set_preferences!(GRPreferences,
"binary" => "system",
"grdir" => grdir,
"libGR" => joinpath(grdir, "libGR" * extension()),
"libGR3" => joinpath(grdir, "libGR3" * extension()),
"libGRM" => joinpath(grdir, "libGRM" * extension()),
export_prefs = export_prefs,
force = force
)
return nothing
end
function use_system_binary(grdir; export_prefs = false, force = false)
grdir = loadpath(grdir)
set_preferences!(GRPreferences,
"binary" => "system",
"grdir" => grdir,
"libGR" => joinpath(grdir, "libGR" * extension()),
"libGR3" => joinpath(grdir, "libGR3" * extension()),
"libGRM" => joinpath(grdir, "libGRM" * extension()),
export_prefs = export_prefs,
force = force
)
return nothing
end

function use_jll_binary(; export_prefs = false, force = false)
set_preferences!(GRPreferences,
"binary" => "GR_jll",
"grdir" => nothing,
"libGR" => nothing,
"libGR3" => nothing,
"libGRM" => nothing,
export_prefs = export_prefs,
force = force
)
return nothing
end

end
function use_jll_binary(; export_prefs = false, force = false)
set_preferences!(GRPreferences,
"binary" => "GR_jll",
"grdir" => nothing,
"libGR" => nothing,
"libGR3" => nothing,
"libGRM" => nothing,
export_prefs = export_prefs,
force = force
)
return nothing
end
end
12 changes: 6 additions & 6 deletions src/GR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ module GR
Base.Experimental.@optlevel 1
end

if Sys.KERNEL == :NT
const os = :Windows
else
const os = Sys.KERNEL
end

import GRPreferences
import Base64
import Libdl
Expand All @@ -49,6 +43,12 @@ else
error("Unknown GR binary: $(GRPreferences.binary)")
end

if Sys.KERNEL == :NT
const os = :Windows
else
const os = Sys.KERNEL
end

export
init,
initgr,
Expand Down

0 comments on commit 0dd7659

Please sign in to comment.