From ef41782aee5edce1b978ce0d014ae1a063abde4e Mon Sep 17 00:00:00 2001 From: Tommaso Vinci Date: Fri, 12 Jan 2018 10:50:32 +0100 Subject: [PATCH 1/5] fix qmake build on osx (apple clang) --- examples/NicePyConsole/PygmentsHighlighter.cpp | 3 --- examples/NicePyConsole/PygmentsHighlighter.h | 6 +++--- examples/NicePyConsole/PythonCompleter.h | 6 +++--- examples/NicePyConsole/main.cpp | 6 +++--- src/PythonQtClassInfo.h | 2 +- src/PythonQtMethodInfo.cpp | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/examples/NicePyConsole/PygmentsHighlighter.cpp b/examples/NicePyConsole/PygmentsHighlighter.cpp index 820ec65a..f5406b48 100644 --- a/examples/NicePyConsole/PygmentsHighlighter.cpp +++ b/examples/NicePyConsole/PygmentsHighlighter.cpp @@ -5,9 +5,6 @@ */ #include "PygmentsHighlighter.h" -#include - - PygmentsHighlighter::PygmentsHighlighter(QTextDocument *parentDoc) : QSyntaxHighlighter(parentDoc) { diff --git a/examples/NicePyConsole/PygmentsHighlighter.h b/examples/NicePyConsole/PygmentsHighlighter.h index 5dd0fcc7..1f913a48 100644 --- a/examples/NicePyConsole/PygmentsHighlighter.h +++ b/examples/NicePyConsole/PygmentsHighlighter.h @@ -9,12 +9,12 @@ #define PYGMENTSHIGHLIGHTER_H -// Qt-includes -#include - // PythonQt-includes #include +// Qt-includes +#include + // local includes #include "SimpleConsole.h" diff --git a/examples/NicePyConsole/PythonCompleter.h b/examples/NicePyConsole/PythonCompleter.h index 4a8e5879..c45a8475 100644 --- a/examples/NicePyConsole/PythonCompleter.h +++ b/examples/NicePyConsole/PythonCompleter.h @@ -8,12 +8,12 @@ #ifndef PYTHONCOMPLETER_H #define PYTHONCOMPLETER_H -// Qt-includes -#include - // PythonQt-includes #include +// Qt-includes +#include + // forward declarations class SimpleConsole; diff --git a/examples/NicePyConsole/main.cpp b/examples/NicePyConsole/main.cpp index 551a2a59..c50a9c3d 100644 --- a/examples/NicePyConsole/main.cpp +++ b/examples/NicePyConsole/main.cpp @@ -5,13 +5,13 @@ */ -// Qt-includes -#include - // PythonQt-includes #include #include +// Qt-includes +#include + // includes #include "NicePyConsole.h" diff --git a/src/PythonQtClassInfo.h b/src/PythonQtClassInfo.h index ab75f61b..c7a2ddbd 100644 --- a/src/PythonQtClassInfo.h +++ b/src/PythonQtClassInfo.h @@ -33,12 +33,12 @@ * */ +#include "PythonQt.h" #include #include #include #include #include -#include "PythonQt.h" class PythonQtSlotInfo; class PythonQtClassInfo; diff --git a/src/PythonQtMethodInfo.cpp b/src/PythonQtMethodInfo.cpp index f420eec9..3e9e4b93 100644 --- a/src/PythonQtMethodInfo.cpp +++ b/src/PythonQtMethodInfo.cpp @@ -39,8 +39,8 @@ */ //---------------------------------------------------------------------------------- -#include "PythonQtMethodInfo.h" #include "PythonQtClassInfo.h" +#include "PythonQtMethodInfo.h" #include QHash PythonQtMethodInfo::_cachedSignatures; From ff78953479f0662a20377539b6b9f3cb71a50fee Mon Sep 17 00:00:00 2001 From: Tommaso Vinci Date: Fri, 12 Jan 2018 11:00:19 +0100 Subject: [PATCH 2/5] fix qt 5.10 using generated wrappers for 5.6 --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40ecf297..a0e33ade 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,9 @@ endif(PythonQt_Qt5) # associated with the Qt version being used. set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}") +if("${generated_cpp_suffix}" STREQUAL "_510") + set(generated_cpp_suffix "_56") # Also use 5.6 wrappers for 5.10 +endif() if("${generated_cpp_suffix}" STREQUAL "_58") set(generated_cpp_suffix "_56") # Also use 5.6 wrappers for 5.8 endif() From 285172cdb2df13351fccd6a936eeeadeee737557 Mon Sep 17 00:00:00 2001 From: Tommaso Vinci Date: Fri, 12 Jan 2018 11:59:06 +0100 Subject: [PATCH 3/5] cross compile using mingw --- build/python.prf | 16 ++++++++++------ src/src.pri | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/build/python.prf b/build/python.prf index 165ad3bb..ca444b36 100644 --- a/build/python.prf +++ b/build/python.prf @@ -1,14 +1,15 @@ # profile to include and link Python # Change this variable to your python version (2.6, 2.7, 3.3, ...) -win32:PYTHON_VERSION=27 +msvc:PYTHON_VERSION=27 unix:PYTHON_VERSION=2.7 +mingw:PYTHON_VERSION=2.7 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 { +} else:msvc { # 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). @@ -30,12 +31,15 @@ macx { DEBUG_EXT = } - win32:INCLUDEPATH += $$(PYTHON_PATH)/PC $$(PYTHON_PATH)/include - win32:LIBS += $$(PYTHON_LIB)/python$${PYTHON_VERSION}$${DEBUG_EXT}.lib + INCLUDEPATH += $$(PYTHON_PATH)/PC $$(PYTHON_PATH)/include + LIBS += $$(PYTHON_LIB)/python$${PYTHON_VERSION}$${DEBUG_EXT}.lib +} else:mingw { + LIBS += $$system(mingw32-pkg-config --libs python) + QMAKE_CXXFLAGS += $$system(mingw32-pkg-config --cflags python) } 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 --libs) - unix:QMAKE_CXXFLAGS += $$system(python$${PYTHON_VERSION}-config --includes) + LIBS += $$system(python$${PYTHON_VERSION}-config --libs) + QMAKE_CXXFLAGS += $$system(python$${PYTHON_VERSION}-config --includes) } diff --git a/src/src.pri b/src/src.pri index 61df3bdc..cd0dd860 100644 --- a/src/src.pri +++ b/src/src.pri @@ -3,7 +3,7 @@ DEFINES += PYTHONQT_EXPORTS INCLUDEPATH += $$PWD # This was needed to work around "number of sections exceeded object file format limit" linker error -win32:QMAKE_CXXFLAGS += /bigobj +msvc:QMAKE_CXXFLAGS += /bigobj HEADERS += \ $$PWD/PythonQt.h \ From 987fe620ffe6dabe0d4506cc23955c7d0d5893c1 Mon Sep 17 00:00:00 2001 From: Tommaso Vinci Date: Mon, 15 Jan 2018 13:45:03 +0100 Subject: [PATCH 4/5] qmake: add install headers --- src/src.pro | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/src.pro b/src/src.pro index eb44027a..80621b84 100644 --- a/src/src.pro +++ b/src/src.pro @@ -38,3 +38,9 @@ include ( src.pri ) include($${PYTHONQT_GENERATED_PATH}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin.pri) include($${PYTHONQT_GENERATED_PATH}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin.pri) + +public_headers.path = ../include +public_headers.files = $$HEADERS + +INSTALLS += public_headers + From 5ae8dfb3893eff1ac3f93223c9a39e4fa622a97b Mon Sep 17 00:00:00 2001 From: Tommaso Vinci Date: Sat, 20 Jan 2018 17:56:33 +0100 Subject: [PATCH 5/5] fix multiple sources definition --- CMakeLists.txt | 3 +++ extensions/PythonQt_QtAll/CMakeLists.txt | 2 +- src/CMakeLists.txt | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0e33ade..3f95da29 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,9 @@ set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}") if("${generated_cpp_suffix}" STREQUAL "_510") set(generated_cpp_suffix "_56") # Also use 5.6 wrappers for 5.10 endif() +if("${generated_cpp_suffix}" STREQUAL "_59") + set(generated_cpp_suffix "_56") # Also use 5.6 wrappers for 5.10 +endif() if("${generated_cpp_suffix}" STREQUAL "_58") set(generated_cpp_suffix "_56") # Also use 5.6 wrappers for 5.8 endif() diff --git a/extensions/PythonQt_QtAll/CMakeLists.txt b/extensions/PythonQt_QtAll/CMakeLists.txt index 851690c5..b4592947 100644 --- a/extensions/PythonQt_QtAll/CMakeLists.txt +++ b/extensions/PythonQt_QtAll/CMakeLists.txt @@ -39,7 +39,7 @@ endif() qt_wrap_cpp(GEN_MOC ${GEN_HEADERS}) -add_library(${PythonQt_QtAll} ${SOURCES} ${HEADERS} ${GEN_SOURCES} ${GEN_MOC}) +add_library(${PythonQt_QtAll} ${SOURCES} ${HEADERS} ${GEN_SOURCES}) target_link_libraries(${PythonQt_QtAll} ${PythonQt} ${PYTHON_LIBRARIES}) target_include_directories(${PythonQt_QtAll} PUBLIC $ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index beeae1c7..97080f64 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,8 +24,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) qt_wrap_cpp(GEN_MOC ${SOURCES_MOC}) qt_add_resources(GEN_QRC ${SOURCES_QRC}) - -add_library(${PythonQt} ${SOURCES} ${GEN_MOC} ${GEN_QRC} ${HEADERS}) +add_library(${PythonQt} ${SOURCES} ${GEN_QRC} ${HEADERS}) if(PythonQt_DynamicMetaObject) target_compile_definitions(${PythonQt} PRIVATE DYNAMIC_META_OBJECT_IMPLEMENTATION) endif()