summaryrefslogtreecommitdiff
path: root/modules/mono/editor/godotsharp_builds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mono/editor/godotsharp_builds.cpp')
-rw-r--r--modules/mono/editor/godotsharp_builds.cpp40
1 files changed, 35 insertions, 5 deletions
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp
index 00c780d1b7..a962d6df27 100644
--- a/modules/mono/editor/godotsharp_builds.cpp
+++ b/modules/mono/editor/godotsharp_builds.cpp
@@ -30,6 +30,7 @@
#include "godotsharp_builds.h"
+#include "core/os/os.h"
#include "core/vector.h"
#include "main/main.h"
@@ -323,10 +324,13 @@ bool GodotSharpBuilds::make_api_assembly(APIAssembly::Type p_api_type) {
String api_sln_file = api_sln_dir.plus_file(API_SOLUTION_NAME ".sln");
if (!DirAccess::exists(api_sln_dir) || !FileAccess::exists(api_sln_file)) {
- BindingsGenerator *gen = BindingsGenerator::get_singleton();
- bool gen_verbose = OS::get_singleton()->is_stdout_verbose();
+ BindingsGenerator bindings_generator;
- Error err = gen->generate_cs_api(api_sln_dir, gen_verbose);
+ if (!OS::get_singleton()->is_stdout_verbose()) {
+ bindings_generator.set_log_print_enabled(false);
+ }
+
+ Error err = bindings_generator.generate_cs_api(api_sln_dir);
if (err != OK) {
show_build_error_dialog("Failed to generate " API_SOLUTION_NAME " solution. Error: " + itos(err));
return false;
@@ -348,7 +352,7 @@ bool GodotSharpBuilds::make_api_assembly(APIAssembly::Type p_api_type) {
return true;
}
-bool GodotSharpBuilds::build_project_blocking(const String &p_config) {
+bool GodotSharpBuilds::build_project_blocking(const String &p_config, const Vector<String> &p_godot_defines) {
if (!FileAccess::exists(GodotSharpDirs::get_project_sln_path()))
return true; // No solution to build
@@ -363,6 +367,29 @@ bool GodotSharpBuilds::build_project_blocking(const String &p_config) {
pr.step("Building project solution", 0);
MonoBuildInfo build_info(GodotSharpDirs::get_project_sln_path(), p_config);
+
+ // Add Godot defines
+#ifdef WINDOWS_ENABLED
+ String constants = "GodotDefineConstants=\"";
+#else
+ String constants = "GodotDefineConstants=\\\"";
+#endif
+
+ for (int i = 0; i < p_godot_defines.size(); i++) {
+ constants += "GODOT_" + p_godot_defines[i].to_upper().replace("-", "_").replace(" ", "_").replace(";", "_") + ";";
+ }
+
+#ifdef REAL_T_IS_DOUBLE
+ constants += "GODOT_REAL_T_IS_DOUBLE;";
+#endif
+
+#ifdef WINDOWS_ENABLED
+ constants += "\"";
+#else
+ constants += "\\\"";
+#endif
+ build_info.custom_props.push_back(constants);
+
if (!GodotSharpBuilds::get_singleton()->build(build_info)) {
GodotSharpBuilds::show_build_error_dialog("Failed to build project solution");
return false;
@@ -390,7 +417,10 @@ bool GodotSharpBuilds::editor_build_callback() {
ERR_FAIL_COND_V(copy_err != OK, false);
}
- return build_project_blocking("Tools");
+ Vector<String> godot_defines;
+ godot_defines.push_back(OS::get_singleton()->get_name());
+ godot_defines.push_back(sizeof(void *) == 4 ? "32" : "64");
+ return build_project_blocking("Tools", godot_defines);
}
GodotSharpBuilds *GodotSharpBuilds::singleton = NULL;