1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Compatibility: Add new macros for straightforward checking of minimum deployment target

This also fixes a bug introduced in f7c7225f5c
where the condition guarding the definition of traitCollectionDidChange
was incorrect. This function is never required if the deployment target
is at least 17.0.
This commit is contained in:
reuk 2024-11-04 15:57:00 +00:00
parent 8e086c7f05
commit 93640b63ff
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
7 changed files with 26 additions and 16 deletions

View file

@ -63,7 +63,7 @@ namespace CoreMidiHelpers
onlyOld
};
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_14_0)
#if JUCE_MAC_API_VERSION_MIN_REQUIRED_AT_LEAST (11, 0) || JUCE_IOS_API_VERSION_MIN_REQUIRED_AT_LEAST (14, 0)
#define JUCE_HAS_OLD_COREMIDI_API 0
constexpr auto implementationStrategy = ImplementationStrategy::onlyNew;
#else

View file

@ -564,14 +564,6 @@ private:
Class klass = nullptr;
};
// Expands to true if the API of the specified version is available at build time, false otherwise
#define JUCE_MAC_API_VERSION_CAN_BE_BUILT(major, minor) \
major * 10'000 + minor * 100 <= MAC_OS_X_VERSION_MAX_ALLOWED
// Expands to true if the API of the specified version is available at build time, false otherwise
#define JUCE_IOS_API_VERSION_CAN_BE_BUILT(major, minor) \
major * 10'000 + minor * 100 <= __IPHONE_OS_VERSION_MAX_ALLOWED
#if JUCE_IOS
// Defines a function that will check the requested version both at

View file

@ -132,7 +132,23 @@
//==============================================================================
#if JUCE_MAC || JUCE_IOS
#if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG))
// Expands to true if the API of the specified version is available at build time, false otherwise
#define JUCE_MAC_API_VERSION_CAN_BE_BUILT(major, minor) \
((major) * 10000 + (minor) * 100 <= MAC_OS_X_VERSION_MAX_ALLOWED)
// Expands to true if the API of the specified version is available at build time, false otherwise
#define JUCE_IOS_API_VERSION_CAN_BE_BUILT(major, minor) \
((major) * 10000 + (minor) * 100 <= __IPHONE_OS_VERSION_MAX_ALLOWED)
// Expands to true if the deployment target is greater or equal to the specified version, false otherwise
#define JUCE_MAC_API_VERSION_MIN_REQUIRED_AT_LEAST(major, minor) \
((major) * 10000 + (minor) * 100 <= MAC_OS_X_VERSION_MIN_REQUIRED)
// Expands to true if the deployment target is greater or equal to the specified version, false otherwise
#define JUCE_IOS_API_VERSION_MIN_REQUIRED_AT_LEAST(major, minor) \
((major) * 10000 + (minor) * 100 <= __IPHONE_OS_VERSION_MIN_REQUIRED)
#if defined (DEBUG) || defined (_DEBUG) || ! (defined (NDEBUG) || defined (_NDEBUG))
#define JUCE_DEBUG 1
#endif
@ -161,9 +177,9 @@
#endif
#if JUCE_MAC
#if ! defined (MAC_OS_VERSION_11_1)
#if ! JUCE_MAC_API_VERSION_CAN_BE_BUILT (11, 1)
#error "The macOS 11.1 SDK (Xcode 12.4+) is required to build JUCE apps. You can create apps that run on macOS 10.11+ by changing the deployment target."
#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11
#elif ! JUCE_MAC_API_VERSION_MIN_REQUIRED_AT_LEAST (10, 11)
#error "Building for OSX 10.10 and earlier is no longer supported!"
#endif
#endif

View file

@ -70,7 +70,7 @@
#import <IOKit/pwr_mgt/IOPMLib.h>
#import <MetalKit/MetalKit.h>
#if defined (MAC_OS_VERSION_14_4) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_14_4
#if JUCE_MAC_API_VERSION_MIN_REQUIRED_AT_LEAST (14, 4)
#import <ScreenCaptureKit/ScreenCaptureKit.h>
#endif

View file

@ -1028,7 +1028,7 @@ static void postTraitChangeNotification (UITraitCollection* previousTraitCollect
object: nil];
}
#if JUCE_IOS_API_VERSION_CAN_BE_BUILT (17, 0)
#if ! JUCE_IOS_API_VERSION_MIN_REQUIRED_AT_LEAST (17, 0)
- (void) traitCollectionDidChange: (UITraitCollection*) previousTraitCollection
{
[super traitCollectionDidChange: previousTraitCollection];

View file

@ -531,7 +531,7 @@ static Image createNSWindowSnapshot (NSWindow* nsWindow)
return image;
};
#if defined (MAC_OS_VERSION_14_4) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_14_4
#if JUCE_MAC_API_VERSION_MIN_REQUIRED_AT_LEAST (14, 4)
if (dlopen ("/System/Library/Frameworks/ScreenCaptureKit.framework/ScreenCaptureKit", RTLD_LAZY) == nullptr)
{

View file

@ -1198,9 +1198,11 @@ private:
auto& comp = *getComponent();
#if JUCE_MAC && (! defined (MAC_OS_VERSION_15_0) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_15_0)
#if JUCE_MAC
#if ! JUCE_MAC_API_VERSION_MIN_REQUIRED_AT_LEAST (15, 0)
// According to a warning triggered on macOS 15 and above this doesn't do anything!
[[(NSView*) comp.getWindowHandle() window] disableScreenUpdatesUntilFlush];
#endif
#endif
if (auto* oldCachedImage = CachedImage::get (comp))