diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-31 11:54:38 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-31 11:54:38 +0100 |
commit | 6946bc56ef422ae2de51200297f626c4751b06f5 (patch) | |
tree | 6567ea5c4904eab3133404962a33e9c5c6e48551 /main | |
parent | 099f127cc33c5daa9a3e36b8cdb407e32249b003 (diff) | |
parent | 55010a2d9f91798f08bd2deded9445a4354ee3ee (diff) |
Merge pull request #67309 from groud/implement_gdnative_interface_h_dump
Implement a way to dump the gdnative_interface.h file from the executable
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index dbaf42b3e4..ba42de6f1e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -36,6 +36,7 @@ #include "core/crypto/crypto.h" #include "core/debugger/engine_debugger.h" #include "core/extension/extension_api_dump.h" +#include "core/extension/gdnative_interface_dump.gen.h" #include "core/extension/native_extension_manager.h" #include "core/input/input.h" #include "core/input/input_map.h" @@ -199,6 +200,7 @@ static MovieWriter *movie_writer = nullptr; static bool disable_vsync = false; static bool print_fps = false; #ifdef TOOLS_ENABLED +static bool dump_gdnative_interface = false; static bool dump_extension_api = false; #endif bool profile_gpu = false; @@ -414,6 +416,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" --doctool [<path>] Dump the engine API reference to the given <path> (defaults to current dir) in XML format, merging if existing files are found.\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n"); + OS::get_singleton()->print(" --dump-gdextension-interface Generate GDExtension header file 'gdnative_interface.h' in the current folder. This file is the base file required to implement a GDExtension.\n"); OS::get_singleton()->print(" --dump-extension-api Generate JSON dump of the Godot API for GDExtension bindings named 'extension_api.json' in the current folder.\n"); OS::get_singleton()->print(" --startup-benchmark Benchmark the startup time and print it to console.\n"); OS::get_singleton()->print(" --startup-benchmark-file <path> Benchmark the startup time and save it to a given file in JSON format.\n"); @@ -1054,6 +1057,16 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph auto_build_solutions = true; editor = true; cmdline_tool = true; + } else if (I->get() == "--dump-gdextension-interface") { + // Register as an editor instance to use low-end fallback if relevant. + editor = true; + cmdline_tool = true; + dump_gdnative_interface = true; + print_line("Dumping gdnative interface header file"); + // Hack. Not needed but otherwise we end up detecting that this should + // run the project instead of a cmdline tool. + // Needs full refactoring to fix properly. + main_args.push_back(I->get()); } else if (I->get() == "--dump-extension-api") { // Register as an editor instance to use low-end fallback if relevant. editor = true; @@ -2557,8 +2570,15 @@ bool Main::start() { return false; } + if (dump_gdnative_interface) { + GDNativeInterfaceDump::generate_gdnative_interface_file("gdnative_interface.h"); + } + if (dump_extension_api) { NativeExtensionAPIDump::generate_extension_json_file("extension_api.json"); + } + + if (dump_gdnative_interface || dump_extension_api) { return false; } |