-
Notifications
You must be signed in to change notification settings - Fork 4
/
lakefile.lean
33 lines (27 loc) · 869 Bytes
/
lakefile.lean
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
import Lake
open Lake DSL
package «SDL» {
moreLinkArgs := #["-L.lake/build/lib", "-lsdl2-shim", "-lSDL2", "-lSDL2_image"]
extraDepTargets := #["sdl2-shim"]
}
lean_lib «SDL» {
srcDir := "src"
}
def cDir := "bindings"
def ffiSrc := "sdl2-shim.c"
def ffiO := "sdl2-shim.o"
def ffiLib := "sdl2-shim"
target ffi.o pkg : FilePath := do
let oFile := pkg.buildDir / ffiO
let srcJob ← inputFile <| pkg.dir / cDir / ffiSrc
buildFileAfterDep oFile srcJob fun srcFile => do
let flags := #["-I", (← getLeanIncludeDir).toString,
"-I", (<- IO.getEnv "C_INCLUDE_PATH").getD "", "-fPIC"]
compileO ffiSrc oFile srcFile flags
target «sdl2-shim» pkg : FilePath := do
let name := nameToStaticLib ffiLib
let ffiO ← fetch <| pkg.target ``ffi.o
buildStaticLib (pkg.buildDir / "lib" / name) #[ffiO]
lean_exe Tests {
root := `test.Tests
}