Skip to content

Fix build for 5.10 and rearrange headers #19

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ 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 "_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()
Expand Down
16 changes: 10 additions & 6 deletions build/python.prf
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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)
}
3 changes: 0 additions & 3 deletions examples/NicePyConsole/PygmentsHighlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*/
#include "PygmentsHighlighter.h"

#include <PythonQt.h>


PygmentsHighlighter::PygmentsHighlighter(QTextDocument *parentDoc) :
QSyntaxHighlighter(parentDoc)
{
Expand Down
6 changes: 3 additions & 3 deletions examples/NicePyConsole/PygmentsHighlighter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#define PYGMENTSHIGHLIGHTER_H


// Qt-includes
#include <QSyntaxHighlighter>

// PythonQt-includes
#include <PythonQt.h>

// Qt-includes
#include <QSyntaxHighlighter>

// local includes
#include "SimpleConsole.h"

Expand Down
6 changes: 3 additions & 3 deletions examples/NicePyConsole/PythonCompleter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#ifndef PYTHONCOMPLETER_H
#define PYTHONCOMPLETER_H

// Qt-includes
#include <QCompleter>

// PythonQt-includes
#include <PythonQt.h>

// Qt-includes
#include <QCompleter>

// forward declarations
class SimpleConsole;

Expand Down
6 changes: 3 additions & 3 deletions examples/NicePyConsole/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*/


// Qt-includes
#include <QApplication>

// PythonQt-includes
#include <PythonQt.h>
#include <PythonQt_QtAll.h>

// Qt-includes
#include <QApplication>

// includes
#include "NicePyConsole.h"

Expand Down
2 changes: 1 addition & 1 deletion extensions/PythonQt_QtAll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
Expand Down
3 changes: 1 addition & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/PythonQtClassInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
*
*/

#include "PythonQt.h"
#include <QMetaObject>
#include <QMetaMethod>
#include <QHash>
#include <QByteArray>
#include <QList>
#include "PythonQt.h"

class PythonQtSlotInfo;
class PythonQtClassInfo;
Expand Down
2 changes: 1 addition & 1 deletion src/PythonQtMethodInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
*/
//----------------------------------------------------------------------------------

#include "PythonQtMethodInfo.h"
#include "PythonQtClassInfo.h"
#include "PythonQtMethodInfo.h"
#include <iostream>

QHash<QByteArray, PythonQtMethodInfo*> PythonQtMethodInfo::_cachedSignatures;
Expand Down
2 changes: 1 addition & 1 deletion src/src.pri
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 6 additions & 0 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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