@@ -40,21 +40,23 @@ lazy val samples = project
4040 libraryDependencies += " com.lihaoyi" %%% " utest" % " 0.6.3" % " test" ,
4141 testFrameworks += new TestFramework (" utest.runner.Framework" ),
4242 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" )
4648 },
4749 Test / compile := {
4850 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
5254 val clangPath = nativeClang.value.toPath.toAbsolutePath.toString
5355
5456 cwd.mkdirs()
5557
5658 def abs (path : File ): String =
57- path.getAbsolutePath.toString
59+ path.getAbsolutePath
5860
5961 def run (command : Seq [String ]): Int = {
6062 log.info(" Running " + command.mkString(" " ))
@@ -75,7 +77,7 @@ lazy val samples = project
7577 }
7678
7779 val archivePath = cwd / " libbindgentests.a"
78- val archive = Seq (" ar" , " rs " , abs(archivePath)) ++ opaths
80+ val archive = Seq (" ar" , " cr " , abs(archivePath)) ++ opaths
7981 if (run(archive) != 0 ) {
8082 sys.error(s " Failed to create archive $archivePath" )
8183 }
0 commit comments