• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
2// Copyright 2019 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// GPUTestConfig_mac.mm:
7//   Helper functions for GPUTestConfig that have to be compiled in ObjectiveC++
8
9#include "GPUTestConfig_mac.h"
10
11#import <Cocoa/Cocoa.h>
12
13#include "common/apple_platform_utils.h"
14
15// OSX 10.8 deprecates Gestalt but doesn't make the operatingSystemVersion property part of the
16// public interface of NSProcessInfo until 10.10. Add a forward declaration.
17#if !defined(MAC_OS_X_VERSION_10_10) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
18@interface NSProcessInfo (YosemiteSDK)
19@property(readonly) NSOperatingSystemVersion operatingSystemVersion;
20@end
21#endif
22
23namespace angle
24{
25
26void GetOperatingSystemVersionNumbers(int32_t *majorVersion, int32_t *minorVersion)
27{
28#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
29    Gestalt(gestaltSystemVersionMajor, reinterpret_cast<SInt32 *>(majorVersion));
30    Gestalt(gestaltSystemVersionMinor, reinterpret_cast<SInt32 *>(minorVersion));
31#else
32    if (ANGLE_APPLE_AVAILABLE_XC(10.10, 13.0))
33    {
34        NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
35        *majorVersion                    = static_cast<int32_t>(version.majorVersion);
36        *minorVersion                    = static_cast<int32_t>(version.minorVersion);
37    }
38    else
39    {
40        // This can only happen on 10.9
41        *majorVersion = 10;
42        *minorVersion = 9;
43    }
44#endif
45}
46
47}  // namespace angle
48