##// END OF EJS Templates
Now Works with Python 2 & 3, Qt 4 & 5....
Orochimarufan -
r208:1476f2d2cf46
parent child
Show More
@@ -0,0 +1,16
1 # profile for non-mevis users to link to PythonQt
2
3 include ( python.prf )
4
5 INCLUDEPATH += $$PWD/../src
6
7 # check if debug or release
8 CONFIG(debug, debug|release) {
9 DEBUG_EXT = _d
10 } else {
11 DEBUG_EXT =
12 }
13
14 win32-msvc*:LIBS += $$PWD/../lib/PythonQt$${DEBUG_EXT}.lib
15 win32-g++:LIBS += $$PWD/../lib/libPythonQt$${DEBUG_EXT}.a
16 unix:LIBS += -L$$OUT_PWD/../lib -L$$OUT_PWD/../../lib -lPythonQt$${DEBUG_EXT}
@@ -0,0 +1,13
1 # profile for non-mevis users to link to PythonQt_QtAll
2
3 INCLUDEPATH += $$PWD/../extensions/PythonQt_QtAll
4
5 # check if debug or release
6 CONFIG(debug, debug|release) {
7 DEBUG_EXT = _d
8 } else {
9 DEBUG_EXT =
10 }
11
12 win32::LIBS += $$PWD/../lib/PythonQt_QtAll$${DEBUG_EXT}.lib
13 unix::LIBS += -L$$PWD/../lib -lPythonQt_QtAll$${DEBUG_EXT}
@@ -0,0 +1,23
1
2 # depending on your Qt configuration, you want to enable or disable
3 # one of the release/debug builds (if all three lines are commented,
4 # the default of your Qt installation will used)
5
6 # build with both debug and release mode
7 #CONFIG += debug_and_release build_all
8
9 # build with release mode only
10 #CONFIG += release
11
12 # build with debug mode only
13 #CONFIG += debug
14
15 # for all debug builds, add "_d" extension to target
16 CONFIG(debug, debug|release) {
17 TARGET = $${TARGET}_d
18 }
19 mac {
20 QMAKE_POST_LINK += bash $$PWD/../scripts/osx-fix-dylib.sh
21 }
22
23 #message("Directory - Build-Target: "$$PWD - $$TARGET)
@@ -0,0 +1,43
1 # profile to include and link Python
2
3 # Change this variable to your python version (2.5, 2.6)
4 win32:PYTHON_VERSION=27
5 unix:PYTHON_VERSION=2.7
6
7 macx {
8 # for macx you need to have the Python development kit installed as framework
9 INCLUDEPATH += /System/Library/Frameworks/Python.framework/Headers
10 LIBS += -F/System/Library/Frameworks -framework Python
11 } else:win32 {
12 # for windows install a Python development kit or build Python yourself from the sources
13 # Make sure that you set the environment variable PYTHON_PATH to point to your
14 # python installation (or the python sources/header files when building from source).
15 # Make sure that you set the environment variable PYTHON_LIB to point to
16 # the directory where the python libs are located.
17 #
18 # When using the prebuild Python installer, this will be:
19 # set PYTHON_PATH = c:\Python26
20 # set PYTHON_LIB = c:\Python26\libs
21 #
22 # When using the python sources, this will be something like:
23 # set PYTHON_PATH = c:\yourDir\Python-2.6.1\
24 # set PYTHON_LIB = c:\yourDir\Python-2.6.1\PCbuild8\Win32
25
26 # check if debug or release
27 CONFIG(debug, debug|release) {
28 DEBUG_EXT = _d
29 } else {
30 DEBUG_EXT =
31 }
32
33 win32:INCLUDEPATH += $(PYTHON_PATH)/PC $(PYTHON_PATH)/include
34 win32-msvc*:LIBS += $(PYTHON_LIB)/python$${PYTHON_VERSION}$${DEBUG_EXT}.lib
35 win32-g++:LIBS += $(PYTHON_PATH)/libs/libpython$${PYTHON_VERSION}.a
36
37 } else:unix {
38 # on linux, python-config is used to autodetect Python.
39 # make sure that you have installed a matching python-dev package.
40
41 unix:LIBS += $$system(python$${PYTHON_VERSION}-config --libs)
42 unix:QMAKE_CXXFLAGS += $$system(python$${PYTHON_VERSION}-config --includes)
43 }
@@ -26,11 +26,7 endif(PythonQt_Qt5)
26 #-----------------------------------------------------------------------------
26 #-----------------------------------------------------------------------------
27 # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers
27 # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers
28 # associated with the Qt version being used.
28 # associated with the Qt version being used.
29 if(PythonQt_Qt5)
29 set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}")
30 set(generated_cpp_suffix "_${Qt5Core_VERSION_MAJOR}${Qt5Core_VERSION_MINOR}")
31 else()
32 set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}")
33 endif()
34
30
35 if("${generated_cpp_suffix}" STREQUAL "_48")
31 if("${generated_cpp_suffix}" STREQUAL "_48")
36 set(generated_cpp_suffix "")
32 set(generated_cpp_suffix "")
@@ -118,6 +114,27 include_directories(${PYTHON_INCLUDE_DIRS})
118 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
114 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
119
115
120 #-----------------------------------------------------------------------------
116 #-----------------------------------------------------------------------------
117 # Library Name
118 # The variable PythonQt_LibraryName contains the PythonQt core library name
119 # It incorporates library mayor versions
120 # The variable PythonQt_LibrarySuffix is "" or "_d", if it is a debug build
121 set(PythonQt_LibraryName PythonQt)
122
123 if(PythonQt_Qt5)
124 set(PythonQt_LibraryName ${PythonQt_LibraryName}5)
125 endif()
126
127 if(NOT ${PYTHON_VERSION} VERSION_LESS 3)
128 set(PythonQt_LibraryName ${PythonQt_LibraryName}_3)
129 endif()
130
131 if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
132 set(PythonQt_LibrarySuffix _d)
133 endif()
134
135 message(STATUS "Building ${PythonQt_LibraryName}${PythonQt_LibrarySuffix} (Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} + Python ${PYTHON_VERSION} | ${CMAKE_BUILD_TYPE})")
136
137 #-----------------------------------------------------------------------------
121 # Core
138 # Core
122 add_subdirectory(src)
139 add_subdirectory(src)
123
140
@@ -12,3 +12,8 endmacro()
12 macro(qt_add_resources)
12 macro(qt_add_resources)
13 qt5_add_resources(${ARGN})
13 qt5_add_resources(${ARGN})
14 endmacro()
14 endmacro()
15
16 # version
17 set(QT_VERSION_MAJOR ${Qt5Core_VERSION_MAJOR})
18 set(QT_VERSION_MINOR ${Qt5Core_VERSION_MINOR})
19 set(QT_VERSION_PATCH ${Qt5Core_VERSION_PATCH})
@@ -23,6 +23,10 SET(FILES
23 module_completion.py
23 module_completion.py
24 )
24 )
25
25
26 SET(DIRS
27 pygments
28 )
29
26 qt_wrap_cpp(GEN_MOC ${HEADERS})
30 qt_wrap_cpp(GEN_MOC ${HEADERS})
27
31
28 add_executable(NicePyConsole ${SOURCES} ${GEN_MOC})
32 add_executable(NicePyConsole ${SOURCES} ${GEN_MOC})
@@ -31,13 +35,27 if(PythonQt_Qt5)
31 else()
35 else()
32 qt_use_modules(NicePyConsole Core Gui)
36 qt_use_modules(NicePyConsole Core Gui)
33 endif()
37 endif()
34 get_property(PythonQt_lib TARGET PythonQt PROPERTY LOCATION)
38
35 get_property(PythonQt_QtAll_lib TARGET PythonQt_QtAll PROPERTY LOCATION)
39 get_property(PythonQt_lib TARGET ${PythonQt} PROPERTY LOCATION)
40 get_property(PythonQt_QtAll_lib TARGET ${PythonQt_QtAll} PROPERTY LOCATION)
36 target_link_libraries(NicePyConsole ${PythonQt_lib} ${PythonQt_QtAll_lib} ${PYTHON_LIBRARIES})
41 target_link_libraries(NicePyConsole ${PythonQt_lib} ${PythonQt_QtAll_lib} ${PYTHON_LIBRARIES})
37
42
38 foreach(FILE ${FILES})
43 foreach(FILE ${FILES})
39 add_custom_command(OUTPUT ${FILE}
44 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${FILE}")
40 COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}" "${CMAKE_CURRENT_BINARY_DIR}/${FILE}"
45 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
46 add_custom_command(OUTPUT "${OUT}"
47 COMMAND "${CMAKE_COMMAND}" -E copy "${IN}" "${OUT}"
48 MAIN_DEPENDENCY "${IN}"
49 )
50 add_dependencies(NicePyConsole "${OUT}")
51 endforeach()
52
53 foreach(DIR ${DIRS})
54 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${DIR}")
55 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}")
56 add_custom_command(OUTPUT "${OUT}"
57 COMMAND "${CMAKE_COMMAND}" -E copy_directory "${IN}" "${OUT}"
58 MAIN_DEPENDENCY "${IN}"
41 )
59 )
42 add_dependencies(NicePyConsole ${FILE})
60 add_dependencies(NicePyConsole "${OUT}")
43 endforeach()
61 endforeach()
@@ -1,7 +1,5
1 project(PythonQt_QtAll)
1 project(PythonQt_QtAll)
2
2
3 SET(GEN ../../generated_cpp${generated_cpp_suffix})
4
5 # Bindings
3 # Bindings
6 SET(HEADERS
4 SET(HEADERS
7 PythonQt_QtAll.h
5 PythonQt_QtAll.h
@@ -11,147 +9,152 SET(SOURCES
11 PythonQt_QtAll.cpp
9 PythonQt_QtAll.cpp
12 )
10 )
13
11
14 # Core
12 #-------------------------------------------------------------------
15 LIST(APPEND HEADERS
13 # Generated stuff
16 ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.h
14 SET(GEN ../../generated_cpp${generated_cpp_suffix})
17 ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.h
18 ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.h
19 )
20
21 LIST(APPEND SOURCES
22 ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.cpp
23 ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.cpp
24 ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.cpp
25 ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp
26 )
27
28 # Gui
29 LIST(APPEND HEADERS
30 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.h
31 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.h
32 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.h
33 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.h
34 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.h
35 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.h
36 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.h
37 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
38 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.h
39 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.h
40 )
41
42 LIST(APPEND SOURCES
43 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.cpp
44 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.cpp
45 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.cpp
46 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.cpp
47 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.cpp
48 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.cpp
49 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.cpp
50 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
51 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.cpp
52 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.cpp
53 ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui_init.cpp
54 )
55
56 # Network
57 LIST(APPEND HEADERS
58 ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.h
59 )
60
61 LIST(APPEND SOURCES
62 ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.cpp
63 ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp
64 )
65
66 # OpenGL
67 LIST(APPEND HEADERS
68 ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.h
69 )
70
71 LIST(APPEND SOURCES
72 ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.cpp
73 ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl_init.cpp
74 )
75
76 # Sql
77 LIST(APPEND HEADERS
78 ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.h
79 )
80
81 LIST(APPEND SOURCES
82 ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.cpp
83 ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql_init.cpp
84 )
85
86 # Svg
87 LIST(APPEND HEADERS
88 ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.h
89 )
90
91 LIST(APPEND SOURCES
92 ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.cpp
93 ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg_init.cpp
94 )
95
96 # uitools
97 LIST(APPEND HEADERS
98 ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h
99 )
100
101 LIST(APPEND SOURCES
102 ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp
103 ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp
104 )
105
106 # WebKit
107 LIST(APPEND HEADERS
108 ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.h
109 )
110
111 LIST(APPEND SOURCES
112 ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.cpp
113 ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit_init.cpp
114 )
115
116 # Xml
117 LIST(APPEND HEADERS
118 ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.h
119 )
120
15
121 LIST(APPEND SOURCES
16 foreach(MODULE core gui network opengl sql svg uitools webkit xml)
122 ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.cpp
17 SET(MODULE_TROLL com_trolltech_qt_${MODULE})
123 ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml_init.cpp
18 SET(MODULE_BASE ${GEN}/${MODULE_TROLL}/${MODULE_TROLL})
124 )
19 FILE(GLOB HFILES ${MODULE_BASE}*.h)
20 FILE(GLOB CFILES ${MODULE_BASE}*.cpp)
21 LIST(APPEND HEADERS ${HFILES})
22 LIST(APPEND SOURCES ${CFILES})
23 endforeach()
24
25 ## Core
26 #LIST(APPEND HEADERS
27 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.h
28 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.h
29 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.h
30 #)
31
32 #LIST(APPEND SOURCES
33 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.cpp
34 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.cpp
35 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.cpp
36 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp
37 #)
38
39 ## Gui
40 #LIST(APPEND HEADERS
41 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.h
42 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.h
43 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.h
44 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.h
45 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.h
46 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.h
47 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.h
48 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
49 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.h
50 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.h
51 #)
52
53 #LIST(APPEND SOURCES
54 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.cpp
55 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.cpp
56 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.cpp
57 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.cpp
58 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.cpp
59 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.cpp
60 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.cpp
61 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
62 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.cpp
63 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.cpp
64 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui_init.cpp
65 #)
66
67 ## Network
68 #LIST(APPEND HEADERS
69 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.h
70 #)
71
72 #LIST(APPEND SOURCES
73 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.cpp
74 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp
75 #)
76
77 ## OpenGL
78 #LIST(APPEND HEADERS
79 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.h
80 #)
81
82 #LIST(APPEND SOURCES
83 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.cpp
84 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl_init.cpp
85 #)
86
87 ## Sql
88 #LIST(APPEND HEADERS
89 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.h
90 #)
91
92 #LIST(APPEND SOURCES
93 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.cpp
94 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql_init.cpp
95 #)
96
97 ## Svg
98 #LIST(APPEND HEADERS
99 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.h
100 #)
101
102 #LIST(APPEND SOURCES
103 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.cpp
104 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg_init.cpp
105 #)
106
107 ## uitools
108 #LIST(APPEND HEADERS
109 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h
110 #)
111
112 #LIST(APPEND SOURCES
113 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp
114 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp
115 #)
116
117 ## WebKit
118 #LIST(APPEND HEADERS
119 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.h
120 #)
121
122 #LIST(APPEND SOURCES
123 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.cpp
124 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit_init.cpp
125 #)
126
127 ## Xml
128 #LIST(APPEND HEADERS
129 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.h
130 #)
131
132 #LIST(APPEND SOURCES
133 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.cpp
134 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml_init.cpp
135 #)
125
136
126 #-------------------------------------------------------------------
137 #-------------------------------------------------------------------
127 # Build
138 # Build
139 set(PythonQt_QtAll ${PythonQt_LibraryName}_QtAll${PythonQt_LibrarySuffix} CACHE INTERNAL "")
128
140
129 include_directories(../../src)
141 include_directories(../../src)
130 add_definitions(-DPYTHONQT_QTALL_EXPORTS)
142 add_definitions(-DPYTHONQT_QTALL_EXPORTS)
131 qt_wrap_cpp(GEN_MOC ${HEADERS})
143 qt_wrap_cpp(GEN_MOC ${HEADERS})
132
144
133 SET(QT
145 SET(QT Core Gui Network OpenGL Sql Svg UiTools WebKit Xml)
134 Core
135 Gui
136 Network
137 OpenGL
138 Sql
139 Svg
140 UiTools
141 WebKit
142 Xml
143 )
144
145 if(PythonQt_Qt5)
146 if(PythonQt_Qt5)
146 LIST(APPEND QT
147 LIST(APPEND QT Widgets WebKitWidgets)
147 Widgets
148 WebKitWidgets
149 )
150 endif()
148 endif()
151
149
152
150
153 add_library(PythonQt_QtAll SHARED ${SOURCES} ${GEN_MOC})
151 add_library(${PythonQt_QtAll} SHARED ${SOURCES} ${GEN_MOC})
154 qt_use_modules(PythonQt_QtAll ${QT})
152 qt_use_modules(${PythonQt_QtAll} ${QT})
153
154 get_property(PythonQt_lib TARGET ${PythonQt} PROPERTY LOCATION)
155 target_link_libraries(${PythonQt_QtAll} ${PythonQt_lib} ${PYTHON_LIBRARIES})
155
156
156 get_property(PythonQt_lib TARGET PythonQt PROPERTY LOCATION)
157 install(TARGETS ${PythonQt_QtAll}
157 target_link_libraries(PythonQt_QtAll ${PythonQt_lib} ${PYTHON_LIBRARIES})
158 RUNTIME DESTINATION bin
159 LIBRARY DESTINATION lib
160 ARCHIVE DESTINATION lib)
@@ -186,7 +186,11 void delete_QByteArray(QByteArray* obj) { delete obj; }
186
186
187 PyObject* data(QByteArray* b) {
187 PyObject* data(QByteArray* b) {
188 if (b->data()) {
188 if (b->data()) {
189 #ifdef PY3K
190 return PyUnicode_FromStringAndSize(b->data(), b->size());
191 #else
189 return PyString_FromStringAndSize(b->data(), b->size());
192 return PyString_FromStringAndSize(b->data(), b->size());
193 #endif
190 } else {
194 } else {
191 Py_INCREF(Py_None);
195 Py_INCREF(Py_None);
192 return Py_None;
196 return Py_None;
@@ -8,8 +8,7 SET(RESOURCES)
8 SET(INCLUDEPATH)
8 SET(INCLUDEPATH)
9 SET(DEFINES)
9 SET(DEFINES)
10
10
11 SET(GENERATORPATH ${CMAKE_CURRENT_SOURCE_DIR})
11 include(${CMAKE_CURRENT_SOURCE_DIR}/generator_50.cmake)
12 include(${GENERATORPATH}/generator_50.cmake)
13
12
14 LIST(APPEND HEADERS
13 LIST(APPEND HEADERS
15 #generatorscript.h
14 #generatorscript.h
@@ -1,13 +1,16
1
1
2 IF(NOT GENERATORPATH)
3 SET(GENERATORPATH ${CMAKE_CURRENT_LIST_DIR})
4 ENDIF()
5
2 LIST(APPEND INCLUDEPATH ${GENERATORPATH})
6 LIST(APPEND INCLUDEPATH ${GENERATORPATH})
3 LIST(APPEND INCLUDEPATH ${GENERATORPATH}/.)
7 LIST(APPEND INCLUDEPATH ${GENERATORPATH}/.)
4 LIST(APPEND INCLUDEPATH ${GENERATORPATH}/../common)
8 LIST(APPEND INCLUDEPATH ${GENERATORPATH}/../common)
5
9
6 LIST(APPEND RESOURCES ${GENERATORPATH}/generator.qrc)
10 LIST(APPEND RESOURCES ${GENERATORPATH}/generator.qrc)
7
11
8 SET(RXXPATH ${GENERATORPATH}/parser)
12 include(${GENERATORPATH}/parser/rxx.cmake)
9 include(${RXXPATH}/rxx.cmake)
13 include(${GENERATORPATH}/parser/rpp/rpp.cmake)
10 include(${RXXPATH}/rpp/rpp.cmake)
11
14
12 LIST(APPEND HEADERS
15 LIST(APPEND HEADERS
13 ${GENERATORPATH}/generator.h
16 ${GENERATORPATH}/generator.h
@@ -1,3 +1,8
1
2 IF(NOT RXXPATH)
3 SET(RXXPATH ${CMAKE_CURRENT_LIST_DIR})
4 ENDIF()
5
1 LIST(APPEND INCLUDEPATH ${RXXPATH})
6 LIST(APPEND INCLUDEPATH ${RXXPATH})
2
7
3 LIST(APPEND DEFINES -DRXX_ALLOCATOR_INIT_0)
8 LIST(APPEND DEFINES -DRXX_ALLOCATOR_INIT_0)
@@ -78,35 +78,32 set(SOURCES_MOC
78 set(SOURCES_QRC )
78 set(SOURCES_QRC )
79
79
80 #-----------------------------------------------------------------------------
80 #-----------------------------------------------------------------------------
81 # Do wrapping
82 qt_wrap_cpp(GEN_MOC ${SOURCES_MOC})
83 qt_add_resources(GEN_QRC ${SOURCES_QRC})
84
85 #-----------------------------------------------------------------------------
86 # Build the library
81 # Build the library
82 set(PythonQt ${PythonQt_LibraryName}${PythonQt_LibrarySuffix} CACHE INTERNAL "")
87
83
88 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
84 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
89
85
90 #add_definitions(-DQT_NO_KEYWORDS) # recent python versions use them :(
86 qt_wrap_cpp(GEN_MOC ${SOURCES_MOC})
87 qt_add_resources(GEN_QRC ${SOURCES_QRC})
91
88
92 add_library(PythonQt SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC} ${HEADERS})
89 add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC} ${HEADERS})
93 if(PythonQt_Qt5)
90 if(PythonQt_Qt5)
94 qt_use_modules(PythonQt Core Gui Widgets)
91 qt_use_modules(${PythonQt} Core Gui Widgets)
95 else()
92 else()
96 qt_use_modules(PythonQt Core Gui)
93 qt_use_modules(${PythonQt} Core Gui)
97 endif()
94 endif()
98 target_link_libraries(PythonQt ${PYTHON_LIBRARIES})
95 target_link_libraries(${PythonQt} ${PYTHON_LIBRARIES})
99
96
100 #
97 #
101 # That should solve linkage error on Mac when the project is used in a superbuild setup
98 # That should solve linkage error on Mac when the project is used in a superbuild setup
102 # See http://blog.onesadcookie.com/2008/01/installname-magic.html
99 # See http://blog.onesadcookie.com/2008/01/installname-magic.html
103 #
100 #
104 set_target_properties(PythonQt PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
101 set_target_properties(${PythonQt} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
105
102
106 #-----------------------------------------------------------------------------
103 #-----------------------------------------------------------------------------
107 # Install library (on windows, put the dll in 'bin' and the archive in 'lib')
104 # Install library (on windows, put the dll in 'bin' and the archive in 'lib')
108
105
109 install(TARGETS PythonQt
106 install(TARGETS ${PythonQt}
110 RUNTIME DESTINATION bin
107 RUNTIME DESTINATION bin
111 LIBRARY DESTINATION lib
108 LIBRARY DESTINATION lib
112 ARCHIVE DESTINATION lib)
109 ARCHIVE DESTINATION lib)
@@ -662,20 +662,20 static PyObject * PythonQtInstanceWrapper_str(PyObject * obj)
662 if (wrapper->_wrappedPtr) {
662 if (wrapper->_wrappedPtr) {
663 if (wrapper->_obj) {
663 if (wrapper->_obj) {
664 #ifdef PY3K
664 #ifdef PY3K
665 return PyUnicode_FromFormat("%s (C++ Object %p wrapped by %s %p)", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
665 return PyUnicode_FromFormat("<%s C++ Object at %p wrapped by %s at %p>", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
666 #else
666 #else
667 return PyString_FromFormat("%s (C++ Object %p wrapped by %s %p)", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
667 return PyString_FromFormat("%s (C++ Object %p wrapped by %s %p)", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
668 #endif
668 #endif
669 } else {
669 } else {
670 #ifdef PY3K
670 #ifdef PY3K
671 return PyUnicode_FromFormat("%s (C++ Object %p)", typeName, wrapper->_wrappedPtr);
671 return PyUnicode_FromFormat("<%s C++ Object at %p>", typeName, wrapper->_wrappedPtr);
672 #else
672 #else
673 return PyString_FromFormat("%s (C++ Object %p)", typeName, wrapper->_wrappedPtr);
673 return PyString_FromFormat("%s (C++ Object %p)", typeName, wrapper->_wrappedPtr);
674 #endif
674 #endif
675 }
675 }
676 } else {
676 } else {
677 #ifdef PY3K
677 #ifdef PY3K
678 return PyUnicode_FromFormat("%s (QObject %p)", typeName, qobj);
678 return PyUnicode_FromFormat("<%s QObject at %p>", typeName, qobj);
679 #else
679 #else
680 return PyString_FromFormat("%s (QObject %p)", typeName, qobj);
680 return PyString_FromFormat("%s (QObject %p)", typeName, qobj);
681 #endif
681 #endif
@@ -698,7 +698,7 static PyObject * PythonQtInstanceWrapper_repr(PyObject * obj)
698 #endif
698 #endif
699 } else {
699 } else {
700 #ifdef PY3K
700 #ifdef PY3K
701 return PyUnicode_FromFormat("%s (%s, at: %p)", typeName, str.toLatin1().constData(), wrapper->_wrappedPtr ? wrapper->_wrappedPtr : qobj);
701 return PyUnicode_FromFormat("<%s %s at %p>", typeName, str.toLatin1().constData(), wrapper->_wrappedPtr ? wrapper->_wrappedPtr : qobj);
702 #else
702 #else
703 return PyString_FromFormat("%s (%s, at: %p)", typeName, str.toLatin1().constData(), wrapper->_wrappedPtr ? wrapper->_wrappedPtr : qobj);
703 return PyString_FromFormat("%s (%s, at: %p)", typeName, str.toLatin1().constData(), wrapper->_wrappedPtr ? wrapper->_wrappedPtr : qobj);
704 #endif
704 #endif
@@ -707,20 +707,20 static PyObject * PythonQtInstanceWrapper_repr(PyObject * obj)
707 if (wrapper->_wrappedPtr) {
707 if (wrapper->_wrappedPtr) {
708 if (wrapper->_obj) {
708 if (wrapper->_obj) {
709 #ifdef PY3K
709 #ifdef PY3K
710 return PyUnicode_FromFormat("%s (C++ object at: %p wrapped by %s at: %p)", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
710 return PyUnicode_FromFormat("<%s C++ object at %p wrapped by %s at %p>", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
711 #else
711 #else
712 return PyString_FromFormat("%s (C++ object at: %p wrapped by %s at: %p)", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
712 return PyString_FromFormat("%s (C++ object at: %p wrapped by %s at: %p)", typeName, wrapper->_wrappedPtr, wrapper->_obj->metaObject()->className(), qobj);
713 #endif
713 #endif
714 } else {
714 } else {
715 #ifdef PY3K
715 #ifdef PY3K
716 return PyUnicode_FromFormat("%s (C++ object at: %p)", typeName, wrapper->_wrappedPtr);
716 return PyUnicode_FromFormat("<%s C++ object at %p>", typeName, wrapper->_wrappedPtr);
717 #else
717 #else
718 return PyString_FromFormat("%s (C++ object at: %p)", typeName, wrapper->_wrappedPtr);
718 return PyString_FromFormat("%s (C++ object at: %p)", typeName, wrapper->_wrappedPtr);
719 #endif
719 #endif
720 }
720 }
721 } else {
721 } else {
722 #ifdef PY3K
722 #ifdef PY3K
723 return PyUnicode_FromFormat("%s (%s at: %p)", typeName, wrapper->classInfo()->className(), qobj);
723 return PyUnicode_FromFormat("<%s %s at %p>", typeName, wrapper->classInfo()->className(), qobj);
724 #else
724 #else
725 return PyString_FromFormat("%s (%s at: %p)", typeName, wrapper->classInfo()->className(), qobj);
725 return PyString_FromFormat("%s (%s at: %p)", typeName, wrapper->classInfo()->className(), qobj);
726 #endif
726 #endif
@@ -22,5 +22,5 if(PythonQt_Qt5)
22 else()
22 else()
23 qt_use_modules(PythonQtTest Test Gui)
23 qt_use_modules(PythonQtTest Test Gui)
24 endif()
24 endif()
25 get_property(PythonQt_lib TARGET PythonQt PROPERTY LOCATION)
25 get_property(PythonQt_lib TARGET ${PythonQt} PROPERTY LOCATION)
26 target_link_libraries(PythonQtTest ${PythonQt_lib} ${PYTHON_LIBRARIES})
26 target_link_libraries(PythonQtTest ${PythonQt_lib} ${PYTHON_LIBRARIES})
General Comments 0
You need to be logged in to leave comments. Login now