@@ -40,21 +40,23 @@ lazy val samples = project
40
40
libraryDependencies += " com.lihaoyi" %%% " utest" % " 0.6.3" % " test" ,
41
41
testFrameworks += new TestFramework (" utest.runner.Framework" ),
42
42
nativeLinkStubs := true ,
43
- Test / nativeLinkingOptions += {
44
- val cwd = (nativeWorkdir in Test ).value.getAbsoluteFile / " bindgen"
45
- s " -L $cwd"
43
+ Test / nativeLinkingOptions ++= {
44
+ val rootDir = (ThisBuild / baseDirectory).value.getAbsoluteFile
45
+ val cwd = (Test / target).value.getAbsoluteFile / " bindgen"
46
+ val linker = rootDir / " scripts" / " linker.sh"
47
+ Seq (s " -L $cwd" , s " -fuse-ld= $linker" )
46
48
},
47
49
Test / compile := {
48
50
val log = streams.value.log
49
- val cwd = (nativeWorkdir in Test ).value.getAbsoluteFile / " bindgen"
50
- val compileOptions = nativeCompileOptions.value
51
- val cpaths = (baseDirectory.value * * " *.c" ).get
51
+ val cwd = (Test / target ).value / " bindgen"
52
+ val compileOptions = ( Test / nativeCompileOptions) .value
53
+ val cpaths = (baseDirectory.value.getAbsoluteFile * " *.c" ).get
52
54
val clangPath = nativeClang.value.toPath.toAbsolutePath.toString
53
55
54
56
cwd.mkdirs()
55
57
56
58
def abs (path : File ): String =
57
- path.getAbsolutePath.toString
59
+ path.getAbsolutePath
58
60
59
61
def run (command : Seq [String ]): Int = {
60
62
log.info(" Running " + command.mkString(" " ))
@@ -75,7 +77,7 @@ lazy val samples = project
75
77
}
76
78
77
79
val archivePath = cwd / " libbindgentests.a"
78
- val archive = Seq (" ar" , " rs " , abs(archivePath)) ++ opaths
80
+ val archive = Seq (" ar" , " cr " , abs(archivePath)) ++ opaths
79
81
if (run(archive) != 0 ) {
80
82
sys.error(s " Failed to create archive $archivePath" )
81
83
}
0 commit comments