cocoa: fix compilation on OS X 10.8

This commit is contained in:
Stefano Pigozzi 2014-07-14 07:20:49 +02:00
parent 9fadc92eb1
commit ac71cb8611
3 changed files with 35 additions and 4 deletions

View File

@ -22,10 +22,7 @@
#define MPV_MACOSX_COMPAT
#import <Cocoa/Cocoa.h>
#if !defined(MAC_OS_X_VERSION_10_8)
# define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1
#endif
#include "osdep/macosx_versions.h"
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8)
@interface NSArray (SubscriptingAdditions)

29
osdep/macosx_versions.h Normal file
View File

@ -0,0 +1,29 @@
/*
* This file is part of mpv.
*
* mpv is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MPV_MACOSX_VERSIONS
#define MPV_MACOSX_VERSIONS
#if !defined(MAC_OS_X_VERSION_10_8)
# define MAC_OS_X_VERSION_10_8 1080
#endif
#if !defined(MAC_OS_X_VERSION_10_9)
# define MAC_OS_X_VERSION_10_9 1090
#endif
#endif /* MPV_MACOSX_VERSIONS */

View File

@ -21,6 +21,7 @@
#include <OpenGL/OpenGL.h>
#include "cocoa_common.h"
#include "osdep/macosx_versions.h"
#include "gl_common.h"
struct cgl_context {
@ -57,8 +58,12 @@ static bool create_gl_context(struct MPGLContext *ctx)
CGLOpenGLProfile gl_vers_map[] = {
[2] = kCGLOGLPVersion_Legacy,
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
[3] = kCGLOGLPVersion_GL3_Core,
[4] = kCGLOGLPVersion_GL4_Core,
#else
[3] = kCGLOGLPVersion_3_2_Core,
#endif
};
int gl_major = MPGL_VER_GET_MAJOR(ctx->requested_gl_version);