Skip to content

Commit

Permalink
Add JVM_DIRECTORY constant
Browse files Browse the repository at this point in the history
  • Loading branch information
CedNaru committed Oct 12, 2024
1 parent 776af38 commit 32ddbec
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/gd_kotlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ String GDKotlin::copy_new_file_to_user_dir(const String& file_name) {
unlink(file_user_path_global.utf8().get_data()); // we do not really care about errors here
#endif
Ref<DirAccess> dir_access {DirAccess::open(USER_DIRECTORY)};
dir_access->make_dir("jvm");
dir_access->make_dir(JVM_DIRECTORY);
dir_access->copy(file_res_path, file_user_path);
#ifndef __ANDROID__
}
Expand Down
2 changes: 1 addition & 1 deletion src/kotlin_editor_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void KotlinEditorExportPlugin::_export_begin(const HashSet<String>& p_features,
files_to_add.push_back(String(RES_DIRECTORY).path_join(ANDROID_USER_CODE_FILE));
_generate_export_configuration_file(jni::JvmType::ART);
} else if (is_ios_export) {
String base_ios_build_dir {String(RES_DIRECTORY).path_join("jvm/ios")};
String base_ios_build_dir {String(RES_DIRECTORY).path_join(JVM_DIRECTORY).path_join("ios")};
String base_ios_jdk_dir {base_ios_build_dir.path_join("ios-jdk").path_join(ios_jdk_version)};

_generate_export_configuration_file(jni::JvmType::GRAAL_NATIVE_IMAGE);
Expand Down
46 changes: 25 additions & 21 deletions src/lifecycle/paths.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
#ifndef GODOT_JVM_PATHS_H
#define GODOT_JVM_PATHS_H

static constexpr const char* DESKTOP_BOOTSTRAP_FILE {"jvm/godot-bootstrap.jar"};
static constexpr const char* DESKTOP_USER_CODE_FILE {"jvm/main.jar"};
// Needs this as a macro if we want to append it to all other paths.
#define JVM_DIRECTORY "jvm/"

static constexpr const char* LINUX_GRAAL_NATIVE_IMAGE_FILE {"jvm/usercode.so"};
static constexpr const char* LINUX_EMBEDDED_JRE_ARM_DIRECTORY {"jvm/jre-arm64-linux"};
static constexpr const char* LINUX_EMBEDDED_JRE_AMD_DIRECTORY {"jvm/jre-amd64-linux"};
static constexpr const char* USER_DIRECTORY {"user://"};
static constexpr const char* RES_DIRECTORY {"res://"};

static constexpr const char* EDITOR_BOOTSTRAP_PATH {"godot-bootstrap.jar"};
static constexpr const char* ENTRY_DIRECTORY {"res://build/generated/ksp"};
static constexpr const char* JVM_CONFIGURATION_PATH {"res://godot_kotlin_configuration.json"};


static constexpr const char* DESKTOP_BOOTSTRAP_FILE {JVM_DIRECTORY "godot-bootstrap.jar"};
static constexpr const char* DESKTOP_USER_CODE_FILE {JVM_DIRECTORY "main.jar"};

static constexpr const char* LINUX_GRAAL_NATIVE_IMAGE_FILE {JVM_DIRECTORY "usercode.so"};
static constexpr const char* LINUX_EMBEDDED_JRE_ARM_DIRECTORY {JVM_DIRECTORY "jre-arm64-linux"};
static constexpr const char* LINUX_EMBEDDED_JRE_AMD_DIRECTORY {JVM_DIRECTORY "jre-amd64-linux"};
static constexpr const char* LINUX_RELATIVE_JVM_LIB_PATH {"lib/server/libjvm.so"};

static constexpr const char* WINDOWS_GRAAL_NATIVE_IMAGE_FILE {"jvm/usercode.dll"};
static constexpr const char* WINDOWS_EMBEDDED_JRE_ARM_DIRECTORY {"jvm/jre-arm64-windows"};
static constexpr const char* WINDOWS_EMBEDDED_JRE_AMD_DIRECTORY {"jvm/jre-amd64-windows"};
static constexpr const char* WINDOWS_GRAAL_NATIVE_IMAGE_FILE {JVM_DIRECTORY "usercode.dll"};
static constexpr const char* WINDOWS_EMBEDDED_JRE_ARM_DIRECTORY {JVM_DIRECTORY "jre-arm64-windows"};
static constexpr const char* WINDOWS_EMBEDDED_JRE_AMD_DIRECTORY {JVM_DIRECTORY "jre-amd64-windows"};
static constexpr const char* WINDOWS_RELATIVE_JVM_LIB_PATH {"bin/server/jvm.dll"};

static constexpr const char* MACOS_GRAAL_NATIVE_IMAGE_FILE {"jvm/usercode.dylib"};
static constexpr const char* MACOS_EMBEDDED_JRE_ARM_DIRECTORY {"jvm/jre-arm64-macos"};
static constexpr const char* MACOS_EMBEDDED_JRE_AMD_DIRECTORY {"jvm/jre-amd64-macos"};
static constexpr const char* MACOS_GRAAL_NATIVE_IMAGE_FILE {JVM_DIRECTORY "usercode.dylib"};
static constexpr const char* MACOS_EMBEDDED_JRE_ARM_DIRECTORY {JVM_DIRECTORY "jre-arm64-macos"};
static constexpr const char* MACOS_EMBEDDED_JRE_AMD_DIRECTORY {JVM_DIRECTORY "jre-amd64-macos"};
static constexpr const char* MACOS_RELATIVE_JVM_LIB_PATH {"lib/server/libjvm.dylib"};

static constexpr const char* ANDROID_BOOTSTRAP_FILE {"jvm/godot-bootstrap-dex.jar"};
static constexpr const char* ANDROID_USER_CODE_FILE {"jvm/main-dex.jar"};
static constexpr const char* ANDROID_BOOTSTRAP_FILE {JVM_DIRECTORY "godot-bootstrap-dex.jar"};
static constexpr const char* ANDROID_USER_CODE_FILE {JVM_DIRECTORY "main-dex.jar"};
static constexpr const char* ANDROID_GRAAL_NATIVE_IMAGE_FILE {""};
static constexpr const char* ANDROID_RELATIVE_JVM_LIB_PATH {""};

static constexpr const char* IOS_BOOTSTRAP_FILE {""};
static constexpr const char* IOS_USER_CODE_FILE {""};
static constexpr const char* IOS_GRAAL_NATIVE_IMAGE_FILE {"jvm/usercode.a"};
static constexpr const char* IOS_GRAAL_NATIVE_IMAGE_FILE {JVM_DIRECTORY "usercode.a"};
static constexpr const char* IOS_RELATIVE_JVM_LIB_PATH {""};

#ifdef X11_ENABLED
Expand Down Expand Up @@ -84,11 +95,4 @@ static constexpr const char* RELATIVE_JVM_LIB_PATH {IOS_RELATIVE_JVM_LIB_PATH};

#endif

static constexpr const char* ENTRY_DIRECTORY {"res://build/generated/ksp"};
static constexpr const char* USER_DIRECTORY {"user://"};
static constexpr const char* RES_DIRECTORY {"res://"};

static constexpr const char* EDITOR_BOOTSTRAP_PATH {"godot-bootstrap.jar"};
static constexpr const char* JVM_CONFIGURATION_PATH {"res://godot_kotlin_configuration.json"};

#endif// GODOT_JVM_PATHS_H

0 comments on commit 32ddbec

Please sign in to comment.