-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.gradle.kts
68 lines (58 loc) · 2.45 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import org.gradle.internal.os.OperatingSystem
import org.gradle.jvm.tasks.Jar
subprojects {
group = "de.fabmax"
version = "2.5.1"
if (name != "physx-jni-android") {
apply(plugin = "java-library")
tasks["jar"].apply {
this as Jar
from("$rootDir/LICENSE", "$rootDir/NOTICE.md")
}
}
}
// generates the cmake project for building windows platform native libraries
tasks.register("generateNativeProject") {
group = "native build"
val os = OperatingSystem.current()
when {
os.isWindows -> dependsOn(":physx-jni-natives-windows:generateNativeProjectWindows")
os.isLinux -> dependsOn(":physx-jni-natives-linux:generateNativeProjectLinux")
os.isMacOsX -> {
dependsOn(":physx-jni-natives-macos:generateNativeProjectMacos")
dependsOn(":physx-jni-natives-macos-arm64:generateNativeProjectMacosArm64")
}
else -> throw IllegalStateException("Unsupported OS: $os; for now, only Windows and Linux are supported")
}
doFirst {
if (!File("$projectDir/PhysX/physx").exists()) {
throw IllegalStateException("Native PhysX project dir does not exist. Run 'git submodule update --init' first")
}
}
}
tasks.register("buildNativeProject") {
group = "native build"
dependsOn(":physx-jni:generateJniNativeBindings")
val os = OperatingSystem.current()
when {
os.isWindows -> dependsOn(":physx-jni-natives-windows:buildNativeProjectWindows")
os.isLinux -> dependsOn(":physx-jni-natives-linux:buildNativeProjectLinux")
os.isMacOsX -> {
dependsOn(":physx-jni-natives-macos:buildNativeProjectMacos")
dependsOn(":physx-jni-natives-macos-arm64:buildNativeProjectMacosArm64")
}
else -> throw IllegalStateException("Unsupported OS: $os; for now, only Windows and Linux are supported")
}
}
tasks.register("deleteNativeLibs") {
group = "native build"
dependsOn("generateNativeGlueCode")
doLast {
delete("$projectDir/physx-jni-natives-linux/src/main/resources")
delete("$projectDir/physx-jni-natives-linux-cuda/src/main/resources")
delete("$projectDir/physx-jni-natives-macos/src/main/resources")
delete("$projectDir/physx-jni-natives-macos-arm64/src/main/resources")
delete("$projectDir/physx-jni-natives-windows/src/main/resources")
delete("$projectDir/physx-jni-natives-windows-cuda/src/main/resources")
}
}