-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlakefile.lean
More file actions
35 lines (28 loc) · 1.15 KB
/
lakefile.lean
File metadata and controls
35 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Lake
open System Lake DSL
def python := "python3.9"
def buildDir := defaultBuildDir
def cDir : FilePath := "c"
def ffiSrc := cDir / "ffi.cpp"
def includeDir := s!"/usr/include/{python}"
def ffiOTarget (pkgDir : FilePath) : FileTarget :=
let oFile := pkgDir / buildDir / cDir / "ffi.o"
let srcTarget := inputFileTarget <| pkgDir / ffiSrc
fileTargetWithDep oFile srcTarget fun srcFile => do
compileO oFile srcFile #["-std=c++17", "-fno-threadsafe-statics", "-fno-exceptions", "-I", (← getLeanIncludeDir).toString, "-I", includeDir, "-fPIC"] "c++"
def sharedLibDir (pkgDir : FilePath) : FilePath :=
pkgDir / buildDir / cDir / "libpythonffi.so"
def cLibTarget (pkgDir : FilePath) : FileTarget :=
let libFile := sharedLibDir pkgDir
leanSharedLibTarget libFile #[ffiOTarget pkgDir] #[s!"-l{python}"]
-- staticLibTarget libFile #[ffiOTarget pkgDir]
package leanpythonraw (pkgDir) (args) {
-- add configuration options here
srcDir := "lean"
libRoots := #[`Python.Raw]
moreLibTargets := #[cLibTarget pkgDir]
moreServerArgs := #[]
defaultFacet := PackageFacet.sharedLib
supportInterpreter := true
-- moreLinkArgs := #[s!"-l{python}"]
}