Fixed a compilation issue under Windows and MacOS, added safeguards
This commit is contained in:
parent
4a6aa5dbf7
commit
5472576606
@ -33,14 +33,17 @@ switch (OperatingSystem.current()) {
|
||||
: 'linux'
|
||||
break
|
||||
case OperatingSystem.MAC_OS:
|
||||
project.ext.lwjglNatives = System.getProperty('os.arch').startsWith('aarch64') ? 'macos-arm64' : 'macos'
|
||||
lwjgl.localArch = System.getProperty('os.arch').startsWith('aarch64') ? 'macos-arm64' : 'macos'
|
||||
break
|
||||
case OperatingSystem.WINDOWS:
|
||||
def osArch = System.getProperty('os.arch')
|
||||
project.ext.lwjglNatives = osArch.contains('64')
|
||||
lwjgl.localArch = osArch.contains('64')
|
||||
? "windows${osArch.startsWith('aarch64') ? '-arm64' : ''}"
|
||||
: 'windows-x86'
|
||||
break
|
||||
default:
|
||||
logger.info "Unknown or unsupported OS type according to Gradle's org.gradle.internal.os.OperatingSystem: ${OperatingSystem.current()}"
|
||||
break
|
||||
}
|
||||
|
||||
configurations {
|
||||
@ -94,6 +97,14 @@ task lwjgl_addNativesToRuntimeOnly {
|
||||
logger.info 'Adding LWJGL native dependencies for platforms: {}', lwjgl.targets.sort().join(', ')
|
||||
}
|
||||
|
||||
if (lwjgl.targets.contains(null)) {
|
||||
if (lwjgl.localArch != null) {
|
||||
throw new GradleException("Requested local LWJGL natives; could not determine local architecture for OS ${OperatingSystem.current()} with os.arch ${System.getProperty('os.arch')}")
|
||||
} else {
|
||||
throw new GradleException("LWJGL targets resolved to ${lwjgl.targets}")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
lwjgl.targets.each { target ->
|
||||
lwjglNatives "org.lwjgl:lwjgl::natives-$target"
|
||||
|
Reference in New Issue
Block a user