-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlakefile.lean
More file actions
44 lines (35 loc) · 1.56 KB
/
lakefile.lean
File metadata and controls
44 lines (35 loc) · 1.56 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
36
37
38
39
40
41
42
43
44
import Lake
open System Lake DSL
package sqlite
lean_lib SQLite
def compiler := (·.getD "cc") <$> IO.getEnv "CC"
target sqlite.o pkg : FilePath := do
let oFile := pkg.buildDir / "sqlite3.o"
let srcJob ← inputTextFile <| pkg.dir / "native" / "sqlite3.c"
let sqliteHeaders := pkg.dir / "native"
-- Ensure that both sqlite3.h and sqlite3ext.h are available during compilation
let weakArgs := #["-I", sqliteHeaders.toString]
buildO oFile srcJob weakArgs #["-fPIC"] (← compiler) getLeanTrace
target sqliteffi.o pkg : FilePath := do
let oFile := pkg.buildDir / "sqliteffi.o"
let srcJob ← inputTextFile <| pkg.dir / "native" / "sqliteffi.c"
let sqliteHeaders := pkg.dir / "native"
let weakArgs := #["-I", (← getLeanIncludeDir).toString, "-I", sqliteHeaders.toString]
buildO oFile srcJob weakArgs #["-fPIC"] (← compiler) getLeanTrace
extern_lib libsqlite pkg := do
let sqliteO ← sqlite.o.fetch
let ffiO ← sqliteffi.o.fetch
let name := nameToStaticLib "sqliteffi"
buildStaticLib (pkg.staticLibDir / name) #[sqliteO, ffiO]
@[default_target]
lean_exe sqlite where
root := `Main
moreLinkObjs := #[libsqlite]
moreLinkArgs := if !Platform.isWindows then #["-Wl,--unresolved-symbols=ignore-all"] else #[] -- TODO: Very gross hack
@[test_driver]
lean_exe Tests.SQLite where
buildType := .debug
moreLinkObjs := #[libsqlite]
moreLinkArgs := if !Platform.isWindows then #["-Wl,--unresolved-symbols=ignore-all"] else #[] -- Same as above
require LSpec from git
"https://github.com/argumentcomputer/lspec/" @ "b05e6b83798bce0887eb5001cb10fdcbe675dde3"