Build x86 and x64 variants of windows dlls.
This commit is contained in:
31
build.gradle
31
build.gradle
@@ -51,12 +51,33 @@ libraries {
|
|||||||
args("-lcurses", "-arch", "x86_64", "-arch", "i386", "-o", outputFile)
|
args("-lcurses", "-arch", "x86_64", "-arch", "i386", "-o", outputFile)
|
||||||
}
|
}
|
||||||
} else if (org.gradle.internal.os.OperatingSystem.current().windows) {
|
} else if (org.gradle.internal.os.OperatingSystem.current().windows) {
|
||||||
i386.spec {
|
all {
|
||||||
baseName = 'native-platform-windows-i386'
|
spec {
|
||||||
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include"])
|
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include"])
|
||||||
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"])
|
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"])
|
||||||
args("/DWIN32")
|
args("/DWIN32")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def out = new ByteArrayOutputStream()
|
||||||
|
exec {
|
||||||
|
commandLine "cl.exe", "/?"
|
||||||
|
errorOutput = out
|
||||||
|
standardOutput = new ByteArrayOutputStream()
|
||||||
|
}
|
||||||
|
def header = out.toString().readLines().head()
|
||||||
|
if (header.endsWith("for 80x86") || header.endsWith("for x86")) {
|
||||||
|
i386.spec {
|
||||||
|
baseName = 'native-platform-windows-i386'
|
||||||
|
}
|
||||||
|
} else if (header.endsWith("for x64")) {
|
||||||
|
amd64.spec {
|
||||||
|
baseName = 'native-platform-windows-amd64'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Cannot determine compiler's target architecture")
|
||||||
|
}
|
||||||
|
|
||||||
} else if (org.gradle.internal.os.OperatingSystem.current().linux) {
|
} else if (org.gradle.internal.os.OperatingSystem.current().linux) {
|
||||||
all {
|
all {
|
||||||
spec {
|
spec {
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ public abstract class Platform {
|
|||||||
if (getArchitecture().equals("x86")) {
|
if (getArchitecture().equals("x86")) {
|
||||||
return "native-platform-windows-i386.dll";
|
return "native-platform-windows-i386.dll";
|
||||||
}
|
}
|
||||||
|
if (getArchitecture().equals("amd64")) {
|
||||||
|
return "native-platform-windows-amd64.dll";
|
||||||
|
}
|
||||||
throw new NativeIntegrationUnavailableException(String.format(
|
throw new NativeIntegrationUnavailableException(String.format(
|
||||||
"Native integration is not available for this architecture (%s) on Windows.", getArchitecture()));
|
"Native integration is not available for this architecture (%s) on Windows.", getArchitecture()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user