lean4-htt/Lake/Util/NativeLib.lean
tydeu 68b81ca065 refactor: intro Lake.Env & add it to Workspace
also `LakeConfig` -> `LoadConfig`
2022-07-11 23:06:19 -04:00

36 lines
1 KiB
Text

/-
Copyright (c) 2022 Mac Malone. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mac Malone
-/
open System
namespace Lake
/-- The shared library file extension for the `Platform`. -/
def sharedLibExt : String :=
if Platform.isWindows then "dll"
else if Platform.isOSX then "dylib"
else "so"
/-- Convert a library name into its static library file name for the `Platform`. -/
def nameToStaticLib (name : String) : String :=
if Platform.isWindows then s!"{name}.a" else s!"lib{name}.a"
/-- Convert a library name into its shared library file name for the `Platform`. -/
def nameToSharedLib (name : String) : String :=
if Platform.isWindows then s!"{name}.dll"
else if Platform.isOSX then s!"lib{name}.dylib"
else s!"lib{name}.so"
/--
The environment variable that stores the search path
used to find shared libraries on the `Platform`.
-/
def sharedLibPathEnvVar :=
if Platform.isWindows then
"PATH"
else if Platform.isOSX then
"DYLD_LIBRARY_PATH"
else
"LD_LIBRARY_PATH"