Browse Source

macOS: Initial support for macOS 11 and arm64

tags/2021-05-28
reuk 4 years ago
parent
commit
b27017a5e3
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
8 changed files with 36 additions and 13 deletions
  1. +5
    -0
      docs/CMake API.md
  2. +13
    -2
      modules/juce_core/native/juce_mac_Files.mm
  3. +1
    -2
      modules/juce_core/native/juce_mac_SystemStats.mm
  4. +0
    -5
      modules/juce_core/native/juce_osx_ObjCHelpers.h
  5. +3
    -1
      modules/juce_core/system/juce_PlatformDefs.h
  6. +2
    -0
      modules/juce_core/system/juce_SystemStats.h
  7. +5
    -1
      modules/juce_events/native/juce_mac_MessageManager.mm
  8. +7
    -2
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 5
- 0
docs/CMake API.md View File

@@ -119,6 +119,11 @@ provisioning profiles, which is achieved by passing the `-allowProvisioningUpdat

cmake --build build-ios --target <targetName> -- -allowProvisioningUpdates

### Building universal binaries for macOS

Building universal binaries that will run on both arm64 and x86_64 can be achieved by
configuring the CMake project with `"-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64"`.

### A note about compile definitions

Module options and plugin options that would previously have been set in the Projucer can be set on


+ 13
- 2
modules/juce_core/native/juce_mac_Files.mm View File

@@ -425,13 +425,23 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String&
StringArray params;
params.addTokens (parameters, true);
NSMutableDictionary* dict = [[NSMutableDictionary new] autorelease];
NSMutableArray* paramArray = [[NSMutableArray new] autorelease];
for (int i = 0; i < params.size(); ++i)
[paramArray addObject: juceStringToNS (params[i])];
#if (defined MAC_OS_X_VERSION_10_15) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
auto config = [NSWorkspaceOpenConfiguration configuration];
[config setCreatesNewApplicationInstance: YES];
config.arguments = paramArray;
[workspace openApplicationAtURL: filenameAsURL
configuration: config
completionHandler: nil];
return true;
#else
NSMutableDictionary* dict = [[NSMutableDictionary new] autorelease];
[dict setObject: paramArray
forKey: nsStringLiteral ("NSWorkspaceLaunchConfigurationArguments")];
@@ -439,6 +449,7 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String&
options: NSWorkspaceLaunchDefault | NSWorkspaceLaunchNewInstance
configuration: dict
error: nil];
#endif
}
if (file.exists())


+ 1
- 2
modules/juce_core/native/juce_mac_SystemStats.mm View File

@@ -137,9 +137,8 @@ SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
StringArray parts;
parts.addTokens (getOSXVersion(), ".", StringRef());
jassert (parts[0].getIntValue() == 10);
const int major = parts[1].getIntValue();
jassert (major > 2);
jassert ((parts[0].getIntValue() == 10 && major > 2) || parts[0].getIntValue() == 11);
return (OperatingSystemType) (major + MacOSX_10_4 - 4);
#endif


+ 0
- 5
modules/juce_core/native/juce_osx_ObjCHelpers.h View File

@@ -208,11 +208,6 @@ ReturnValue ObjCMsgSendSuper (struct objc_super* s, SEL sel, Params... params)
// These hacks are a workaround for newer Xcode builds which by default prevent calls to these objc functions..
typedef id (*MsgSendSuperFn) (struct objc_super*, SEL, ...);
inline MsgSendSuperFn getMsgSendSuperFn() noexcept { return (MsgSendSuperFn) (void*) objc_msgSendSuper; }
#if ! JUCE_IOS
typedef double (*MsgSendFPRetFn) (id, SEL op, ...);
inline MsgSendFPRetFn getMsgSendFPRetFn() noexcept { return (MsgSendFPRetFn) (void*) objc_msgSend_fpret; }
#endif
#endif
//==============================================================================


+ 3
- 1
modules/juce_core/system/juce_PlatformDefs.h View File

@@ -66,12 +66,14 @@ namespace juce
@see jassert()
*/
#define JUCE_BREAK_IN_DEBUGGER { ::kill (0, SIGTRAP); }
#elif JUCE_MAC && JUCE_CLANG && JUCE_ARM
#define JUCE_BREAK_IN_DEBUGGER { __builtin_debugtrap(); }
#elif JUCE_MSVC
#ifndef __INTEL_COMPILER
#pragma intrinsic (__debugbreak)
#endif
#define JUCE_BREAK_IN_DEBUGGER { __debugbreak(); }
#elif JUCE_GCC || JUCE_MAC
#elif JUCE_INTEL && (JUCE_GCC || JUCE_MAC)
#if JUCE_NO_INLINE_ASM
#define JUCE_BREAK_IN_DEBUGGER { }
#else


+ 2
- 0
modules/juce_core/system/juce_SystemStats.h View File

@@ -63,6 +63,8 @@ public:
MacOSX_10_12 = MacOSX | 12,
MacOSX_10_13 = MacOSX | 13,
MacOSX_10_14 = MacOSX | 14,
MacOSX_10_15 = MacOSX | 15,
MacOSX_11_0 = MacOSX | 16,
Win2000 = Windows | 1,
WinXP = Windows | 2,


+ 5
- 1
modules/juce_events/native/juce_mac_MessageManager.mm View File

@@ -144,7 +144,11 @@ private:
{
if (notification.userInfo != nil)
{
NSUserNotification* userNotification = [notification.userInfo objectForKey: nsStringLiteral ("NSApplicationLaunchUserNotificationKey")];
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
// NSUserNotification is deprecated from macOS 11, but there doesn't seem to be a
// replacement for NSApplicationLaunchUserNotificationKey returning a non-deprecated type
NSUserNotification* userNotification = notification.userInfo[NSApplicationLaunchUserNotificationKey];
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
if (userNotification != nil && userNotification.userInfo != nil)
didReceiveRemoteNotification (self, nil, [NSApplication sharedApplication], userNotification.userInfo);


+ 7
- 2
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -23,6 +23,11 @@
==============================================================================
*/
@interface NSEvent (DeviceDelta)
- (float)deviceDeltaX;
- (float)deviceDeltaY;
@end
//==============================================================================
#if defined (MAC_OS_X_VERSION_10_8) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8) \
&& USE_COREGRAPHICS_RENDERING && JUCE_COREGRAPHICS_DRAW_ASYNC
@@ -680,8 +685,8 @@ public:
}
else if ([ev respondsToSelector: @selector (deviceDeltaX)])
{
wheel.deltaX = checkDeviceDeltaReturnValue ((float) getMsgSendFPRetFn() (ev, @selector (deviceDeltaX)));
wheel.deltaY = checkDeviceDeltaReturnValue ((float) getMsgSendFPRetFn() (ev, @selector (deviceDeltaY)));
wheel.deltaX = checkDeviceDeltaReturnValue ([ev deviceDeltaX]);
wheel.deltaY = checkDeviceDeltaReturnValue ([ev deviceDeltaY]);
}
}
@catch (...)


Loading…
Cancel
Save