diff options
Diffstat (limited to 'platform/osx')
-rw-r--r-- | platform/osx/SCsub | 7 | ||||
-rw-r--r-- | platform/osx/crash_handler_osx.mm | 12 | ||||
-rw-r--r-- | platform/osx/detect.py | 29 | ||||
-rw-r--r-- | platform/osx/export/export.cpp | 16 | ||||
-rw-r--r-- | platform/osx/os_osx.h | 5 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 44 |
6 files changed, 64 insertions, 49 deletions
diff --git a/platform/osx/SCsub b/platform/osx/SCsub index 029e3d808c..4dfa46528a 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -7,9 +7,10 @@ def make_debug(target, source, env): if (env["macports_clang"] != 'no'): mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] - os.system(mpprefix + '/libexec/llvm-' + mpclangver + '/bin/llvm-dsymutil %s -o %s.dSYM' % (target[0], target[0])) + os.system(mpprefix + '/libexec/llvm-' + mpclangver + '/bin/llvm-dsymutil {0} -o {0}.dSYM'.format(target[0])) else: - os.system('dsymutil %s -o %s.dSYM' % (target[0], target[0])) + os.system('dsymutil {0} -o {0}.dSYM'.format(target[0])) + os.system('strip -u -r {0}'.format(target[0])) files = [ 'crash_handler_osx.mm', @@ -23,6 +24,6 @@ files = [ prog = env.add_program('#bin/godot', files) -if env["debug_symbols"] == "full" or env["debug_symbols"] == "yes": +if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]: env.AddPostAction(prog, make_debug) diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm index d757674a9b..99ce25adfb 100644 --- a/platform/osx/crash_handler_osx.mm +++ b/platform/osx/crash_handler_osx.mm @@ -35,8 +35,7 @@ #include <string.h> #include <unistd.h> -// Note: Dump backtrace in 32bit mode is getting a bus error on the fgets by the ->execute, so enable only on 64bit -#if defined(DEBUG_ENABLED) && defined(__x86_64__) +#if defined(DEBUG_ENABLED) #define CRASH_HANDLER_ENABLED 1 #endif @@ -50,13 +49,8 @@ #include <mach-o/dyld.h> #include <mach-o/getsect.h> -#ifdef __x86_64__ static uint64_t load_address() { const struct segment_command_64 *cmd = getsegbyname("__TEXT"); -#else -static uint32_t load_address() { - const struct segment_command *cmd = getsegbyname("__TEXT"); -#endif char full_path[1024]; uint32_t size = sizeof(full_path); @@ -120,11 +114,7 @@ static void handle_crash(int sig) { args.push_back("-o"); args.push_back(_execpath); args.push_back("-arch"); -#ifdef __x86_64__ args.push_back("x86_64"); -#else - args.push_back("i386"); -#endif args.push_back("-l"); snprintf(str, 1024, "%p", load_addr); args.push_back(str); diff --git a/platform/osx/detect.py b/platform/osx/detect.py index bb601abd40..3237cef711 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -19,11 +19,12 @@ def can_build(): def get_opts(): - from SCons.Variables import EnumVariable + from SCons.Variables import BoolVariable, EnumVariable return [ ('osxcross_sdk', 'OSXCross SDK version', 'darwin14'), EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')), + BoolVariable('separate_debug_symbols', 'Create a separate file with the debug symbols', False), ] @@ -56,22 +57,15 @@ def configure(env): ## Architecture - is64 = sys.maxsize > 2**32 - if (env["bits"] == "default"): - env["bits"] = "64" if is64 else "32" + # Mac OS X no longer runs on 32-bit since 10.7 which is unsupported since 2014 + # As such, we only support 64-bit + env["bits"] == "64" ## Compiler configuration if "OSXCROSS_ROOT" not in os.environ: # regular native build - if (env["bits"] == "fat"): - env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64']) - env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64']) - elif (env["bits"] == "32"): - env.Append(CCFLAGS=['-arch', 'i386']) - env.Append(LINKFLAGS=['-arch', 'i386']) - else: # 64-bit, default - env.Append(CCFLAGS=['-arch', 'x86_64']) - env.Append(LINKFLAGS=['-arch', 'x86_64']) + env.Append(CCFLAGS=['-arch', 'x86_64']) + env.Append(LINKFLAGS=['-arch', 'x86_64']) if (env["macports_clang"] != 'no'): mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] @@ -85,14 +79,7 @@ def configure(env): else: # osxcross build root = os.environ.get("OSXCROSS_ROOT", 0) - if env["bits"] == "fat": - basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" - env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64']) - env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64']) - elif env["bits"] == "32": - basecmd = root + "/target/bin/i386-apple-" + env["osxcross_sdk"] + "-" - else: # 64-bit, default - basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" + basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" ccache_path = os.environ.get("CCACHE") if ccache_path == None: diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index c4efa1f0ff..7985a241e4 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -101,15 +101,7 @@ void EditorExportPlatformOSX::get_preset_features(const Ref<EditorExportPreset> r_features->push_back("etc2"); } - int bits = p_preset->get("application/bits_mode"); - - if (bits == 0 || bits == 1) { - r_features->push_back("64"); - } - - if (bits == 0 || bits == 2) { - r_features->push_back("32"); - } + r_features->push_back("64"); } void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) { @@ -125,7 +117,6 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options) r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/version"), "1.0")); r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), "")); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/bits_mode", PROPERTY_HINT_ENUM, "Fat (32 & 64 bits),64 bits,32 bits"), 0)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "display/high_res"), false)); #ifdef OSX_ENABLED @@ -323,11 +314,8 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p ERR_FAIL_COND_V(!src_pkg_zip, ERR_CANT_OPEN); int ret = unzGoToFirstFile(src_pkg_zip); - String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + "."; - int bits_mode = p_preset->get("application/bits_mode"); - binary_to_use += String(bits_mode == 0 ? "fat" : bits_mode == 1 ? "64" : "32"); + String binary_to_use = "godot_osx_" + String(p_debug ? "debug" : "release") + ".64"; - print_line("binary: " + binary_to_use); String pkg_name; if (p_preset->get("application/name") != "") pkg_name = p_preset->get("application/name"); // app_name diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index d9ad0a7db8..aa8db8f300 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -167,6 +167,7 @@ public: virtual void set_window_title(const String &p_title); virtual Size2 get_window_size() const; + virtual Size2 get_real_window_size() const; virtual void set_icon(const Ref<Image> &p_icon); @@ -221,6 +222,8 @@ public: virtual bool is_window_minimized() const; virtual void set_window_maximized(bool p_enabled); virtual bool is_window_maximized() const; + virtual void set_window_always_on_top(bool p_enabled); + virtual bool is_window_always_on_top() const; virtual void request_attention(); virtual String get_joy_guid(int p_device) const; @@ -229,6 +232,8 @@ public: virtual void set_ime_position(const Point2 &p_pos); virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp); + virtual String get_unique_id() const; + virtual OS::PowerState get_power_state(); virtual int get_power_seconds_left(); virtual int get_power_percent_left(); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index ab54f62045..4c459772aa 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -963,6 +963,30 @@ void OS_OSX::set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_ } } +String OS_OSX::get_unique_id() const { + + static String serial_number; + + if (serial_number.empty()) { + io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); + CFStringRef serialNumberAsCFString = NULL; + if (platformExpert) { + serialNumberAsCFString = (CFStringRef)IORegistryEntryCreateCFProperty(platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0); + IOObjectRelease(platformExpert); + } + + NSString *serialNumberAsNSString = nil; + if (serialNumberAsCFString) { + serialNumberAsNSString = [NSString stringWithString:(NSString *)serialNumberAsCFString]; + CFRelease(serialNumberAsCFString); + } + + serial_number = [serialNumberAsNSString UTF8String]; + } + + return serial_number; +} + void OS_OSX::set_ime_position(const Point2 &p_pos) { im_position = p_pos; } @@ -1845,6 +1869,12 @@ Size2 OS_OSX::get_window_size() const { return window_size; }; +Size2 OS_OSX::get_real_window_size() const { + + NSRect frame = [window_object frame]; + return Size2(frame.size.width, frame.size.height); +} + void OS_OSX::set_window_size(const Size2 p_size) { Size2 size = p_size; @@ -1936,6 +1966,20 @@ void OS_OSX::move_window_to_foreground() { [window_object orderFrontRegardless]; } +void OS_OSX::set_window_always_on_top(bool p_enabled) { + if (is_window_always_on_top() == p_enabled) + return; + + if (p_enabled) + [window_object setLevel:NSFloatingWindowLevel]; + else + [window_object setLevel:NSNormalWindowLevel]; +} + +bool OS_OSX::is_window_always_on_top() const { + return [window_object level] == NSFloatingWindowLevel; +} + void OS_OSX::request_attention() { [NSApp requestUserAttention:NSCriticalRequest]; |