Skip to content

Commit c82b515

Browse files
committed
update cmake: Simplify PythonQt_QtAll reusing PYTHONQT_EXPORT export macro
1 parent 10fd934 commit c82b515

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

extensions/PythonQt_QtAll/PythonQt_QtAll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void PythonQt_init_QtWebKit(PyObject*);
7676
#endif
7777

7878
namespace PythonQt_QtAll {
79-
PYTHONQT_EXPORT void init()
79+
PYTHONQT_QTALL_EXPORT void init()
8080
{
8181
#ifdef PYTHONQT_WITH_CORE
8282
PythonQt_init_QtCore(0);

extensions/PythonQt_QtAll/PythonQt_QtAll.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,28 @@
3333
*
3434
*/
3535

36-
#include "PythonQtSystem.h" // For PYTHONQT_EXPORT
36+
// Export macro for the PythonQt_QtAll symbols.
37+
// qmake builds define PYTHONQT_QTALL_EXPORTS for the dedicated QtAll DLL,
38+
// while CMake builds compile this source into the PythonQt target which defines
39+
// PYTHONQT_EXPORTS. Treat either define as "building" to avoid dllimport on
40+
// in-target function definitions.
41+
#if defined(WIN32)
42+
#if defined(PYTHONQT_QTALL_EXPORTS) || defined(PYTHONQT_EXPORTS)
43+
#define PYTHONQT_QTALL_EXPORT __declspec(dllexport)
44+
#else
45+
#define PYTHONQT_QTALL_EXPORT __declspec(dllimport)
46+
#endif
47+
#else
48+
#if defined(PYTHONQT_QTALL_EXPORTS) || defined(PYTHONQT_EXPORTS)
49+
#define PYTHONQT_QTALL_EXPORT __attribute__((__visibility__("default")))
50+
#else
51+
#define PYTHONQT_QTALL_EXPORT
52+
#endif
53+
#endif
3754

3855
namespace PythonQt_QtAll {
3956
//! Initialize the Qt bindings enabled at configuration time
40-
PYTHONQT_EXPORT void init();
57+
PYTHONQT_QTALL_EXPORT void init();
4158
}
4259

4360
#endif

0 commit comments

Comments
 (0)