Skip to content

Commit c0aaaee

Browse files
jcfrjamesobutler
andcommitted
cmake/tests: fix PythonQt_QtAll exports and QtCore wrap handling
make PythonQt_QtAll export macro treat both PYTHONQT_QTALL_EXPORTS and PYTHONQT_EXPORTS as build context Co-authored-by: James Butler <james.butler@revvity.com>
1 parent 4a36f73 commit c0aaaee

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

extensions/PythonQt_QtAll/PythonQt_QtAll.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,27 @@
3333
*
3434
*/
3535

36-
#ifdef WIN32
37-
#ifdef PYTHONQT_QTALL_EXPORTS
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)
3843
#define PYTHONQT_QTALL_EXPORT __declspec(dllexport)
3944
#else
4045
#define PYTHONQT_QTALL_EXPORT __declspec(dllimport)
4146
#endif
4247
#else
43-
#define PYTHONQT_QTALL_EXPORT
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
4453
#endif
4554

4655
namespace PythonQt_QtAll {
47-
//! initialize the Qt binding
56+
//! Initialize the Qt bindings enabled at configuration time
4857
PYTHONQT_QTALL_EXPORT void init();
4958
}
5059

0 commit comments

Comments
 (0)