Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
refactor: rename 'ext' example to 'ffi'
Browse files Browse the repository at this point in the history
  • Loading branch information
tydeu committed Jul 27, 2021
1 parent ae181f0 commit 71defa0
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 10 additions & 10 deletions examples/ext/package.lean → examples/ffi/package.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ import Lake.Build
import Lake.Package
open Lake System

def extDir : FilePath := "ext"
def addSrc := extDir / "add.cpp"
def cDir : FilePath := "c"
def addSrc := cDir / "add.cpp"

def buildDir := defaultBuildDir
def addO := buildDir / extDir / "add.o"
def extLib := buildDir / extDir / "libext.a"
def addO := buildDir / cDir / "add.o"
def cLib := buildDir / cDir / "libadd.a"

def fetchAddOTarget : IO ActiveFileTarget := do
skipIfNewer addO (← getMTime addSrc) <|
BuildTask.spawn <| compileO addO addSrc (cmd := "c++")

def fetchExtLibTarget : IO ActiveFileTarget := do
def fetchCLibTarget : IO ActiveFileTarget := do
let oTarget ← fetchAddOTarget
skipIfNewer extLib oTarget.mtime <|
oTarget >> compileStaticLib extLib #[addO]
skipIfNewer cLib oTarget.mtime <|
oTarget >> compileStaticLib cLib #[addO]

def package : PackageConfig := {
name := "ext"
name := "ffi"
version := "0.1"
-- customize layout
srcDir := "lib"
moduleRoot := `Add
binName := "add"
-- specify path to the lib for linker
linkArgs := #[extLib.toString]
linkArgs := #[cLib.toString]
-- specify the lib target as an additional dependency
buildMoreDepsTarget := fetchExtLibTarget.map fun target =>
buildMoreDepsTarget := fetchCLibTarget.map fun target =>
LeanTarget.fromMTimeTarget <| target.discardArtifact
}
File renamed without changes.
File renamed without changes.

0 comments on commit 71defa0

Please sign in to comment.