diff --git a/modules/juce_audio_devices/native/juce_CoreMidi_mac.mm b/modules/juce_audio_devices/native/juce_CoreMidi_mac.mm index 38e6d3a650..c704e2afc8 100644 --- a/modules/juce_audio_devices/native/juce_CoreMidi_mac.mm +++ b/modules/juce_audio_devices/native/juce_CoreMidi_mac.mm @@ -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 diff --git a/modules/juce_core/native/juce_ObjCHelpers_mac.h b/modules/juce_core/native/juce_ObjCHelpers_mac.h index 1722b1fa97..f533412b37 100644 --- a/modules/juce_core/native/juce_ObjCHelpers_mac.h +++ b/modules/juce_core/native/juce_ObjCHelpers_mac.h @@ -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 diff --git a/modules/juce_core/system/juce_TargetPlatform.h b/modules/juce_core/system/juce_TargetPlatform.h index 03ba2e6cdd..0c55ad7c58 100644 --- a/modules/juce_core/system/juce_TargetPlatform.h +++ b/modules/juce_core/system/juce_TargetPlatform.h @@ -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 diff --git a/modules/juce_gui_basics/juce_gui_basics.cpp b/modules/juce_gui_basics/juce_gui_basics.cpp index 929bea9288..1aae6dce37 100644 --- a/modules/juce_gui_basics/juce_gui_basics.cpp +++ b/modules/juce_gui_basics/juce_gui_basics.cpp @@ -70,7 +70,7 @@ #import #import - #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 #endif diff --git a/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm b/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm index fa59bc9b62..e2d229f2a2 100644 --- a/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm +++ b/modules/juce_gui_basics/native/juce_UIViewComponentPeer_ios.mm @@ -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]; diff --git a/modules/juce_gui_basics/native/juce_Windowing_mac.mm b/modules/juce_gui_basics/native/juce_Windowing_mac.mm index 85c0eef6f2..6b18e9de82 100644 --- a/modules/juce_gui_basics/native/juce_Windowing_mac.mm +++ b/modules/juce_gui_basics/native/juce_Windowing_mac.mm @@ -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) { diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index cfed2105ae..482536916b 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -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))