-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
129 lines (108 loc) · 4.41 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
plugins {
kotlin("multiplatform") version "1.9.21"
kotlin("plugin.serialization") version "1.9.21"
}
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots")
}
kotlin {
jvm {
jvmToolchain(17)
@Suppress("OPT_IN_USAGE")
mainRun {
mainClass.set("endorh.unican.gcrv.MainKt")
}
}
js(IR) {
binaries.executable()
browser {
@OptIn(ExperimentalDistributionDsl::class)
distribution {
outputDirectory.set(File("${rootDir}/dist/${project.name}"))
}
commonWebpackConfig {
mode = KotlinWebpackConfig.Mode.DEVELOPMENT
}
}
}
sourceSets {
val koolVersion = "0.12.1" // latest stable version
// val koolVersion = "0.13.0-SNAPSHOT" // newer but minor breaking changes might occur from time to time
val lwjglVersion = "3.3.3"
val physxJniVersion = "2.3.1"
// JVM target platforms, you can remove entries from the list in case you want to target
// only a specific platform
val targetPlatforms = listOf("natives-windows", "natives-linux", "natives-macos")
val commonMain by getting {
dependencies {
implementation("de.fabmax.kool:kool-core:$koolVersion")
implementation("de.fabmax.kool:kool-physics:$koolVersion")
implementation("com.ionspin.kotlin:bignum:0.3.8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
implementation("org.jetbrains.kotlin:kotlin-scripting-common")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
// Runtime librares
for (platform in targetPlatforms) {
// lwjgl runtime libs
runtimeOnly("org.lwjgl:lwjgl:$lwjglVersion:$platform")
listOf("glfw", "opengl", "jemalloc", "nfd", "stb", "vma", "shaderc").forEach { lib ->
runtimeOnly("org.lwjgl:lwjgl-$lib:$lwjglVersion:$platform")
}
// physx-jni runtime libs
runtimeOnly("de.fabmax:physx-jni:$physxJniVersion:$platform")
// use this for CUDA acceleration of physics demos (remove above physxJniRuntime dependency)
// requires CUDA enabled physx-jni library in directory kool-demo/libs
// grab the library from GitHub releases: https://github.com/fabmax/physx-jni/releases
// also make sure to use the same version as used by kool-physics
//runtimeOnly(files("${projectDir}/libs/physx-jni-natives-windows-cuda-2.2.1.jar"))
}
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}
val jsMain by getting {
dependencies { }
}
sourceSets.all {
languageSettings.apply {
progressiveMode = true
}
}
}
}
tasks["clean"].doLast {
delete("${rootDir}/dist/${project.name}")
}
tasks.register<JavaExec>("run") {
group = "application"
mainClass.set("de.fabmax.kool.demo.MainKt")
kotlin {
val main = targets["jvm"].compilations["main"]
dependsOn(main.compileAllTaskName)
classpath(
{ main.output.allOutputs.files },
{ configurations["jvmRuntimeClasspath"] }
)
}
}