dawn-cmake/src/common/xlib_with_undefs.h
David 'Digit' Turner 8605d2eb86 Enable Vulkan extensions for Linux, Windows, Android and Fuchsia.
This CL ensures that when <vulkan/vulkan.h> is included, the
appropriate VK_USE_PLATFORM_XXX macro is defined to enable the
declaration of platform-specific types and extensions.

Note that for Linux, this requires an xlib_with_undefs.h header
to remove annoying macros that are defined by <X11/X.h> (i.e.
Success, Always, None) and which prevent compilation of other
Dawn sources that use the same symbols as enum value names.

Change-Id: I0c8d95fe8043d75ba3f74789e0fe2e3e4a477703
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8961
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: David Turner <digit@google.com>
2019-07-17 08:22:19 +00:00

34 lines
1.1 KiB
C

// Copyright 2019 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef COMMON_XLIB_WITH_UNDEFS_H_
#define COMMON_XLIB_WITH_UNDEFS_H_
#include "common/Platform.h"
#if !defined(DAWN_PLATFORM_LINUX)
# error "xlib_with_undefs.h included on non-Linux"
#endif
// This header includes <X11/Xlib.h> but removes all the extra defines that conflict with
// identifiers in internal code. It should never be included in something that is part of the public
// interface.
#include <X11/Xlib.h>
#undef Success
#undef None
#undef Always
#endif // COMMON_XLIB_WITH_UNDEFS_H_