Skip to content

Commit 2a0423a

Browse files
committed
update cmake: Simplify PythonQt_QtAll reusing PYTHONQT_EXPORT export macro
1 parent cb99b7e commit 2a0423a

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

extensions/PythonQt_QtAll/PythonQt_QtAll.h

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

36-
#include "PythonQtSystem.h" // For PYTHONQT_EXPORT
36+
// Export macro for the PythonQt_QtAll shared library.
37+
// When building the DLL, PYTHONQT_QTALL_EXPORTS is defined by the build system;
38+
// consumers of the DLL get __declspec(dllimport) / default visibility instead.
39+
#if defined(WIN32)
40+
#ifdef PYTHONQT_QTALL_EXPORTS
41+
#define PYTHONQT_QTALL_EXPORT __declspec(dllexport)
42+
#else
43+
#define PYTHONQT_QTALL_EXPORT __declspec(dllimport)
44+
#endif
45+
#else
46+
#ifdef PYTHONQT_QTALL_EXPORTS
47+
#define PYTHONQT_QTALL_EXPORT __attribute__((__visibility__("default")))
48+
#else
49+
#define PYTHONQT_QTALL_EXPORT
50+
#endif
51+
#endif
3752

3853
namespace PythonQt_QtAll {
3954
//! Initialize the Qt bindings enabled at configuration time
40-
PYTHONQT_EXPORT void init();
55+
PYTHONQT_QTALL_EXPORT void init();
4156
}
4257

4358
#endif

0 commit comments

Comments
 (0)