Stop using __has_include<Cocoa/Cocoa.h>

__has_include seems to cause problems with goma builds.
Instead, detect iOS vs MacOS using TargetConditionals.h. Also use
plain C++ instead of Objective-C++ when possible.

Bug: angleproject:3439
Bug: 1015591
Change-Id: I816624e0cdc54ad3a18d3891b4efecf6fe640574
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1894243
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
This commit is contained in:
James Darpinian 2019-10-31 16:50:23 -07:00 коммит произвёл Commit Bot
Родитель 5c0e6e52bd
Коммит 012d151960
9 изменённых файлов: 54 добавлений и 26 удалений

Просмотреть файл

@ -114,4 +114,13 @@
# endif // defined(__GNUC__) || defined(__clang__)
#endif // !defined(ANGLE_LIKELY) || !defined(ANGLE_UNLIKELY)
#ifdef ANGLE_PLATFORM_APPLE
# include <TargetConditionals.h>
# if TARGET_OS_OSX
# define ANGLE_PLATFORM_MACOS 1
# elif TARGET_OS_IOS
# define ANGLE_PLATFORM_IOS 1
# endif
#endif
#endif // COMMON_PLATFORM_H_

Просмотреть файл

@ -4,9 +4,11 @@
// found in the LICENSE file.
//
// SystemInfo_mac.cpp: implementation of the Mac-specific parts of SystemInfo.h
// SystemInfo_mac.mm: implementation of the Mac-specific parts of SystemInfo.h
#if __has_include(<Cocoa/Cocoa.h>)
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_MACOS
# include "gpu_info_util/SystemInfo_internal.h"
@ -242,4 +244,4 @@ bool GetSystemInfo(SystemInfo *info)
} // namespace angle
#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS

Просмотреть файл

@ -6,7 +6,9 @@
// DeviceCGL.cpp: CGL implementation of egl::Device
#if __has_include(<Cocoa/Cocoa.h>)
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_MACOS
# include "libANGLE/renderer/gl/cgl/DeviceCGL.h"
@ -56,4 +58,4 @@ void DeviceCGL::generateExtensions(egl::DeviceExtensions *outExtensions) const
} // namespace rx
#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS

Просмотреть файл

@ -6,7 +6,9 @@
// DisplayCGL.mm: CGL implementation of egl::Display
#if __has_include(<Cocoa/Cocoa.h>)
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_MACOS
# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
@ -446,4 +448,4 @@ void DisplayCGL::populateFeatureList(angle::FeatureList *features)
}
}
#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS

Просмотреть файл

@ -7,13 +7,15 @@
// PBufferSurfaceCGL.cpp: an implementation of PBuffers created from IOSurfaces using
// EGL_ANGLE_iosurface_client_buffer
#if __has_include(<Cocoa/Cocoa.h>)
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_MACOS
# include "libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.h"
# import <Cocoa/Cocoa.h>
# include <IOSurface/IOSurface.h>
# include <OpenGL/CGLIOSurface.h>
# include <OpenGL/OpenGL.h>
# include "common/debug.h"
# include "libANGLE/AttributeMap.h"
@ -333,4 +335,4 @@ bool IOSurfaceSurfaceCGL::hasEmulatedAlphaChannel() const
} // namespace rx
#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS

Просмотреть файл

@ -9,11 +9,15 @@
#include "libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h"
#include "common/debug.h"
#include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/FramebufferGL.h"
#include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/StateManagerGL.h"
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_MACOS
# include "common/debug.h"
# include "libANGLE/renderer/gl/FramebufferGL.h"
# include "libANGLE/renderer/gl/FunctionsGL.h"
# include "libANGLE/renderer/gl/RendererGL.h"
# include "libANGLE/renderer/gl/StateManagerGL.h"
namespace rx
{
@ -29,8 +33,7 @@ PbufferSurfaceCGL::PbufferSurfaceCGL(const egl::SurfaceState &state,
mStateManager(renderer->getStateManager()),
mColorRenderbuffer(0),
mDSRenderbuffer(0)
{
}
{}
PbufferSurfaceCGL::~PbufferSurfaceCGL()
{
@ -98,9 +101,7 @@ egl::Error PbufferSurfaceCGL::releaseTexImage(const gl::Context *context, EGLint
return egl::NoError();
}
void PbufferSurfaceCGL::setSwapInterval(EGLint interval)
{
}
void PbufferSurfaceCGL::setSwapInterval(EGLint interval) {}
EGLint PbufferSurfaceCGL::getWidth() const
{
@ -141,3 +142,5 @@ FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::Context *
}
} // namespace rx
#endif // ANGLE_PLATFORM_MACOS

Просмотреть файл

@ -8,7 +8,11 @@
#include "libANGLE/renderer/gl/cgl/RendererCGL.h"
#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_MACOS
# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
namespace rx
{
@ -27,3 +31,5 @@ WorkerContext *RendererCGL::createWorkerContext(std::string *infoLog)
}
} // namespace rx
#endif // ANGLE_PLATFORM_MACOS

Просмотреть файл

@ -6,7 +6,9 @@
// WindowSurfaceCGL.cpp: CGL implementation of egl::Surface for windows
#if __has_include(<Cocoa/Cocoa.h>)
#include "common/platform.h"
#ifdef ANGLE_PLATFORM_MACOS
# include "libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h"
@ -337,4 +339,4 @@ FramebufferImpl *WindowSurfaceCGL::createDefaultFramebuffer(const gl::Context *c
} // namespace rx
#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS

Просмотреть файл

@ -854,11 +854,11 @@ libangle_gl_cgl_sources = [
"src/libANGLE/renderer/gl/cgl/DeviceCGL.h",
"src/libANGLE/renderer/gl/cgl/DisplayCGL.mm",
"src/libANGLE/renderer/gl/cgl/DisplayCGL.h",
"src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.mm",
"src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp",
"src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.h",
"src/libANGLE/renderer/gl/cgl/RendererCGL.mm",
"src/libANGLE/renderer/gl/cgl/RendererCGL.cpp",
"src/libANGLE/renderer/gl/cgl/RendererCGL.h",
"src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm",
"src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.cpp",
"src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h",
"src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm",
"src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h",