Setup
To build our module, you need to same dependencies as the ones described in the official Godot documentation.
Warning
To build godot 3 version on Windows you need scons < 4.2.0.
Make sure that Java is installed and its PATH set in your system as well (at least Java 9 is needed!).
-
Clone godot repo with the stable tag you want to develop for (3.5.2-stable in this example).
git clone git@github.com:godotengine/godot.git 3.5.2-stable --recursive
-
In the
godot-root
dir, run the following command:git submodule add git@github.com:utopia-rise/godot-kotlin-jvm.git modules/kotlin_jvm
-
From the
godot-root
dir, build the engine with our module:scons -j$(nproc) platform=x11 # your target platform
-
Build sample
- navigate to
<module-root>/harness/tests
- create embedded JVM:
- For amd64 systems:
jlink --add-modules java.base,java.logging --output jre-amd64
- For arm64 systems:
jlink --add-modules java.base,java.logging --output jre-arm64
- If you want to remote debug add module
jdk.jdwp.agent
to command. - If you want to enable jmx, add
jdk.management.agent
to command.
- Windows:
gradlew build
- Unix:
./gradlew build
- navigate to
-
In order to run the engine, run
godot.x11.tools.64
located in thebin
folder ofgodot-root
-
In order to debug your JVM code, you should start Godot with command line
--jvm-debug-port=XXXX
, whereXXXX
stands for the JMX port of you choice. You can then setup remote debug configuration in Intellij' IDEA.
Important things to note:
When you build a sample, it generates a godot-bootstrap.jar
in build/libs
. This jar is needed by the engine to function correctly. You need to copy this jar to <godot-root>/bin
. If you want to automate that, consider using the following gradle task in the samples build.gradle.kts
- but don't commit it!
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
If you build the libs from <module-root>/kt
then this copy task is already present and executed automatically for you.