Skip to content

[patched-9] Backport recent changes from MeVisLab/pythonqt #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 157 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
92e04f2
[Backport] Loop did never finish if the first entry didn't match, fix…
usiems Feb 13, 2020
3afa342
[Backport generator] Add default and copy constructor for QFontInfo a…
usiems Mar 16, 2020
3a2e9a7
[Backport generator] Avoid spaces at end of generated lines.
usiems Mar 27, 2020
0f4579f
[Backport] Use `quote` characters around includes of our headers.
dbrnz Aug 11, 2019
2e8421a
[Backport] Fix build with Python 3.8
krop Apr 9, 2020
3eecd22
[Backport] Fix memory leak
iakov Aug 9, 2020
cc167b9
[Backport] Make __enter__ and __exit__ slots work with "with" statements
usiems Aug 13, 2020
6351afb
[Backport generator] Create correct __enter__ and __exit__ methods fo…
usiems Aug 13, 2020
dca3d3b
[Backport] Add a hint about QByteArray/bytes conversion, use fake foo…
usiems Aug 14, 2020
28da8e0
[Backport] Avoid crash for certain types that have no wrapper because…
usiems Sep 22, 2020
137443e
[Backport] More potential leak fixes and build fix
gregor-anich-uibk Oct 9, 2020
0a61c45
[Backport] Allow setting PYTHON_VERSION and PYTHON_DIR when including…
gregor-anich-uibk Oct 10, 2020
b72e1b9
[Backport] Fixed mingw build issues
githubuser0xFFFF Sep 17, 2020
8dd3966
[Backport] Fixed mingw64-build
githubuser0xFFFF Sep 18, 2020
62f8539
[Backport] Fix a possible invalid memory access
usiems Dec 2, 2020
2cd4d0a
[Backport generator] QUrl::FormattingOptions flag arguments didn't wo…
usiems Feb 5, 2021
7695182
[Backport] Make this a proper C++ struct
usiems Jun 23, 2021
f86ae18
[Backport] Get rid of typedef struct completely, this is C++ code
usiems Jun 24, 2021
ee2f2a9
[Backport] Add missing break in switch to fix P3K conversion
iakov Nov 3, 2021
16a179f
[Backport] Provide missing implementation of PythonQtSlotInfo::getGlo…
githubuser0xFFFF Dec 30, 2022
81d660b
[Backport] Add -std=c++11 flag to check for problems
mrbean-bremen Jan 1, 2023
2988ca7
[Backport] Update __spec__ too (if existing) when setting the import …
usiems Apr 12, 2021
3d1b62b
[Backport] Remove unused variable from PythonQtPrivate::callMethodInP…
jcfr Dec 10, 2023
b3c4bd2
[Backport] Replace NULL with nullptr
mrbean-bremen Jan 1, 2023
a646ede
[Backport] Add override and noexcept modifiers
mrbean-bremen Jan 1, 2023
6b1064e
[Backport] Fix type conversion warnings, use const
mrbean-bremen Jan 1, 2023
f0ffa66
[Backport] Avoid redefinition warnings, fix export macros
mrbean-bremen Jan 1, 2023
d6bd0d2
[Backport] Add facility to set task done callback
mrbean-bremen Jan 2, 2023
db15c3e
[Backport] Make sure queued connection of Signals with Python types a…
mrbean-bremen Jan 2, 2023
c622531
[Backport] Add missing GIL scope to single shot timer destructor
mrbean-bremen Jan 2, 2023
72c3f74
[Backport] Add initial support for coroutines
mrbean-bremen Jan 2, 2023
2d0c14a
[Backport] Use ubuntu instead of gcc based images
mrbean-bremen Jan 5, 2023
672ac78
[Backport] Several fixes and patches (#89)
iakov Jan 30, 2023
f03289f
[Backport] Add support for Python 3.11 (#91)
iakov Feb 1, 2023
33d51c1
[Backport] Ignore some file types and directories
usiems May 14, 2020
0b74420
[Backport] Generate modern C++ code with nullptr and override
usiems Mar 16, 2020
7664d22
[Backport generator] Also generate python function for operator!=()
FelixPetriconi Feb 14, 2022
3ebd6e7
[Backport generator] Default initialize all members
FelixPetriconi Feb 14, 2022
bc1d13c
[Backport] Replace foreach macro with range based for loop
FelixPetriconi Feb 14, 2022
b3a8b1e
[Backport generator] Remove __* and _Uppercase from symbols because t…
FelixPetriconi Feb 14, 2022
963fef3
[Backport generator] Also consider interfaces of super classes (issue…
usiems Oct 26, 2022
5e9747e
[Backport generator] Add missing space in message
usiems Oct 26, 2022
72976bd
[Backport generator] initialize members with list-initializers
usiems Oct 26, 2022
ea6d30a
[Backport] Fix install paths by adding INSTALL_PREFIX
yurivict Feb 1, 2023
a79dfee
[Backport] Tiny improvements for build system
iakov Feb 6, 2023
88262b7
[Backport] Use XSETREF for safety
iakov Feb 7, 2023
42967ea
[Backport] CI for CONFIG+=debug + UbSan for tests
iakov Feb 7, 2023
55073e9
[Backport] Fix crash when converting Python list with None value to Q…
usiems Mar 24, 2023
ea3753a
[Backport] Fix crash when using QObject::disconnect method (when mult…
usiems Apr 26, 2023
597237a
[Backport] Limit string representation of argument list in length
usiems Feb 8, 2023
e0551ba
[Backport] Revert undefining some defines (#103)
mrbean-bremen Jul 8, 2023
0a24f75
[Backport] Add back undefining _POSIX_C_SOURCE and _XOPEN_SOURCE (#106)
mrbean-bremen Jul 9, 2023
a094746
[Backport generator] Add support for parsing enum class declarations
YuriUfimtsev Oct 28, 2023
79eabf8
[Backport generator] Add parsed enums and some more enums from warnin…
YuriUfimtsev Oct 28, 2023
87462e3
[Backport generator] Make the generator compile with C++17
mrbean-bremen Oct 27, 2023
dfbc25a
[Backport generator] Add parsing of noexcept exception specifier
mrbean-bremen Oct 27, 2023
ef49fac
[Backport generator] Add support for parsing using declarations
mrbean-bremen Oct 27, 2023
f40c554
[Backport generator] Fix parse error for function declaration
mrbean-bremen Oct 27, 2023
08ab59c
[Backport] Qt6 compatibility fixes for core PythonQt library
richard42 Aug 21, 2023
41b75b9
[Backport] Bring back more Qt5 compatibility
mrbean-bremen Sep 15, 2023
8030b45
[Backport] More Qt5 compatibility changes
mrbean-bremen Sep 15, 2023
8cc4b62
[Backport] Bring back QRegExp and QMatrix for Qt5
mrbean-bremen Sep 19, 2023
9ba9ed6
[Backport] Qt6: initial changes to make compilation work (#114)
jbowler Oct 3, 2023
4ddab8e
[Backport generator] Replace deprecated QAtomicPointer<T>::load() (#115)
jbowler Oct 3, 2023
60445cf
[Backport generator] Qt6: QList<T>operator== requires const T::operat…
jbowler Oct 3, 2023
890bfe3
[Backport generator] Qt6: qSort and qStableSort removed (#117)
jbowler Oct 4, 2023
af85008
[Backport generator] Qt6: qSort, toList and fromList removal (#118)
jbowler Oct 5, 2023
c345e97
[Backport generator] Qt6: QString::SkipEmptyParts moved to Qt (#119)
jbowler Oct 5, 2023
0f6e188
[Backport generator] Qt6: QTextStream compatibility (#120)
jbowler Oct 5, 2023
527e396
[Backport generator] Eliminate warnings about #warning (#122)
jbowler Oct 9, 2023
9f8a50b
[Backport generator] Qt6: generator/typesystem.cpp: XML workround (#123)
jbowler Oct 9, 2023
19558e4
[Backport generator] Add constexpr and decltype parsing (#125)
jbowler Oct 11, 2023
616b3b8
[Backport generator] Handle constexpr, auto (#126)
jbowler Oct 12, 2023
e4bf0ca
[Backport] Qt6: fixes for removal of Qt5 types (#127)
jbowler Oct 13, 2023
4085521
[Backport] Support Qt 5.12
dbrnz Aug 9, 2019
b465074
[Backport generator] Fix problems in Qt5.11 generator (#128)
jbowler Oct 14, 2023
450c7c3
[Backport generator] Use spaces instead of tabs (#129)
jbowler Oct 14, 2023
1c4bdfc
[Backport generator] generator: remove anonymous structs (#121)
jbowler Oct 15, 2023
bcc2b0c
[Backport generator] generator: call Reporthandler::setContext more (…
jbowler Oct 16, 2023
34bb3b8
[Backport generator] generator: AbstractMetaClassList: correct sortin…
jbowler Oct 17, 2023
15ca0e3
[Backport generator] generator: fix iterator issues with Qt5.14 heade…
jbowler Nov 3, 2023
32bb84f
[Backport generator] add option to print parser errors when they occur
usiems Nov 3, 2023
49f4f04
[Backport generator] Keep track of current source code in Debug mode,
usiems Nov 3, 2023
f8210ba
[Backport] always ignore .vs folder
usiems Nov 4, 2023
8e26a73
[Backport generator] Add a token consistency check between enum and a…
YuriUfimtsev Nov 9, 2023
e7d6776
[Backport generator] Reduce memory leaks by implementing the Abstract…
YuriUfimtsev Nov 11, 2023
99a5557
[Backport generator] Don't interpret "= default" or "= delete" to mea…
usiems Nov 3, 2023
e24d877
[Backport generator] Deleted methods need to marked as "invalid" to b…
usiems Nov 6, 2023
57d90e1
[Backport generator] Cover cases where noexcept comes with an expression
usiems Nov 4, 2023
9c6a263
[Backport generator] Implement and use Parser::skipFunctionBody
usiems Nov 3, 2023
eeaf126
[Backport generator] Simplify skipFunctionBody by only looking at cur…
usiems Nov 9, 2023
81ba788
[Backport generator] Avoid currently unsupported use of "noexcept(...)"
usiems Nov 3, 2023
4654a3e
[Backport generator] Ignore some more macros that lead to parser errors
usiems Nov 4, 2023
3d9b2b2
[Backport generator] Support basic new-style initializers
usiems Nov 4, 2023
6df2c05
[Backport generator] Add missing enum used as default value for a method
usiems Nov 6, 2023
96dffde
[Backport generator] Automatically mark methods with r-value referenc…
usiems Nov 6, 2023
df32a47
[Backport generator] Don't create wrappers for cbegin and cend
usiems Nov 8, 2023
f0fee3e
[Backport generator] Hopefully make generator immune against iterator…
usiems Nov 8, 2023
f9a5316
[Backport generator] Don't generate wrappers for templated methods in…
usiems Nov 8, 2023
45bb4bc
[Backport generator] Fix handling of right-shift as template bracket
mrbean-bremen Nov 1, 2023
72fc6b5
[Backport generator] Ignore variadic template parameters
mrbean-bremen Nov 1, 2023
170ced0
[Backport generator] Handle ellipsis in type parser
usiems Nov 9, 2023
3a32a46
[Backport generator] Fix: AbstractMetaBuilder::classesTopologicalSort…
jbowler Nov 10, 2023
5b2a210
[Backport generator] Improve debugging code for rewind, also show ide…
usiems Nov 10, 2023
eb4f50c
[Backport] Add qsizetype and qptrdiff as primitive types
usiems Nov 15, 2023
7776b47
[Backport generator] Avoid crash if supposed property setter has no a…
usiems Nov 14, 2023
73a20b4
[Backport generator] Avoid crash in lexer by increasing size of token…
usiems Nov 14, 2023
ee4075f
[Backport generator] Make number of classes per generated file config…
usiems Nov 17, 2023
68ee4a7
[Backport generator] Add version qualifiers to typesystem XML files
usiems Nov 16, 2023
321d74c
[Backport generator] Don't assume some Qt version if it could not be …
usiems Nov 20, 2023
5e274d3
[Backport] Correct initialization of return value pointer failed
usiems Nov 24, 2023
be2d274
[Backport] Some types are aliases in Qt6 now
usiems Nov 24, 2023
c0783c6
[Backport] Comparison rules of QVariant have changed in Qt6
usiems Nov 24, 2023
4bbf7fb
[Backport generator] Better handling of "auto" and trailing return ty…
usiems Nov 10, 2023
78c9012
[Backport generator] Better handling of variadic templates
usiems Nov 10, 2023
4f0811d
[Backport generator] Skip attribute specifiers like [[maybe_unused]]
usiems Nov 10, 2023
37bd7fd
[Backport generator] Fix types being rejected because they contain "c…
usiems Nov 13, 2023
744103a
[Backport generator] Handle "friend" functions with implementation bo…
usiems Nov 13, 2023
bb48dcf
[Backport generator] Treat constexpr as a function modifier, not as a…
usiems Nov 14, 2023
9b23a3b
[Backport generator] Treat noexcept inside of expressions
usiems Nov 14, 2023
fd5f976
[Backport generator] Fix expansion of variadic macros in preprocessor
usiems Nov 14, 2023
69970e2
[Backport generator] Fix handling of elif in preprocessor...
usiems Nov 14, 2023
7e84eb5
[Backport generator] Support for new-style initializers in expressions
usiems Nov 15, 2023
847eda9
[Backport generator] Improve handling of new-style initializers
usiems Nov 14, 2023
936bd70
[Backport generator] Improve type name handling
usiems Nov 14, 2023
10719df
[Backport generator] Make parsing more robust against shuffling of qu…
usiems Nov 14, 2023
e22cb7b
[Backport generator] Fix missing includes for namespace items from di…
usiems Nov 14, 2023
eb5178c
[Backport generator] Implement methods with lvalue/rvalue references,…
usiems Nov 15, 2023
9a41e88
[Backport generator] Handle (templated) functions with packed parameters
usiems Nov 15, 2023
9e0f4e6
[Backport generator] Parse inline namespaces,
usiems Nov 17, 2023
90c5541
[Backport generator] Parse string literal operator definition,
usiems Nov 17, 2023
4be156a
[Backport generator] Some necessary defines for Qt6
usiems Nov 15, 2023
ec8d574
[Backport generator] Add some entries to typesystem files missing for…
usiems Nov 15, 2023
5b6b7d8
[Backport generator] Add new multimedia classes
usiems Nov 17, 2023
fec0ddd
[Backport generator] Automatically add enums marked with Q_ENUM to Ty…
usiems Nov 17, 2023
ce92a8b
[Backport generator] Fix uninitialized member
usiems Nov 20, 2023
0fd1320
[Backport generator] Some more defines we don't need to parse
usiems Nov 20, 2023
6860d9b
[Backport generator] Q_PROPERTY might contain "REVISION(1, 1)"
usiems Nov 20, 2023
c9dce82
[Backport generator] Improve parsing of Q_PROPERTY types starting wit…
usiems Nov 20, 2023
4cc901e
[Backport generator] Rename "after-version" attribute to "since-version"
usiems Nov 20, 2023
4d0888d
[Backport generator] More missing or updated type entries
usiems Nov 20, 2023
28e859b
[Backport generator] Handle enum classes
usiems Nov 21, 2023
4b680c2
[Backport generator] Complete/fix scope for enum class values
usiems Nov 21, 2023
29a1c4c
[Backport generator] Remove figureOutEnumValues and company
usiems Nov 21, 2023
d876a3f
[Backport generator] Do not add copy constructor if it was deleted or…
usiems Nov 22, 2023
e3478f0
[Backport generator] QMutexLocker is a template now, don't know how t…
usiems Nov 22, 2023
8dda31b
[Backport generator] Fix handling of protected operators
usiems Nov 22, 2023
0263dac
[Backport generator] Fix compiler warning (possibly unintended copy)
usiems Nov 22, 2023
7a6a4b4
[Backport generator] Fix QList::swap missing the template argument in…
usiems Nov 22, 2023
9144efa
[Backport generator] I believe it is not necessary to create a shell …
usiems Nov 22, 2023
ff474e1
[Backport] Try to fix library names and linking problems
usiems Nov 22, 2023
7896124
[Backport] Make PythonQtTests compile with Qt6
usiems Nov 23, 2023
6998de1
[Backport generator] Do not prepend enum class name for items of enum…
usiems Nov 23, 2023
d23bd7f
[Backport generator] Avoid emitting QStringList* arguments as QString…
usiems Nov 24, 2023
4407af6
[Backport generator] Avoid some compiler warnings
usiems Nov 24, 2023
f717177
[Backport generator] Skip alignas specifier
usiems Nov 24, 2023
12ca444
Prevent crashes during and after cleanup
jamesobutler Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*.lo
*.o
*.obj
*.pdb
*.cbt

# Precompiled Headers
*.gch
Expand Down Expand Up @@ -43,6 +45,8 @@ ui_*.h
*.jsc
Makefile*
*build-*
*resource.rc
*.FileListAbsolute.txt

# CMake
CMakeLists.txt.user
Expand Down Expand Up @@ -82,9 +86,29 @@ Thumbs.db
# Visual Studio Code
.vscode/*

*.tlog

# Doxygen
doxygen/html/*
doxygen.log

# Backup files
*.bak
generated_cpp
generator/.vs
*.log
*.sln
*.vcxproj
*.filters
*.user
*.stash
*.tmp
generate.bat
generator/release

/.vs/
*/.vs
*/debug/*
*/release/*
src/.vs
lib
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set expandtab
12 changes: 6 additions & 6 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999

Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Expand All @@ -10,7 +10,7 @@
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]

Preamble
Preamble

The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Expand Down Expand Up @@ -112,7 +112,7 @@ modification follow. Pay close attention to the difference between a
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.

GNU LESSER GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License Agreement applies to any software library or other
Expand Down Expand Up @@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.

NO WARRANTY
NO WARRANTY

15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
Expand All @@ -455,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.

END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Libraries

Expand Down
4 changes: 3 additions & 1 deletion PythonQt.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
TEMPLATE = subdirs

CONFIG += ordered
SUBDIRS = generator src extensions tests examples
tests.depends += src extensions
extensions.depends += src
examples.depends += src extensions
7 changes: 5 additions & 2 deletions build/PythonQt.prf
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ CONFIG(debug, debug|release) {
DEBUG_EXT =
}

win32::LIBS += $$DESTDIR/../lib/PythonQt-Qt5-Python$${PYTHON_VERSION}$${DEBUG_EXT}.lib
unix::LIBS += -L$$DESTDIR/../lib -lPythonQt-Qt5-Python$${PYTHON_VERSION}$${DEBUG_EXT}
PYTHONQT_LIB_NAME=PythonQt-Qt$${QT_MAJOR_VERSION}-Python$${PYTHON_VERSION}$${DEBUG_EXT}

win32-g++: LIBS += $$DESTDIR/../lib/$${PYTHONQT_LIB_NAME}.dll
win32-*msvc*: LIBS += $$DESTDIR/../lib/$${PYTHONQT_LIB_NAME}.lib
unix: LIBS += -L$$DESTDIR/../lib -l$${PYTHONQT_LIB_NAME}
6 changes: 4 additions & 2 deletions build/PythonQt_QtAll.prf
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ CONFIG(debug, debug|release) {
DEBUG_EXT =
}

win32::LIBS += $$DESTDIR/../lib/PythonQt_QtAll-Qt5-Python$${PYTHON_VERSION}$${DEBUG_EXT}.lib
unix::LIBS += -L$$DESTDIR/../lib -lPythonQt_QtAll-Qt5-Python$${PYTHON_VERSION}$${DEBUG_EXT}

win32-g++: LIBS += $$DESTDIR/../lib/PythonQt_QtAll-Qt5-Python$${PYTHON_VERSION}$${DEBUG_EXT}.dll
win32-msvc*: LIBS += $$DESTDIR/../lib/PythonQt_QtAll-Qt5-Python$${PYTHON_VERSION}$${DEBUG_EXT}.lib
unix: LIBS += -L$$DESTDIR/../lib -lPythonQt_QtAll-Qt5-Python$${PYTHON_VERSION}$${DEBUG_EXT}
54 changes: 23 additions & 31 deletions build/common.prf
Original file line number Diff line number Diff line change
Expand Up @@ -25,47 +25,39 @@ PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_$${QT_MAJOR_VERSION}$${QT_MINOR_VERSION}

!exists($$PYTHONQT_GENERATED_PATH) {
contains( QT_MAJOR_VERSION, 5 ) {
contains( QT_MINOR_VERSION, 10 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 11 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_511
}
else:contains( QT_MINOR_VERSION, 1 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_50
}
else:contains( QT_MINOR_VERSION, 2 ) {
# For Qt5 we know that the older generated wrappers work with the later
# versions, even (apparently) Qt5.15, so:
equals(QT_MAJOR_VERSION, 5) {
# Qt5: have 5.0, 5.3, 5.4, 5.6 and 5.11 at present:
lessThan(QT_MINOR_VERSION, 3) { # 5.1, 5.2
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_50
}
else:contains( QT_MINOR_VERSION, 3 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_53
}
else:contains( QT_MINOR_VERSION, 4 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_54
}
else:contains( QT_MINOR_VERSION, 5 ) {
else: lessThan(QT_MINOR_VERSION, 6) { # 5.5
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_54
}
else:contains( QT_MINOR_VERSION, 6 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 7 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 8 ) {
else: lessThan(QT_MINOR_VERSION, 11) { # 5.7, 5.8, 5.9, 5.10
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else:contains( QT_MINOR_VERSION, 9 ) {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
}
else {
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_56
else { # >5.11
# LATEST Qt5 generated files:
PYTHONQT_GENERATED_PATH = $$PWD/../generated_cpp_511
}
}

!exists($$PYTHONQT_GENERATED_PATH) {
error("No generated sources exist for Qt$${QT_VERSION}")
}
}
}

VERSION = 3.2.0
!build_pass {
message("Qt version: Qt$${QT_VERSION}")
message("Using generated sources files from $${PYTHONQT_GENERATED_PATH}")
}

VERSION = 3.2.0
win32: CONFIG += skip_target_version_ext
gcc|win32-clang-msvc:QMAKE_CXXFLAGS += -Wno-deprecated-declarations -Wuninitialized -Winit-self -pedantic
win32-clang-msvc:QMAKE_CXXFLAGS += -Wno-unused-command-line-argument
#Do not issue warning to system includes
gcc:!isEmpty(QT_INSTALL_HEADERS): QMAKE_CXXFLAGS += -isystem $$[QT_INSTALL_HEADERS]
143 changes: 105 additions & 38 deletions build/python.prf
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,112 @@


# Change this variable to your python version (2.6, 2.7, 3.3, ...)
PYTHON_VERSION=$$(PYTHON_VERSION)
isEmpty( PYTHON_VERSION ) {
win32:PYTHON_VERSION=27
unix:PYTHON_VERSION=2.7
PYTHON_VERSION=$$(PYTHON_VERSION)
}
isEmpty( PYTHON_VERSION ) {
PYTHON_VERSION=2.7
}

isEmpty( PYTHON_DIR ) {
PYTHON_DIR=$$(PYTHON_DIR)
}
!isEmpty( PYTHON_DIR ) {
PYTHON_DIR=$${PYTHON_DIR}/
}


macx {
# for macx you need to have the Python development kit installed as framework
INCLUDEPATH += /System/Library/Frameworks/Python.framework/Headers
LIBS += -F/System/Library/Frameworks -framework Python
} else:win32 {
# for windows install a Python development kit or build Python yourself from the sources
# Make sure that you set the environment variable PYTHON_PATH to point to your
# python installation (or the python sources/header files when building from source).
# Make sure that you set the environment variable PYTHON_LIB to point to
# the directory where the python libs are located.
#
# When using the prebuild Python installer, this will be:
# set PYTHON_PATH = c:\Python26
# set PYTHON_LIB = c:\Python26\libs
#
# When using the python sources, this will be something like:
# set PYTHON_PATH = c:\yourDir\Python-2.6.1\
# set PYTHON_LIB = c:\yourDir\Python-2.6.1\PCbuild8\Win32

# check if debug or release
CONFIG(debug, debug|release) {
DEBUG_EXT = _d
} else {
DEBUG_EXT =
}

win32:INCLUDEPATH += $$(PYTHON_PATH)/PC $$(PYTHON_PATH)/include
win32:LIBS += $$(PYTHON_LIB)/python$${PYTHON_VERSION}$${DEBUG_EXT}.lib
} else:unix {
# on linux, python-config is used to autodetect Python.
# make sure that you have installed a matching python-dev package.
PYTHON_VERSION_MAJOR=$$section(PYTHON_VERSION, ., 0, 0)
PYTHON_VERSION_MINOR=$$section(PYTHON_VERSION, ., 1, 1)

!equals(PYTHON_VERSION, $${PYTHON_VERSION_MAJOR}.$${PYTHON_VERSION_MINOR}) {
error("Failed to parse PYTHON_VERSION:\"$$PYTHON_VERSION\"")
} else {
message(Using Python version $${PYTHON_VERSION})
}


# Python 2.x has problems:
# 1) https://wiki.gentoo.org/wiki/Project:Python/Strict_aliasing
# 2) deprecated implicit cast of string literals to char*
equals(PYTHON_VERSION_MAJOR, 2) {
gcc:QMAKE_CXXFLAGS *= -fno-strict-aliasing -Wno-write-strings
# Qt 5.4 adds this option, but this is not compatible with the Python API
msvc: QMAKE_CXXFLAGS -= -Zc:strictStrings
}

contains(PKGCONFIG, "python.*"){
# If `pkg-config` is configured, use `qmake PKGCONFIG+=python3.8-embed CONFIG+=...`
# or `PKGCONFIG+=python2.7m`-like form for older versions,
# see `pkg-config --list-all | grep python` for details.
# This can help with GNU/Linux (including macOS with Homebrew), MSYS2/MinGW environment,
# and also with OpenEmbedded and other cross-builds
CONFIG += link_pkgconfig
PYTHON_PKGCONFIG = $$member($$unique($$find(PKGCONFIG, "python.*")), 1, 1)
# add rpath
PYTHON_LIBDIR = $$system($$pkgConfigExecutable() --libs-only-L $$PYTHON_PKGCONFIG)
QMAKE_RPATHDIR += $$replace(PYTHON_LIBDIR,-L,)
} else:macx:isEmpty(PYTHON_DIR){
# for macx you need to have the Python development kit installed as framework
INCLUDEPATH += /System/Library/Frameworks/Python.framework/Headers
LIBS += -F/System/Library/Frameworks -framework Python
} else:win32 {
# for windows install a Python development kit or build Python yourself from the sources
# Make sure that you set the environment variable PYTHON_PATH to point to your
# python installation (or the python sources/header files when building from source).
# Make sure that you set the environment variable PYTHON_LIB to point to
# the directory where the python libs are located.
#
# When using the prebuild Python installer, this will be:
# set PYTHON_PATH = c:\Python26
# set PYTHON_LIB = c:\Python26\libs
#
# When using the python sources, this will be something like:
# set PYTHON_PATH = c:\yourDir\Python-2.6.1\
# set PYTHON_LIB = c:\yourDir\Python-2.6.1\PCbuild8\Win32

# check if debug or release
CONFIG(debug, debug|release) {
DEBUG_EXT = _d
} else {
DEBUG_EXT =
}

isEmpty(PYTHON_PATH):PYTHON_PATH=$(PYTHON_PATH)
isEmpty(PYTHON_PATH)|!exists("$$PYTHON_PATH\\include") | !exists("$$PYTHON_PATH\\libs\\") {
error("PYTHON_PATH must be set to correct folder with \\libs and \\include subfolders ")
}

#We need to destinguish 64-bit build to add a workaround option
#The only known problematic case is MinGW with external (MSVC-built) Python2
mingw:equals(PYTHON_VERSION_MAJOR, 2): isEmpty(QMAKE_TARGET.arch):system(\
$$system_quote($$system_path($${PYTHON_PATH}/python.exe)) -c \
$$system_quote(import sysconfig;exit(0 if 0 <= sysconfig.get_platform().find(\'win-amd64\') else 1))\
):DEFINES += MS_WIN64

INCLUDEPATH += $$shell_path($${PYTHON_PATH}/include)

LIBS += $$shell_path(-L$${PYTHON_PATH}/libs)
LIBS += -lpython$${PYTHON_VERSION_MAJOR}$${PYTHON_VERSION_MINOR}$${DEBUG_EXT}

# Hack for "CONFIG+=testcase" and 'make check' to add python's dll to PATH
deppath += $$shell_path($${PYTHON_PATH})

} else:unix {
# on linux, python-config is used to autodetect Python.
# make sure that you have installed a matching python-dev package.

unix:LIBS += $$system(python$${PYTHON_VERSION}-config --ldflags)
unix:QMAKE_CXXFLAGS += $$system(python$${PYTHON_VERSION}-config --includes)
}
PYTHON_CONFIG = $${PYTHON_DIR}/bin/python$${PYTHON_VERSION}-config
PYTHON_CONFIG_OPTIONS_LIBS = --libs
equals(PYTHON_VERSION_MAJOR, 3):!lessThan(PYTHON_VERSION_MINOR, 8) {
# Since 3.8 `--embed` is needed
PYTHON_CONFIG_OPTIONS_LIBS += --embed
}
LIBS += $$system($${PYTHON_CONFIG} $${PYTHON_CONFIG_OPTIONS_LIBS})
QMAKE_CXXFLAGS += $$system($${PYTHON_CONFIG} --includes)
PYTHON_LFLAGS = $$system($${PYTHON_CONFIG} --ldflags)
QMAKE_LFLAGS += $${PYTHON_LFLAGS}
# add rpath
PYTHON_LIBDIR = $$find(PYTHON_LFLAGS,-L.*)
PYTHON_RPATH = $$replace(PYTHON_LIBDIR,-L,)
QMAKE_RPATHDIR += $$PYTHON_RPATH
}
4 changes: 1 addition & 3 deletions examples/CPPPyWrapperExample/CPPPyWrapperExample.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ DESTDIR = ../../lib
include ( ../../build/common.prf )
include ( ../../build/PythonQt.prf )

contains(QT_MAJOR_VERSION, 5) {
QT += widgets
}
QT += widgets

SOURCES += \
CPPPyWrapperExample.cpp
Expand Down
4 changes: 1 addition & 3 deletions examples/PyCPPWrapperExample/PyCPPWrapperExample.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ DESTDIR = ../../lib
include ( ../../build/common.prf )
include ( ../../build/PythonQt.prf )

contains(QT_MAJOR_VERSION, 5) {
QT += widgets
}
QT += widgets

HEADERS += \
CustomObjects.h
Expand Down
4 changes: 1 addition & 3 deletions examples/PyCustomMetaTypeExample/PyCustomMetaTypeExample.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ DESTDIR = ../../lib
include ( ../../build/common.prf )
include ( ../../build/PythonQt.prf )

contains(QT_MAJOR_VERSION, 5) {
QT += widgets
}
QT += widgets

HEADERS += \
CustomObject.h
Expand Down
4 changes: 1 addition & 3 deletions examples/PyDecoratorsExample/PyDecoratorsExample.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ DESTDIR = ../../lib
include ( ../../build/common.prf )
include ( ../../build/PythonQt.prf )

contains(QT_MAJOR_VERSION, 5) {
QT += widgets
}
QT += widgets

HEADERS += \
PyExampleDecorators.h
Expand Down
Loading