@@ -1,179 +1,180 | |||
|
1 | 1 | project(PythonQt) |
|
2 | 2 | cmake_minimum_required(VERSION 2.8.10) |
|
3 | 3 | |
|
4 | 4 | include(CTestUseLaunchers OPTIONAL) |
|
5 | 5 | |
|
6 | 6 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) |
|
7 | 7 | |
|
8 | 8 | #----------------------------------------------------------------------------- |
|
9 | 9 | # Debug |
|
10 | SET(PythonQt_VERSION 2.2.0) | |
|
11 | ||
|
12 | #----------------------------------------------------------------------------- | |
|
13 | # Debug | |
|
10 | 14 | option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF) |
|
11 | 15 | if(PythonQt_DEBUG) |
|
12 | 16 | add_definitions(-DPYTHONQT_DEBUG) |
|
13 | 17 | else() |
|
14 | 18 | remove_definitions(-DPYTHONQT_DEBUG) |
|
15 | 19 | endif() |
|
16 | 20 | |
|
17 | 21 | if(NOT CMAKE_BUILD_TYPE) |
|
18 | 22 | set(CMAKE_BUILD_TYPE Release) |
|
19 | 23 | endif() |
|
20 | 24 | |
|
21 | 25 | #----------------------------------------------------------------------------- |
|
22 | 26 | # Qt |
|
23 |
option(PythonQt_Qt5 "Use Qt 5.x |
|
|
27 | option(PythonQt_Qt5 "Use Qt 5.x" OFF) | |
|
24 | 28 | if(PythonQt_Qt5) |
|
25 | 29 | include(PythonQt_Qt_5x) |
|
26 | 30 | else(PythonQt_Qt5) |
|
27 | 31 | include(PythonQt_Qt_4x) |
|
28 | 32 | endif(PythonQt_Qt5) |
|
29 | 33 | |
|
30 | 34 | #----------------------------------------------------------------------------- |
|
31 | 35 | # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers |
|
32 | 36 | # associated with the Qt version being used. |
|
33 | 37 | set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}") |
|
34 | 38 | |
|
35 | 39 | if("${generated_cpp_suffix}" STREQUAL "_48") |
|
36 | 40 | set(generated_cpp_suffix "") |
|
37 | 41 | endif() |
|
38 | 42 | if("${generated_cpp_suffix}" STREQUAL "_46") |
|
39 | 43 | set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version |
|
40 | 44 | endif() |
|
41 | 45 | if("${generated_cpp_suffix}" STREQUAL "_51") |
|
42 | 46 | set(generated_cpp_suffix "_50") |
|
43 | 47 | endif() |
|
44 | 48 | |
|
45 | 49 | #----------------------------------------------------------------------------- |
|
46 | 50 | # Generator |
|
47 | 51 | if(PythonQt_Qt5) |
|
48 | 52 | add_subdirectory(generator_50 EXCLUDE_FROM_ALL) |
|
49 | 53 | add_custom_target(generator) |
|
50 | 54 | add_dependencies(generator pythonqt_generator) |
|
51 | 55 | endif() |
|
52 | 56 | |
|
53 | 57 | # TODO |
|
54 | 58 | |
|
55 | 59 | #----------------------------------------------------------------------------- |
|
56 | 60 | # Build options |
|
57 | 61 | |
|
58 | 62 | #option(PythonQt_Wrap_QtAll "Make all Qt components available in python" OFF) |
|
59 | 63 | # |
|
60 | 64 | #set(qtlibs core gui network opengl sql svg uitools webkit xml xmlpatterns) |
|
61 | 65 | #foreach(qtlib ${qtlibs}) |
|
62 | 66 | # OPTION(PythonQt_Wrap_Qt${qtlib} "Make all of Qt${qtlib} available in python" OFF) |
|
63 | 67 | #endforeach() |
|
64 | 68 | |
|
65 | 69 | # Force option if it applies |
|
66 | 70 | #if(PythonQt_Wrap_QtAll) |
|
67 | 71 | # list(REMOVE_ITEM qtlibs xmlpatterns) # xmlpatterns wrapper does *NOT* build at all :( |
|
68 | 72 | # foreach(qtlib ${qtlibs}) |
|
69 | 73 | # if(NOT ${PythonQt_Wrap_Qt${qtlib}}) |
|
70 | 74 | # set(PythonQt_Wrap_Qt${qtlib} ON CACHE BOOL "Make all of Qt${qtlib} available in python" FORCE) |
|
71 | 75 | # message(STATUS "Enabling [PythonQt_Wrap_Qt${qtlib}] because of [PythonQt_Wrap_QtAll] evaluates to True") |
|
72 | 76 | # endif() |
|
73 | 77 | # endforeach() |
|
74 | 78 | #endif() |
|
75 | 79 | |
|
76 | 80 | #----------------------------------------------------------------------------- |
|
77 | 81 | # Add extra sources |
|
78 | 82 | #foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns) |
|
79 | 83 | # |
|
80 | 84 | # if (${PythonQt_Wrap_Qt${qtlib}}) |
|
81 | 85 | # |
|
82 | 86 | # ADD_DEFINITIONS(-DPYTHONQT_WRAP_Qt${qtlib}) |
|
83 | 87 | # |
|
84 | 88 | # set(file_prefix generated_cpp${generated_cpp_suffix}/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib}) |
|
85 | 89 | # |
|
86 | 90 | # foreach(index RANGE 0 11) |
|
87 | 91 | # |
|
88 | 92 | # # Source files |
|
89 | 93 | # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.cpp) |
|
90 | 94 | # list(APPEND sources ${file_prefix}${index}.cpp) |
|
91 | 95 | # endif() |
|
92 | 96 | # |
|
93 | 97 | # # Headers that should run through moc |
|
94 | 98 | # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.h) |
|
95 | 99 | # list(APPEND moc_sources ${file_prefix}${index}.h) |
|
96 | 100 | # endif() |
|
97 | 101 | # |
|
98 | 102 | # endforeach() |
|
99 | 103 | # |
|
100 | 104 | # list(APPEND sources ${file_prefix}_init.cpp) |
|
101 | 105 | # |
|
102 | 106 | # endif() |
|
103 | 107 | #endforeach() |
|
104 | 108 | |
|
105 | 109 | #----------------------------------------------------------------------------- |
|
106 | 110 | # Find Python |
|
107 | 111 | option(PythonQt_Python3 "Use Python 3.x (3.3+)" OFF) |
|
108 | 112 | option(PythonQt_Python "Use specific Python Version" OFF) |
|
109 | 113 | if(PythonQt_Python) |
|
110 | 114 | find_package(Python ${PythonQt_Python} REQUIRED EXACT) |
|
111 | 115 | elseif(PythonQt_Python3) |
|
112 | 116 | find_package(Python 3.3 REQUIRED) |
|
113 | 117 | else() |
|
114 | 118 | find_package(Python 2.6 REQUIRED) |
|
115 | 119 | endif() |
|
116 | 120 | |
|
117 | 121 | if(NOT ${PYTHON_VERSION} VERSION_LESS 3) |
|
118 | 122 | set(PythonQt_Python3 ON) |
|
119 | 123 | else() |
|
120 | 124 | set(PythonQt_Python3 OFF) |
|
121 | 125 | endif() |
|
122 | 126 | |
|
123 | 127 | include_directories(${PYTHON_INCLUDE_DIRS}) |
|
124 | 128 | add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK) |
|
125 | 129 | |
|
126 | 130 | #----------------------------------------------------------------------------- |
|
127 | 131 | # Library Name |
|
128 |
# The variable PythonQt |
|
|
132 | # The variable PythonQt contains the PythonQt core library name | |
|
129 | 133 | # It incorporates library mayor versions |
|
130 | # The variable PythonQt_LibrarySuffix is "" or "_d", if it is a debug build | |
|
131 | set(PythonQt_LibraryName PythonQt) | |
|
134 | set(PythonQt PythonQt) | |
|
132 | 135 | |
|
133 | 136 | if(PythonQt_Qt5) |
|
134 |
set(PythonQt |
|
|
137 | set(PythonQt ${PythonQt}5) | |
|
135 | 138 | endif() |
|
136 | 139 | |
|
137 | 140 | if(PythonQt_Python3) |
|
138 |
set(PythonQt |
|
|
141 | set(PythonQt ${PythonQt}_3) | |
|
139 | 142 | endif() |
|
140 | 143 | |
|
141 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | |
|
142 | set(PythonQt_LibrarySuffix _d) | |
|
143 | endif() | |
|
144 | set(CMAKE_DEBUG_POSTFIX "_d") | |
|
144 | 145 | |
|
145 |
message(STATUS "Building ${PythonQt |
|
|
146 | message(STATUS "Building ${PythonQt} (Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} + Python ${PYTHON_VERSION} | ${CMAKE_BUILD_TYPE})") | |
|
146 | 147 | |
|
147 | 148 | #----------------------------------------------------------------------------- |
|
148 | 149 | # Core |
|
149 | 150 | add_subdirectory(src) |
|
150 | 151 | |
|
151 | 152 | #----------------------------------------------------------------------------- |
|
152 | 153 | # Tests |
|
153 | 154 | add_subdirectory(tests EXCLUDE_FROM_ALL) |
|
154 | 155 | # test alias |
|
155 | 156 | add_custom_target(test COMMAND tests/PythonQtTest WORKING_DIRECTORY ${CURRENT_BINARY_DIR}) |
|
156 | 157 | add_dependencies(test PythonQtTest) |
|
157 | 158 | |
|
158 | 159 | #----------------------------------------------------------------------------- |
|
159 | 160 | # Extenseions (QtAll) |
|
160 | 161 | add_subdirectory(extensions) |
|
161 | 162 | # QtAll alias |
|
162 | 163 | add_custom_target(QtAll) |
|
163 | 164 | add_dependencies(QtAll ${PythonQt_QtAll}) |
|
164 | 165 | |
|
165 | 166 | #----------------------------------------------------------------------------- |
|
166 | 167 | # Examples |
|
167 | 168 | include_directories(src) |
|
168 | 169 | include_directories(extensions/PythonQt_QtAll) |
|
169 | 170 | add_subdirectory(examples EXCLUDE_FROM_ALL) |
|
170 | 171 | |
|
171 | 172 | #----------------------------------------------------------------------------- |
|
172 | 173 | # uninstall target |
|
173 | 174 | configure_file( |
|
174 | 175 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" |
|
175 | 176 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" |
|
176 | 177 | IMMEDIATE @ONLY) |
|
177 | 178 | |
|
178 | 179 | add_custom_target(uninstall |
|
179 | 180 | COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |
@@ -1,61 +1,59 | |||
|
1 | 1 | project(NicePyConsole) |
|
2 | 2 | |
|
3 | 3 | SET(HEADERS |
|
4 | 4 | SimpleConsole.h |
|
5 | 5 | NicePyConsole.h |
|
6 | 6 | PygmentsHighlighter.h |
|
7 | 7 | PythonCompleter.h |
|
8 | 8 | PythonCompleterPopup.h |
|
9 | 9 | ) |
|
10 | 10 | |
|
11 | 11 | SET(SOURCES |
|
12 | 12 | SimpleConsole.cpp |
|
13 | 13 | NicePyConsole.cpp |
|
14 | 14 | main.cpp |
|
15 | 15 | PygmentsHighlighter.cpp |
|
16 | 16 | PythonCompleter.cpp |
|
17 | 17 | PythonCompleterPopup.cpp |
|
18 | 18 | ) |
|
19 | 19 | |
|
20 | 20 | SET(FILES |
|
21 | 21 | PygmentsHighlighter.py |
|
22 | 22 | PythonCompleter.py |
|
23 | 23 | module_completion.py |
|
24 | 24 | ) |
|
25 | 25 | |
|
26 | 26 | SET(DIRS |
|
27 | 27 | pygments |
|
28 | 28 | ) |
|
29 | 29 | |
|
30 | find_package(${PythonQt}) | |
|
31 | ||
|
32 | 30 | qt_wrap_cpp(GEN_MOC ${HEADERS}) |
|
33 | 31 | |
|
34 | 32 | add_executable(NicePyConsole ${SOURCES} ${GEN_MOC}) |
|
35 | 33 | if(PythonQt_Qt5) |
|
36 | 34 | qt_use_modules(NicePyConsole Core Gui Widgets) |
|
37 | 35 | else() |
|
38 | 36 | qt_use_modules(NicePyConsole Core Gui) |
|
39 | 37 | endif() |
|
40 | 38 | |
|
41 | 39 | target_link_libraries(NicePyConsole ${PythonQt} ${PythonQt_QtAll} ${PYTHON_LIBRARIES}) |
|
42 | 40 | |
|
43 | 41 | foreach(FILE ${FILES}) |
|
44 | 42 | SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${FILE}") |
|
45 | 43 | SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}") |
|
46 | 44 | add_custom_command(OUTPUT "${OUT}" |
|
47 | 45 | COMMAND "${CMAKE_COMMAND}" -E copy "${IN}" "${OUT}" |
|
48 | 46 | MAIN_DEPENDENCY "${IN}" |
|
49 | 47 | ) |
|
50 | 48 | add_dependencies(NicePyConsole "${OUT}") |
|
51 | 49 | endforeach() |
|
52 | 50 | |
|
53 | 51 | foreach(DIR ${DIRS}) |
|
54 | 52 | SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${DIR}") |
|
55 | 53 | SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}") |
|
56 | 54 | add_custom_command(OUTPUT "${OUT}" |
|
57 | 55 | COMMAND "${CMAKE_COMMAND}" -E copy_directory "${IN}" "${OUT}" |
|
58 | 56 | MAIN_DEPENDENCY "${IN}" |
|
59 | 57 | ) |
|
60 | 58 | add_dependencies(NicePyConsole "${OUT}") |
|
61 | 59 | endforeach() |
@@ -1,188 +1,191 | |||
|
1 | 1 | project(PythonQt_QtAll) |
|
2 | 2 | |
|
3 | 3 | # Bindings |
|
4 | 4 | SET(HEADERS |
|
5 | 5 | PythonQt_QtAll.h |
|
6 | 6 | ) |
|
7 | 7 | |
|
8 | 8 | SET(SOURCES |
|
9 | 9 | PythonQt_QtAll.cpp |
|
10 | 10 | ) |
|
11 | 11 | |
|
12 | 12 | #------------------------------------------------------------------- |
|
13 | 13 | # Generated stuff |
|
14 | 14 | SET(GEN ../../generated_cpp${generated_cpp_suffix}) |
|
15 | SET(GEN_HEADERS) | |
|
16 | SET(GEN_SOURCES) | |
|
15 | 17 | |
|
16 | 18 | foreach(MODULE core gui network opengl sql svg uitools webkit xml) |
|
17 | 19 | SET(MODULE_TROLL com_trolltech_qt_${MODULE}) |
|
18 | 20 | SET(MODULE_BASE ${GEN}/${MODULE_TROLL}/${MODULE_TROLL}) |
|
19 | 21 | FILE(GLOB HFILES ${MODULE_BASE}*.h) |
|
20 | 22 | FILE(GLOB CFILES ${MODULE_BASE}*.cpp) |
|
21 | LIST(APPEND HEADERS ${HFILES}) | |
|
22 | LIST(APPEND SOURCES ${CFILES}) | |
|
23 | LIST(APPEND GEN_HEADERS ${HFILES}) | |
|
24 | LIST(APPEND GEN_SOURCES ${CFILES}) | |
|
23 | 25 | endforeach() |
|
24 | 26 | |
|
25 | 27 | ## Core |
|
26 | 28 | #LIST(APPEND HEADERS |
|
27 | 29 | # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.h |
|
28 | 30 | # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.h |
|
29 | 31 | # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.h |
|
30 | 32 | #) |
|
31 | 33 | |
|
32 | 34 | #LIST(APPEND SOURCES |
|
33 | 35 | # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.cpp |
|
34 | 36 | # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.cpp |
|
35 | 37 | # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.cpp |
|
36 | 38 | # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp |
|
37 | 39 | #) |
|
38 | 40 | |
|
39 | 41 | ## Gui |
|
40 | 42 | #LIST(APPEND HEADERS |
|
41 | 43 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.h |
|
42 | 44 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.h |
|
43 | 45 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.h |
|
44 | 46 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.h |
|
45 | 47 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.h |
|
46 | 48 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.h |
|
47 | 49 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.h |
|
48 | 50 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.h |
|
49 | 51 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.h |
|
50 | 52 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.h |
|
51 | 53 | #) |
|
52 | 54 | |
|
53 | 55 | #LIST(APPEND SOURCES |
|
54 | 56 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.cpp |
|
55 | 57 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.cpp |
|
56 | 58 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.cpp |
|
57 | 59 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.cpp |
|
58 | 60 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.cpp |
|
59 | 61 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.cpp |
|
60 | 62 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.cpp |
|
61 | 63 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp |
|
62 | 64 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.cpp |
|
63 | 65 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.cpp |
|
64 | 66 | # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui_init.cpp |
|
65 | 67 | #) |
|
66 | 68 | |
|
67 | 69 | ## Network |
|
68 | 70 | #LIST(APPEND HEADERS |
|
69 | 71 | # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.h |
|
70 | 72 | #) |
|
71 | 73 | |
|
72 | 74 | #LIST(APPEND SOURCES |
|
73 | 75 | # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.cpp |
|
74 | 76 | # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp |
|
75 | 77 | #) |
|
76 | 78 | |
|
77 | 79 | ## OpenGL |
|
78 | 80 | #LIST(APPEND HEADERS |
|
79 | 81 | # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.h |
|
80 | 82 | #) |
|
81 | 83 | |
|
82 | 84 | #LIST(APPEND SOURCES |
|
83 | 85 | # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.cpp |
|
84 | 86 | # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl_init.cpp |
|
85 | 87 | #) |
|
86 | 88 | |
|
87 | 89 | ## Sql |
|
88 | 90 | #LIST(APPEND HEADERS |
|
89 | 91 | # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.h |
|
90 | 92 | #) |
|
91 | 93 | |
|
92 | 94 | #LIST(APPEND SOURCES |
|
93 | 95 | # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.cpp |
|
94 | 96 | # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql_init.cpp |
|
95 | 97 | #) |
|
96 | 98 | |
|
97 | 99 | ## Svg |
|
98 | 100 | #LIST(APPEND HEADERS |
|
99 | 101 | # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.h |
|
100 | 102 | #) |
|
101 | 103 | |
|
102 | 104 | #LIST(APPEND SOURCES |
|
103 | 105 | # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.cpp |
|
104 | 106 | # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg_init.cpp |
|
105 | 107 | #) |
|
106 | 108 | |
|
107 | 109 | ## uitools |
|
108 | 110 | #LIST(APPEND HEADERS |
|
109 | 111 | # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h |
|
110 | 112 | #) |
|
111 | 113 | |
|
112 | 114 | #LIST(APPEND SOURCES |
|
113 | 115 | # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp |
|
114 | 116 | # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp |
|
115 | 117 | #) |
|
116 | 118 | |
|
117 | 119 | ## WebKit |
|
118 | 120 | #LIST(APPEND HEADERS |
|
119 | 121 | # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.h |
|
120 | 122 | #) |
|
121 | 123 | |
|
122 | 124 | #LIST(APPEND SOURCES |
|
123 | 125 | # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.cpp |
|
124 | 126 | # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit_init.cpp |
|
125 | 127 | #) |
|
126 | 128 | |
|
127 | 129 | ## Xml |
|
128 | 130 | #LIST(APPEND HEADERS |
|
129 | 131 | # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.h |
|
130 | 132 | #) |
|
131 | 133 | |
|
132 | 134 | #LIST(APPEND SOURCES |
|
133 | 135 | # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.cpp |
|
134 | 136 | # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml_init.cpp |
|
135 | 137 | #) |
|
136 | 138 | |
|
137 | 139 | #------------------------------------------------------------------- |
|
138 | 140 | # Build |
|
139 |
set(PythonQt_QtAll ${PythonQt |
|
|
140 | ||
|
141 | find_package(${PythonQt}) | |
|
141 | set(PythonQt_QtAll ${PythonQt}_QtAll CACHE INTERNAL "") | |
|
142 | 142 | |
|
143 | 143 | include_directories(../../src) |
|
144 | 144 | add_definitions(-DPYTHONQT_QTALL_EXPORTS) |
|
145 | qt_wrap_cpp(GEN_MOC ${HEADERS}) | |
|
145 | qt_wrap_cpp(GEN_MOC ${GEN_HEADERS}) | |
|
146 | 146 | |
|
147 | 147 | SET(QT Core Gui Network OpenGL Sql Svg UiTools WebKit Xml) |
|
148 | 148 | if(PythonQt_Qt5) |
|
149 | 149 | LIST(APPEND QT Widgets WebKitWidgets) |
|
150 | 150 | endif() |
|
151 | 151 | |
|
152 | 152 | |
|
153 | add_library(${PythonQt_QtAll} SHARED ${SOURCES} ${GEN_MOC}) | |
|
153 | add_library(${PythonQt_QtAll} SHARED ${SOURCES} ${HEADERS} ${GEN_SOURCES} ${GEN_MOC}) | |
|
154 | 154 | qt_use_modules(${PythonQt_QtAll} ${QT}) |
|
155 | 155 | |
|
156 | 156 | target_link_libraries(${PythonQt_QtAll} ${PythonQt} ${PYTHON_LIBRARIES}) |
|
157 | 157 | |
|
158 | set_target_properties(${PythonQt_QtAll} PROPERTIES PUBLIC_HEADER "${HEADERS}") | |
|
159 | ||
|
158 | 160 | install(TARGETS ${PythonQt_QtAll} EXPORT ${PythonQt_QtAll}Targets COMPONENT QtAll |
|
159 | 161 | RUNTIME DESTINATION bin |
|
160 | 162 | LIBRARY DESTINATION lib |
|
161 |
ARCHIVE DESTINATION lib |
|
|
163 | ARCHIVE DESTINATION lib | |
|
164 | PUBLIC_HEADER DESTINATION include/PythonQt) | |
|
162 | 165 | |
|
163 | 166 | #----------------------------------------------------------------------------- |
|
164 | 167 | # Export CMake Config |
|
165 | 168 | |
|
166 | 169 | if(WIN32 AND NOT CYGWIN) |
|
167 | 170 | set(LIB_CMAKE_PATH "cmake") |
|
168 | 171 | else() |
|
169 | 172 | set(LIB_CMAKE_PATH "lib/cmake/${PythonQt_QtAll}") |
|
170 | 173 | endif() |
|
171 | 174 | |
|
172 | 175 | export(TARGETS ${PythonQt_QtAll} ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Targets.cmake") |
|
173 | 176 | export(PACKAGE ${PythonQt_QtAll}) |
|
174 | 177 | |
|
175 | 178 | # build tree |
|
176 | 179 | set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") |
|
177 | 180 | configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Config.cmake" @ONLY) |
|
178 | 181 | # install tree |
|
179 |
set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include |
|
|
182 | set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") | |
|
180 | 183 | configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake" @ONLY) |
|
181 | 184 | # both |
|
182 | 185 | configure_file(PythonQt_QtAllConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake" @ONLY) |
|
183 | 186 | |
|
184 | 187 | install(EXPORT ${PythonQt_QtAll}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev) |
|
185 | 188 | install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake |
|
186 | 189 | ${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake |
|
187 | 190 | DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev) |
|
188 | 191 |
@@ -1,21 +1,24 | |||
|
1 | 1 | # - Config file for the PythonQt package |
|
2 | 2 | # It defines the following variables |
|
3 | 3 | # PythonQt - the PythonQt core target (PythonQt PythonQt_3 PythonQt5 PythonQt5_3) |
|
4 | 4 | # PythonQt_QtAll - the PythonQt QtAll target |
|
5 | 5 | # PythonQt_QtAll_INCLUDE_DIRS - include directories for PythonQt |
|
6 | 6 | # PythonQt_QtAll_LIBRARIES - libraries to link against |
|
7 | # PythonQt_QtAll_QT - linked Qt modules | |
|
7 | 8 | |
|
8 | set(PythonQt @PythonQt@) | |
|
9 | 9 | set(PythonQt_QtAll @PythonQt_QtAll@) |
|
10 | set(PythonQt_QtAll_QT @QT@) | |
|
11 | ||
|
12 | find_package(@PythonQt@) | |
|
10 | 13 | |
|
11 | 14 | # Compute paths |
|
12 | 15 | get_filename_component(PYTHONQT_QTALL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) |
|
13 | 16 | set(PythonQt_QtAll_INCLUDE_DIRS "@INCLUDE_DIRS@") |
|
14 | 17 | |
|
15 | 18 | # Our library dependencies (contains definitions for IMPORTED targets) |
|
16 | 19 | if(NOT TARGET @PythonQt_QtAll@) |
|
17 | 20 | include("${PYTHONQT_QTALL_CMAKE_DIR}/@PythonQt_QtAll@Targets.cmake") |
|
18 | 21 | endif() |
|
19 | 22 | |
|
20 | 23 | # These are IMPORTED targets created by @PythonQt_QtAll@Targets.cmake |
|
21 | set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@) | |
|
24 | set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@ @PythonQt@) |
@@ -1,139 +1,137 | |||
|
1 | 1 | project(PythonQt_Core) |
|
2 | 2 | cmake_minimum_required(VERSION 2.8.10) |
|
3 | 3 | |
|
4 | 4 | #----------------------------------------------------------------------------- |
|
5 | 5 | # Sources |
|
6 | 6 | |
|
7 | 7 | set(SOURCES |
|
8 | 8 | PythonQtClassInfo.cpp |
|
9 | 9 | PythonQtClassWrapper.cpp |
|
10 | 10 | PythonQtConversion.cpp |
|
11 | 11 | PythonQt.cpp |
|
12 | 12 | PythonQtImporter.cpp |
|
13 | 13 | PythonQtInstanceWrapper.cpp |
|
14 | 14 | PythonQtMethodInfo.cpp |
|
15 | 15 | PythonQtMisc.cpp |
|
16 | 16 | PythonQtObjectPtr.cpp |
|
17 | 17 | PythonQtQFileImporter.cpp |
|
18 | 18 | PythonQtSignalReceiver.cpp |
|
19 | 19 | PythonQtSlot.cpp |
|
20 | 20 | PythonQtSignal.cpp |
|
21 | 21 | PythonQtStdDecorators.cpp |
|
22 | 22 | PythonQtStdIn.cpp |
|
23 | 23 | PythonQtStdOut.cpp |
|
24 | 24 | gui/PythonQtScriptingConsole.cpp |
|
25 | 25 | |
|
26 | 26 | ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.cpp |
|
27 | 27 | |
|
28 | 28 | ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp |
|
29 | 29 | ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin_init.cpp |
|
30 | 30 | ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.cpp |
|
31 | 31 | ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin_init.cpp |
|
32 | 32 | ) |
|
33 | 33 | |
|
34 | 34 | #----------------------------------------------------------------------------- |
|
35 | 35 | # List headers. This is list is used for the install command. |
|
36 | 36 | |
|
37 | 37 | set(HEADERS |
|
38 | 38 | PythonQtClassInfo.h |
|
39 | 39 | PythonQtClassWrapper.h |
|
40 | 40 | PythonQtConversion.h |
|
41 | 41 | PythonQtCppWrapperFactory.h |
|
42 | 42 | PythonQtDoc.h |
|
43 | 43 | PythonQt.h |
|
44 | 44 | PythonQtImporter.h |
|
45 | 45 | PythonQtImportFileInterface.h |
|
46 | 46 | PythonQtInstanceWrapper.h |
|
47 | 47 | PythonQtMethodInfo.h |
|
48 | 48 | PythonQtMisc.h |
|
49 | 49 | PythonQtObjectPtr.h |
|
50 | 50 | PythonQtQFileImporter.h |
|
51 | 51 | PythonQtSignalReceiver.h |
|
52 | 52 | PythonQtSlot.h |
|
53 | 53 | PythonQtSignal.h |
|
54 | 54 | PythonQtStdDecorators.h |
|
55 | 55 | PythonQtStdIn.h |
|
56 | 56 | PythonQtStdOut.h |
|
57 | 57 | PythonQtSystem.h |
|
58 | 58 | PythonQtVariants.h |
|
59 | 59 | PythonQtPythonInclude.h |
|
60 | 60 | ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.h |
|
61 | 61 | ) |
|
62 | 62 | |
|
63 | 63 | #----------------------------------------------------------------------------- |
|
64 | 64 | # Headers that should run through moc |
|
65 | 65 | |
|
66 | 66 | set(SOURCES_MOC |
|
67 | 67 | PythonQt.h |
|
68 | 68 | PythonQtSignalReceiver.h |
|
69 | 69 | PythonQtStdDecorators.h |
|
70 | 70 | gui/PythonQtScriptingConsole.h |
|
71 | 71 | |
|
72 | 72 | ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h |
|
73 | 73 | ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h |
|
74 | 74 | ) |
|
75 | 75 | |
|
76 | 76 | #----------------------------------------------------------------------------- |
|
77 | 77 | # Resources |
|
78 | 78 | set(SOURCES_QRC ) |
|
79 | 79 | |
|
80 | 80 | #----------------------------------------------------------------------------- |
|
81 | 81 | # Build the library |
|
82 | set(PythonQt ${PythonQt_LibraryName}${PythonQt_LibrarySuffix} CACHE INTERNAL "") | |
|
83 | ||
|
84 | 82 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
|
85 | 83 | |
|
86 | 84 | qt_wrap_cpp(GEN_MOC ${SOURCES_MOC}) |
|
87 | 85 | qt_add_resources(GEN_QRC ${SOURCES_QRC}) |
|
88 | 86 | |
|
89 | add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC}) | |
|
87 | add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC} ${HEADERS}) | |
|
90 | 88 | if(PythonQt_Qt5) |
|
91 | 89 | qt_use_modules(${PythonQt} Core Gui Widgets) |
|
92 | 90 | else() |
|
93 | 91 | qt_use_modules(${PythonQt} Core Gui) |
|
94 | 92 | endif() |
|
95 | 93 | target_link_libraries(${PythonQt} ${PYTHON_LIBRARIES}) |
|
96 | 94 | |
|
97 | 95 | # |
|
98 | 96 | # That should solve linkage error on Mac when the project is used in a superbuild setup |
|
99 | 97 | # See http://blog.onesadcookie.com/2008/01/installname-magic.html |
|
100 | 98 | # |
|
101 | 99 | set_target_properties(${PythonQt} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") |
|
102 | 100 | |
|
103 | 101 | #----------------------------------------------------------------------------- |
|
104 | 102 | # Install library (on windows, put the dll in 'bin' and the archive in 'lib') |
|
105 | 103 | |
|
106 | 104 | set_target_properties(${PythonQt} PROPERTIES PUBLIC_HEADER "${HEADERS}") |
|
107 | 105 | |
|
108 | 106 | install(TARGETS ${PythonQt} EXPORT ${PythonQt}Targets COMPONENT core-dev |
|
109 | 107 | RUNTIME DESTINATION bin COMPONENT core |
|
110 | 108 | LIBRARY DESTINATION lib COMPONENT core |
|
111 | 109 | ARCHIVE DESTINATION lib COMPONENT core |
|
112 | 110 | PUBLIC_HEADER DESTINATION include/PythonQt) |
|
113 | 111 | |
|
114 | 112 | #----------------------------------------------------------------------------- |
|
115 | 113 | # Export CMake Config |
|
116 | 114 | |
|
117 | 115 | if(WIN32 AND NOT CYGWIN) |
|
118 | 116 | set(LIB_CMAKE_PATH "cmake") |
|
119 | 117 | else() |
|
120 | 118 | set(LIB_CMAKE_PATH "lib/cmake/${PythonQt}") |
|
121 | 119 | endif() |
|
122 | 120 | |
|
123 | 121 | export(TARGETS ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt}Targets.cmake") |
|
124 | 122 | export(PACKAGE ${PythonQt}) |
|
125 | 123 | |
|
126 | 124 | # build tree |
|
127 | 125 | set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") |
|
128 | 126 | configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}Config.cmake" @ONLY) |
|
129 | 127 | # install tree |
|
130 |
set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include |
|
|
128 | set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") | |
|
131 | 129 | configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake" @ONLY) |
|
132 | 130 | # both |
|
133 | 131 | configure_file(PythonQtConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake" @ONLY) |
|
134 | 132 | |
|
135 | 133 | install(EXPORT ${PythonQt}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev) |
|
136 | 134 | install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake |
|
137 | 135 | ${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake |
|
138 | 136 | DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev) |
|
139 | 137 |
General Comments 0
You need to be logged in to leave comments.
Login now