The Battle for Wesnoth  1.19.5+dev
apple_version.mm
Go to the documentation of this file.
1 /*
2  Copyright (C) 2018 - 2024
3  by Martin HrubĂ˝ <hrubymar10@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #ifdef __APPLE__
17 
18 #include "apple_version.hpp"
19 
20 #import "game_version.hpp"
21 
22 #if defined(__APPLE__) && defined(__MACH__) && defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
23 #define __IPHONEOS__ (__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000)
24 #endif
25 
26 #import <Foundation/Foundation.h>
27 
28 #if defined(__IPHONEOS__)
29 #import <UIKit/UIKit.h>
30 #endif
31 
32 namespace desktop {
33 namespace apple {
34  std::string os_version() {
35 
36  //
37  // Standard Apple version
38  //
39 
40  std::string version_string;
41 #if defined(__IPHONEOS__)
42  version_string = "Apple iOS ";
43 #else
44  if (@available(macOS 10.12, *)) {
45  version_string = "Apple macOS ";
46  } else {
47  version_string = "Apple OS X ";
48  }
49 #endif
50  NSOperatingSystemVersion os_ver = [[NSProcessInfo processInfo] operatingSystemVersion];
51  version_string += version_info(os_ver.majorVersion, os_ver.minorVersion, os_ver.patchVersion);
52 
53  return version_string;
54  }
55 
56 } // end namespace apple
57 } // end namespace desktop
58 
59 #endif //end __APPLE__
Represents version numbers.
Interfaces for manipulating version numbers of engine, add-ons, etc.
std::string os_version()