summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/main.cpp25
-rw-r--r--platform/osx/detect.py6
-rw-r--r--thirdparty/README.md3
-rw-r--r--thirdparty/doctest/doctest.h6
-rw-r--r--thirdparty/doctest/patches/fix-arm64-mac.patch18
5 files changed, 44 insertions, 14 deletions
diff --git a/main/main.cpp b/main/main.cpp
index e60bdda18d..35aa99c720 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -397,16 +397,17 @@ void Main::print_help(const char *p_binary) {
int Main::test_entrypoint(int argc, char *argv[], bool &tests_need_run) {
#ifdef TOOLS_ENABLED // templates can't run unit test tool
- OS::get_singleton()->initialize();
- StringName::setup();
for (int x = 0; x < argc; x++) {
- if (strncmp(argv[x], "--test", 6)) {
+ if (strncmp(argv[x], "--test", 6) == 0) {
tests_need_run = true;
- return test_main(argc, argv);
+ OS::get_singleton()->initialize();
+ StringName::setup();
+ int status = test_main(argc, argv);
+ StringName::cleanup();
+ // TODO: fix OS::singleton cleanup
+ return status;
}
}
- StringName::cleanup();
- OS::get_singleton()->finalize();
#endif
tests_need_run = false;
return 0;
@@ -1829,7 +1830,7 @@ bool Main::start() {
print_line("Generating new docs...");
doc.save_classes(index_path, doc_data_classes);
- return FAILED;
+ return false;
}
if (_export_preset != "") {
@@ -1837,7 +1838,7 @@ bool Main::start() {
String err = "Command line includes export parameter option, but no destination path was given.\n";
err += "Please specify the binary's file path to export to. Aborting export.";
ERR_PRINT(err);
- return FAILED;
+ return false;
}
}
#endif
@@ -1859,7 +1860,7 @@ bool Main::start() {
if (!script_res->is_valid()) {
OS::get_singleton()->set_exit_code(1);
}
- return FAILED;
+ return false;
}
if (script_res->can_instance()) {
@@ -1878,7 +1879,7 @@ bool Main::start() {
script_loop->set_init_script(script_res);
main_loop = script_loop;
} else {
- return FAILED;
+ return false;
}
} else {
@@ -1892,7 +1893,7 @@ bool Main::start() {
if (!main_loop) {
if (!ClassDB::class_exists(main_loop_type)) {
DisplayServer::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type);
- return FAILED;
+ return false;
} else {
Object *ml = ClassDB::instance(main_loop_type);
ERR_FAIL_COND_V_MSG(!ml, false, "Can't instance MainLoop type.");
@@ -2251,7 +2252,7 @@ bool Main::start() {
OS::get_singleton()->set_main_loop(main_loop);
- return OK;
+ return true;
}
/* Main iteration
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 25d230fc89..d700bcd7f6 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -50,9 +50,11 @@ def configure(env):
if env["target"] == "release":
if env["optimize"] == "speed": # optimize for speed (default)
- env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize", "-msse2"])
+ env.Prepend(CCFLAGS=["-O3", "-fomit-frame-pointer", "-ftree-vectorize"])
else: # optimize for size
- env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize", "-msse2"])
+ env.Prepend(CCFLAGS=["-Os", "-ftree-vectorize"])
+ if env["arch"] != "arm64":
+ env.Prepend(CCFLAGS=["-msse2"])
if env["debug_symbols"] == "yes":
env.Prepend(CCFLAGS=["-g1"])
diff --git a/thirdparty/README.md b/thirdparty/README.md
index f5b44d7a39..c1b230cfb7 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -81,6 +81,9 @@ Files extracted from upstream source:
Extracted from .zip provided. Extracted license and header only.
+Important: Some files have Godot-made changes.
+They are marked with `// -- GODOT start --` and `// -- GODOT end --`
+comments.
## enet
diff --git a/thirdparty/doctest/doctest.h b/thirdparty/doctest/doctest.h
index 9444698286..e4fed12767 100644
--- a/thirdparty/doctest/doctest.h
+++ b/thirdparty/doctest/doctest.h
@@ -356,7 +356,13 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum'
#ifndef DOCTEST_BREAK_INTO_DEBUGGER
// should probably take a look at https://github.com/scottt/debugbreak
#ifdef DOCTEST_PLATFORM_MAC
+// -- GODOT start --
+#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__)
#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :)
+#else
+#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("brk #0");
+#endif
+// -- GODOT end --
#elif DOCTEST_MSVC
#define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak()
#elif defined(__MINGW32__)
diff --git a/thirdparty/doctest/patches/fix-arm64-mac.patch b/thirdparty/doctest/patches/fix-arm64-mac.patch
new file mode 100644
index 0000000000..f78014534f
--- /dev/null
+++ b/thirdparty/doctest/patches/fix-arm64-mac.patch
@@ -0,0 +1,18 @@
+diff --git a/thirdparty/doctest/doctest.h b/thirdparty/doctest/doctest.h
+index 9444698286..e4fed12767 100644
+--- a/thirdparty/doctest/doctest.h
++++ b/thirdparty/doctest/doctest.h
+@@ -356,7 +356,13 @@ DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum'
+ #ifndef DOCTEST_BREAK_INTO_DEBUGGER
+ // should probably take a look at https://github.com/scottt/debugbreak
+ #ifdef DOCTEST_PLATFORM_MAC
++// -- GODOT start --
++#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__)
+ #define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :)
++#else
++#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("brk #0");
++#endif
++// -- GODOT end --
+ #elif DOCTEST_MSVC
+ #define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak()
+ #elif defined(__MINGW32__)