@@ -8,20 +8,20 @@ package «GinacLean» where
8
8
-- preferReleaseBuild := get_config? noCloudRelease |>.isNone
9
9
buildType := BuildType.debug
10
10
-- buildArchive? := is_arm? |>.map (if · then "arm64" else "x86_64")
11
- moreLinkArgs := #[s! "-L{ __dir__} /build/lib" ,
11
+ moreLinkArgs := #[s! "-L{ __dir__} /.lake/ build/lib" ,
12
12
-- "-L/usr/bin/../lib/gcc/aarch64-linux-gnu/11 -L/lib/aarch64-linux-gnu -L/usr/lib/aarch64-linux-gnu -L/usr/lib/llvm-14/bin/../lib -L/lib -L/usr/lib",
13
13
"-lginac_ffi" , "-lginac" , "-lcln" , "-lstdc++" ] -- "-v", --, "-lc++", "-lc++abi", "-lunwind"] -- "-lstdc++"]
14
14
weakLeanArgs := #[
15
- s! "--load-dynlib={ __dir__} /build/lib/" ++ nameToSharedLib "cln" ,
16
- s! "--load-dynlib={ __dir__} /build/lib/" ++ nameToSharedLib "ginac"
15
+ s! "--load-dynlib={ __dir__} /.lake/ build/lib/" ++ nameToSharedLib "cln" ,
16
+ s! "--load-dynlib={ __dir__} /.lake/ build/lib/" ++ nameToSharedLib "ginac"
17
17
]
18
18
19
19
lean_lib «GinacLean » where
20
20
roots := #[`Ginac]
21
- moreLinkArgs := #[s! "-L{ __dir__} /build/lib" ,
21
+ moreLinkArgs := #[s! "-L{ __dir__} /.lake/ build/lib" ,
22
22
"-lginac_ffi" ,
23
23
"-lstdc++" ]
24
- extraDepTargets := #[" libginac_ffi" ]
24
+ extraDepTargets := #[` libginac_ffi]
25
25
26
26
@[default_target]
27
27
lean_exe «ginac_hello » where
@@ -51,22 +51,22 @@ def getLibPath (name : String) : IO (Option FilePath) := do
51
51
return none
52
52
53
53
54
- def afterReleaseSync (pkg : Package) (build : SchedulerM (Job α)) : IndexBuildM (Job α) := do
54
+ def afterReleaseSync (pkg : Package) (build : SpawnM (Job α)) : FetchM (Job α) := do
55
55
if pkg.preferReleaseBuild ∧ pkg.name ≠ (← getRootPackage).name then
56
56
(← pkg.release.fetch).bindAsync fun _ _ => build
57
57
else
58
58
build
59
59
60
60
61
- def afterReleaseAsync (pkg : Package) (build : BuildM α) : IndexBuildM (Job α) := do
61
+ def afterReleaseAsync (pkg : Package) (build : JobM α) : FetchM (Job α) := do
62
62
if pkg.preferReleaseBuild ∧ pkg.name ≠ (← getRootPackage).name then
63
63
(← pkg.release.fetch).bindSync fun _ _ => build
64
64
else
65
65
Job.async build
66
66
67
67
-- #eval ("a.b.c".splitOn ".")[ 0 ]
68
68
69
- def copyLibJob (pkg : Package) (libName : String) : IndexBuildM (BuildJob FilePath) :=
69
+ def copyLibJob (pkg : Package) (libName : String) : FetchM (BuildJob FilePath) :=
70
70
afterReleaseAsync pkg do
71
71
if !Platform.isOSX then -- Only required for Linux
72
72
let dst := pkg.nativeLibDir / libName
@@ -80,7 +80,7 @@ def copyLibJob (pkg : Package) (libName : String) : IndexBuildM (BuildJob FilePa
80
80
-- }
81
81
-- let src := srcLeanBundled
82
82
let some src ← getLibPath libName | error s! "{ libName} not found"
83
- logStep s! "Copying from { src} to { dst} "
83
+ logVerbose s! "Copying from { src} to { dst} "
84
84
proc {
85
85
cmd := "cp"
86
86
args := #[src.toString, dst.toString]
@@ -139,7 +139,7 @@ target libginac pkg : FilePath := do
139
139
-- TODO figure out how to trigger the build from lake
140
140
return (dst, trace)
141
141
142
- def buildCpp (pkg : Package) (path : FilePath) (deps : List (BuildJob FilePath)) : SchedulerM (BuildJob FilePath) := do
142
+ def buildCpp (pkg : Package) (path : FilePath) (deps : List (BuildJob FilePath)) : Lake.SpawnM (BuildJob FilePath) := do
143
143
let oFile := pkg.buildDir / "cpp" / (path.withExtension "o" ).fileName.get!
144
144
let srcJob ← inputFile <| path
145
145
let optLevel := if pkg.buildType == .release then "-O3" else "-O0"
@@ -153,7 +153,7 @@ def buildCpp (pkg : Package) (path : FilePath) (deps : List (BuildJob FilePath))
153
153
| some arch => flags := flags.push s! "--target={ arch} "
154
154
let args := flags ++ #["-I" , (← getLeanIncludeDir).toString, "-I" , (pkg.buildDir / "include" ).toString]
155
155
buildFileAfterDepList oFile (srcJob :: deps) (extraDepTrace := computeHash flags) fun deps =>
156
- compileO path.toString oFile deps[0 ]! args clangxx
156
+ compileO oFile deps[0 ]! args clangxx
157
157
158
158
target libginac_ffi pkg : FilePath := do
159
159
-- TODO figure out why these are required for linking, otherwise
@@ -200,7 +200,7 @@ def removeDirIfExists (path : String) : IO Unit := do
200
200
201
201
script clear := do
202
202
println! "Clearing all products of `lake build`, but keep built C++ libraries"
203
- let libDir := FilePath.mk s! "{ __dir__} /build/lib/"
203
+ let libDir := FilePath.mk s! "{ __dir__} /.lake/ build/lib/"
204
204
let paths := <-libDir.walkDir -- fun path => do
205
205
-- return !(<-path.isDir)
206
206
@@ -211,8 +211,8 @@ script clear := do
211
211
println! s! "Removing { path.toString} "
212
212
IO.FS.removeFile path.toString
213
213
214
- removeDirIfExists s! "{ __dir__} /build/cpp/"
215
- removeDirIfExists s! "{ __dir__} /build/ir/"
216
- removeDirIfExists s! "{ __dir__} /build/lib/examples"
217
- removeDirIfExists s! "{ __dir__} /build/lib/Ginac"
214
+ removeDirIfExists s! "{ __dir__} /.lake/ build/cpp/"
215
+ removeDirIfExists s! "{ __dir__} /.lake/ build/ir/"
216
+ removeDirIfExists s! "{ __dir__} /.lake/ build/lib/examples"
217
+ removeDirIfExists s! "{ __dir__} /.lake/ build/lib/Ginac"
218
218
return 0
0 commit comments