kitgit

tirbofish/dropbear · diff

9af1226 · tk

fixed build.gradle.kts to support windows

Unverified

diff --git a/build.gradle.kts b/build.gradle.kts
index 62b6e69..f6783d4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -43,18 +43,35 @@ kotlin {
         else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
     }
 
-    if (file("${project.rootDir}/target/debug/$libName").exists()) {
-        println("Debug library exists")
-//        "${project.rootDir}/target/debug/$libName"
-    } else if (file("${project.rootDir}/target/release/$libName").exists()) {
-        println("Release library exists")
-//        "${project.rootDir}/target/debug/$libName"
-    } else if (file("${project.rootDir}/libs/$libName").exists()) {
-        println("Local library exists")
-//        "${project.rootDir}/libs/$libName"
-    } else {
-        println("libeucalyptus_core.so does not exist. This is a local build, so most likely you haven't built the rust library yet. \n" +
-                "Try running cargo build")
+    val (libDir, libNameForLinking) = when {
+        file("${project.rootDir}/target/debug").exists() -> {
+            val debugLibDir = "${project.rootDir}/target/debug"
+            if (isMingwX64) {
+                Pair(debugLibDir, "eucalyptus_core")
+            } else {
+                Pair(debugLibDir, "eucalyptus_core")
+            }
+        }
+        file("${project.rootDir}/target/release").exists() -> {
+            val releaseLibDir = "${project.rootDir}/target/release"
+            if (isMingwX64) {
+                Pair(releaseLibDir, "eucalyptus_core")
+            } else {
+                Pair(releaseLibDir, "eucalyptus_core")
+            }
+        }
+        file("${project.rootDir}/libs").exists() -> {
+            val libsDir = "${project.rootDir}/libs"
+            if (isMingwX64) {
+                Pair(libsDir, "eucalyptus_core")
+            } else {
+                Pair(libsDir, "eucalyptus_core")
+            }
+        }
+        else -> {
+            println("WARNING: Rust library directory not found!")
+            Pair(null, null)
+        }
     }

Large diffs are not rendered by default. Showing the first 50 of 100 lines. Show full diff