Skip to content

Commit

Permalink
Stop using __has_include<Cocoa/Cocoa.h>
Browse files Browse the repository at this point in the history
__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>
  • Loading branch information
jdarpinian authored and Commit Bot committed Nov 9, 2019
1 parent 5c0e6e5 commit 012d151
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 26 deletions.
9 changes: 9 additions & 0 deletions src/common/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
8 changes: 5 additions & 3 deletions src/gpu_info_util/SystemInfo_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -242,4 +244,4 @@ bool GetSystemInfo(SystemInfo *info)

} // namespace angle

#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS
6 changes: 4 additions & 2 deletions src/libANGLE/renderer/gl/cgl/DeviceCGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -56,4 +58,4 @@ void DeviceCGL::generateExtensions(egl::DeviceExtensions *outExtensions) const

} // namespace rx

#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS
6 changes: 4 additions & 2 deletions src/libANGLE/renderer/gl/cgl/DisplayCGL.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -446,4 +448,4 @@
}
}

#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -333,4 +335,4 @@ void destroy(const gl::Context *context) override

} // namespace rx

#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -29,8 +33,7 @@
mStateManager(renderer->getStateManager()),
mColorRenderbuffer(0),
mDSRenderbuffer(0)
{
}
{}

PbufferSurfaceCGL::~PbufferSurfaceCGL()
{
Expand Down Expand Up @@ -98,9 +101,7 @@
return egl::NoError();
}

void PbufferSurfaceCGL::setSwapInterval(EGLint interval)
{
}
void PbufferSurfaceCGL::setSwapInterval(EGLint interval) {}

EGLint PbufferSurfaceCGL::getWidth() const
{
Expand Down Expand Up @@ -141,3 +142,5 @@
}

} // namespace rx

#endif // ANGLE_PLATFORM_MACOS
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -27,3 +31,5 @@
}

} // namespace rx

#endif // ANGLE_PLATFORM_MACOS
6 changes: 4 additions & 2 deletions src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -337,4 +339,4 @@ - (void)drawInCGLContext:(CGLContextObj)glContext

} // namespace rx

#endif // __has_include(<Cocoa/Cocoa.h>)
#endif // ANGLE_PLATFORM_MACOS
6 changes: 3 additions & 3 deletions src/libGLESv2.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 012d151

Please sign in to comment.