diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-29 15:01:40 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-01 10:51:58 +0200 |
| commit | 430d02db24b95a56ae0acc6a9df6a0effe49da0d (patch) | |
| tree | 8713f11a51f42205dcf2d06894f7f9caa9a49cbe /sources/pyside2/libpyside | |
| parent | 26e4ba3639bac57b0481bd6bb3964b1afa340ab9 (diff) | |
Consolidate export/import macros
For the 3 libraries that need to export symbols,
(libshiboken, libpyside, pysidetest), fix up the
export/import macros to follow the Qt convention:
- Define generic export/import macros LIBSHIBOKEN_EX/IMPORT equivalent
to Q_DECL_EX/IMPORT. Remove definitions for the ancient g++ 4.X.
- Reuse those in libpyside, pysidetest as PYSIDE_EX/IMPORT and
PYSIDETEST_EX/IMPORT.
- While building, define some BUILD_ macro indicating export.
- Define the _API macros depending on the BUILD_ macro to be export or
import, respectively as is done in Qt. Remove the ugly hack in
pysidetest that tried to re-use the PYSIDE_API macro.
- Brush up the headers a bit.
Change-Id: I635891b7eec5a52a1dcf45022f7bfb6a9cfee83f
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/libpyside')
| -rw-r--r-- | sources/pyside2/libpyside/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | sources/pyside2/libpyside/pysidemacros.h | 31 |
2 files changed, 12 insertions, 21 deletions
diff --git a/sources/pyside2/libpyside/CMakeLists.txt b/sources/pyside2/libpyside/CMakeLists.txt index d6b20c45a..e31c87eef 100644 --- a/sources/pyside2/libpyside/CMakeLists.txt +++ b/sources/pyside2/libpyside/CMakeLists.txt @@ -100,7 +100,7 @@ set_target_properties(pyside2 PROPERTIES VERSION ${BINDING_API_VERSION} SOVERSION "${PYSIDE_SO_VERSION}" OUTPUT_NAME "pyside2${pyside2_SUFFIX}${SHIBOKEN_PYTHON_SHARED_LIBRARY_SUFFIX}" - DEFINE_SYMBOL PYSIDE_EXPORTS) + DEFINE_SYMBOL BUILD_LIBPYSIDE) if(${QT_MAJOR_VERSION} GREATER_EQUAL 6) set_property(TARGET pyside2 PROPERTY CXX_STANDARD 17) diff --git a/sources/pyside2/libpyside/pysidemacros.h b/sources/pyside2/libpyside/pysidemacros.h index 5b493a279..fcdfe3c6e 100644 --- a/sources/pyside2/libpyside/pysidemacros.h +++ b/sources/pyside2/libpyside/pysidemacros.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt for Python. @@ -40,25 +40,16 @@ #ifndef PYSIDEMACROS_H #define PYSIDEMACROS_H -#if defined _WIN32 - #if PYSIDE_EXPORTS - #define PYSIDE_API __declspec(dllexport) - #else - #if defined __MINGW32__ - #define PYSIDE_API - #else - #define PYSIDE_API __declspec(dllimport) - #endif - #endif - #define PYSIDE_DEPRECATED(func) __declspec(deprecated) func +#include <shibokenmacros.h> + +#define PYSIDE_EXPORT LIBSHIBOKEN_EXPORT +#define PYSIDE_IMPORT LIBSHIBOKEN_IMPORT +#define PYSIDE_DEPRECATED(func) SBK_DEPRECATED(func) + +#ifdef BUILD_LIBPYSIDE +# define PYSIDE_API PYSIDE_EXPORT #else - #if __GNUC__ >= 4 - #define PYSIDE_API __attribute__ ((visibility("default"))) - #define PYSIDE_DEPRECATED(func) func __attribute__ ((deprecated)) - #else - #define PYSIDE_API - #define PYSIDE_DEPRECATED(func) func - #endif +# define PYSIDE_API PYSIDE_IMPORT #endif -#endif +#endif // PYSIDEMACROS_H |
