simplify and centralize SK_API

Attempt two, this time not setting visibility("default")
unless SKIA_IMPLEMENTATION is defined.

Bug: skia:8975
Change-Id: I8d4e2071f1a8ee8a5702ac62ffc4000379d4fc43
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207854
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2019-04-11 09:37:51 -05:00 committed by Skia Commit-Bot
parent 5816b3d45d
commit 7f960d2083
3 changed files with 24 additions and 38 deletions

View File

@ -13,6 +13,7 @@
#include <stdint.h>
#include <stddef.h>
#include "SkApi.h"
#ifdef __cplusplus
#define SK_C_PLUS_PLUS_BEGIN_GUARD extern "C" {
@ -23,22 +24,6 @@
#define SK_C_PLUS_PLUS_END_GUARD
#endif
#if !defined(SK_API)
#if defined(SKIA_DLL)
#if defined(_MSC_VER)
#if SKIA_IMPLEMENTATION
#define SK_API __declspec(dllexport)
#else
#define SK_API __declspec(dllimport)
#endif
#else
#define SK_API __attribute__((visibility("default")))
#endif
#else
#define SK_API
#endif
#endif
///////////////////////////////////////////////////////////////////////////////////////
SK_C_PLUS_PLUS_BEGIN_GUARD

21
include/core/SkApi.h Normal file
View File

@ -0,0 +1,21 @@
/*
* Copyright 2019 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkApi_DEFINED
#define SkApi_DEFINED
#if defined(SKIA_IMPLEMENTATION)
#if defined(_MSC_VER)
#define SK_API __declspec(dllexport)
#else
#define SK_API __attribute__((visibility("default")))
#endif
#else
#define SK_API
#endif
#endif//SkApi_DEFINED

View File

@ -10,6 +10,8 @@
#ifndef SkPreConfig_DEFINED
#define SkPreConfig_DEFINED
#include "SkApi.h"
// Allows embedders that want to disable macros that take arguments to just
// define that symbol to be one of these
#define SK_NOTHING_ARG1(arg1)
@ -175,26 +177,4 @@
#define SK_ARM_HAS_CRC32
#endif
//////////////////////////////////////////////////////////////////////
#if !defined(SKIA_IMPLEMENTATION)
#define SKIA_IMPLEMENTATION 0
#endif
#if !defined(SK_API)
#if defined(SKIA_DLL)
#if defined(_MSC_VER)
#if SKIA_IMPLEMENTATION
#define SK_API __declspec(dllexport)
#else
#define SK_API __declspec(dllimport)
#endif
#else
#define SK_API __attribute__((visibility("default")))
#endif
#else
#define SK_API
#endif
#endif
#endif