added support for x86_64-pc-windows-msvc 64-bit MSVC

This commit is contained in:
yellowhatpro 2023-04-05 17:09:36 +05:30 committed by thunderbiscuit
parent de88184b8c
commit 49e8fe461e
No known key found for this signature in database
GPG Key ID: 88253696EB836462
2 changed files with 28 additions and 1 deletions

View File

@ -4,11 +4,13 @@ package org.bitcoindevkit.plugins
val operatingSystem: OS = when { val operatingSystem: OS = when {
System.getProperty("os.name").contains("mac", ignoreCase = true) -> OS.MAC System.getProperty("os.name").contains("mac", ignoreCase = true) -> OS.MAC
System.getProperty("os.name").contains("linux", ignoreCase = true) -> OS.LINUX System.getProperty("os.name").contains("linux", ignoreCase = true) -> OS.LINUX
System.getProperty("os.name").contains("windows", ignoreCase = true) -> OS.WINDOWS
else -> OS.OTHER else -> OS.OTHER
} }
enum class OS { enum class OS {
MAC, MAC,
LINUX, LINUX,
WINDOWS,
OTHER, OTHER,
} }

View File

@ -35,6 +35,14 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
args(cargoArgs) args(cargoArgs)
} }
} }
else if(operatingSystem == OS.WINDOWS) {
exec {
workingDir("${project.projectDir}/../../bdk-ffi")
executable("cargo")
val cargoArgs: List<String> = listOf("build", "--profile", "release-smaller", "--target", "x86_64-pc-windows-msvc")
args(cargoArgs)
}
}
} }
// move the native libs build by cargo from target/.../release/ // move the native libs build by cargo from target/.../release/
@ -70,13 +78,30 @@ internal class UniFfiJvmPlugin : Plugin<Project> {
ext = "so" ext = "so"
) )
) )
} else if (operatingSystem == OS.WINDOWS) {
libsToCopy.add(
CopyMetadata(
targetDir = "x86_64-pc-windows-msvc",
resDir = "win32-x86-64",
ext = "dll"
)
)
}
val libName = when (operatingSystem) {
OS.WINDOWS -> {
"bdkffi"
}
else -> {
"libbdkffi"
}
} }
libsToCopy.forEach { libsToCopy.forEach {
doFirst { doFirst {
copy { copy {
with(it) { with(it) {
from("${project.projectDir}/../../target/${this.targetDir}/release-smaller/libbdkffi.${this.ext}") from("${project.projectDir}/../../target/${this.targetDir}/release-smaller/${libName}.${this.ext}")
into("${project.projectDir}/../../bdk-jvm/lib/src/main/resources/${this.resDir}/") into("${project.projectDir}/../../bdk-jvm/lib/src/main/resources/${this.resDir}/")
} }
} }