Add static library versions of libdawn*

Chromium will want to have both static and shared library versions of
Dawn to use in non-component and component builds respectively.

The *_export.h files are modified to noop when *_SHARED_LIBRARY is not
defined so that the static library doesn't export symbols that aren't
imported in dependents (this would break compilation on Windows).

A dawn_library_combo is introduced in BUILD.gn that factors out all the
logic needed to produce shared libraries and handle the _EXPORT macros.

Also contains a fix to dawncpp to export only the methods that aren't
defined in the header (otherwise they get defined multiple times)

BUG=dawn:85

Change-Id: Ib747deb9308e1165dd66002487147ba279d3eac0
Reviewed-on: https://dawn-review.googlesource.com/c/3761
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2019-01-09 09:05:18 +00:00
committed by Commit Bot service account
parent 97d2a71684
commit bd48385d50
6 changed files with 209 additions and 156 deletions

View File

@@ -15,18 +15,22 @@
#ifndef DAWN_EXPORT_H_
#define DAWN_EXPORT_H_
#if defined(_WIN32)
# if defined(DAWN_IMPLEMENTATION)
# define DAWN_EXPORT __declspec(dllexport)
# else
# define DAWN_EXPORT __declspec(dllimport)
# endif
#else
# if defined(DAWN_IMPLEMENTATION)
# define DAWN_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_EXPORT
# endif
#endif
#if defined(DAWN_SHARED_LIBRARY)
# if defined(_WIN32)
# if defined(DAWN_IMPLEMENTATION)
# define DAWN_EXPORT __declspec(dllexport)
# else
# define DAWN_EXPORT __declspec(dllimport)
# endif
# else // defined(_WIN32)
# if defined(DAWN_IMPLEMENTATION)
# define DAWN_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_EXPORT
# endif
# endif // defined(_WIN32)
#else // defined(DAWN_SHARED_LIBRARY)
# define DAWN_EXPORT
#endif // defined(DAWN_SHARED_LIBRARY)
#endif // DAWN_EXPORT_H_

View File

@@ -15,18 +15,22 @@
#ifndef DAWNNATIVE_EXPORT_H_
#define DAWNNATIVE_EXPORT_H_
#if defined(_WIN32)
# if defined(DAWN_NATIVE_IMPLEMENTATION)
# define DAWN_NATIVE_EXPORT __declspec(dllexport)
# else
# define DAWN_NATIVE_EXPORT __declspec(dllimport)
# endif
#else
# if defined(DAWN_NATIVE_IMPLEMENTATION)
# define DAWN_NATIVE_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_NATIVE_EXPORT
# endif
#endif
#if defined(DAWN_NATIVE_SHARED_LIBRARY)
# if defined(_WIN32)
# if defined(DAWN_NATIVE_IMPLEMENTATION)
# define DAWN_NATIVE_EXPORT __declspec(dllexport)
# else
# define DAWN_NATIVE_EXPORT __declspec(dllimport)
# endif
# else // defined(_WIN32)
# if defined(DAWN_NATIVE_IMPLEMENTATION)
# define DAWN_NATIVE_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_NATIVE_EXPORT
# endif
# endif // defined(_WIN32)
#else // defined(DAWN_NATIVE_SHARED_LIBRARY)
# define DAWN_NATIVE_EXPORT
#endif // defined(DAWN_NATIVE_SHARED_LIBRARY)
#endif // DAWNNATIVE_EXPORT_H_

View File

@@ -15,18 +15,22 @@
#ifndef DAWNWIRE_EXPORT_H_
#define DAWNWIRE_EXPORT_H_
#if defined(_WIN32)
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __declspec(dllexport)
# else
# define DAWN_WIRE_EXPORT __declspec(dllimport)
# endif
#else
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_WIRE_EXPORT
# endif
#endif
#if defined(DAWN_WIRE_SHARED_LIBRARY)
# if defined(_WIN32)
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __declspec(dllexport)
# else
# define DAWN_WIRE_EXPORT __declspec(dllimport)
# endif
# else // defined(_WIN32)
# if defined(DAWN_WIRE_IMPLEMENTATION)
# define DAWN_WIRE_EXPORT __attribute__((visibility("default")))
# else
# define DAWN_WIRE_EXPORT
# endif
# endif // defined(_WIN32)
#else // defined(DAWN_WIRE_SHARED_LIBRARY)
# define DAWN_WIRE_EXPORT
#endif // defined(DAWN_WIRE_SHARED_LIBRARY)
#endif // DAWNWIRE_EXPORT_H_