##// END OF EJS Templates
added additional file...
florianlink -
r182:99f055158134
parent child
Show More
@@ -1,232 +1,233
1 1 cmake_minimum_required(VERSION 2.8)
2 2
3 3 #-----------------------------------------------------------------------------
4 4 # See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
5 5 #
6 6
7 7 SET(project_policies
8 8 CMP0001 # NEW: CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
9 9 CMP0002 # NEW: Logical target names must be globally unique.
10 10 CMP0003 # NEW: Libraries linked via full path no longer produce linker search paths.
11 11 CMP0004 # NEW: Libraries linked may NOT have leading or trailing whitespace.
12 12 CMP0005 # NEW: Preprocessor definition values are now escaped automatically.
13 13 CMP0006 # NEW: Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
14 14 CMP0007 # NEW: List command no longer ignores empty elements.
15 15 CMP0008 # NEW: Libraries linked by full-path must have a valid library file name.
16 16 CMP0009 # NEW: FILE GLOB_RECURSE calls should not follow symlinks by default.
17 17 CMP0010 # NEW: Bad variable reference syntax is an error.
18 18 CMP0011 # NEW: Included scripts do automatic cmake_policy PUSH and POP.
19 19 CMP0012 # NEW: if() recognizes numbers and boolean constants.
20 20 CMP0013 # NEW: Duplicate binary directories are not allowed.
21 21 CMP0014 # NEW: Input directories must have CMakeLists.txt
22 22 )
23 23 FOREACH(policy ${project_policies})
24 24 IF(POLICY ${policy})
25 25 CMAKE_POLICY(SET ${policy} NEW)
26 26 ENDIF()
27 27 ENDFOREACH()
28 28
29 29 #-----------------------------------------------------------------------------
30 30 project(PythonQt)
31 31 #-----------------------------------------------------------------------------
32 32
33 33 #-----------------------------------------------------------------------------
34 34 # Python libraries
35 35
36 36 find_package(PythonLibs REQUIRED)
37 37 include_directories("${PYTHON_INCLUDE_DIR}")
38 38 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
39 39
40 40 #-----------------------------------------------------------------------------
41 41 # Build options
42 42
43 43 foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
44 44 OPTION(PythonQt_Wrap_Qt${qtlib} "Make all of Qt${qtlib} available in python" OFF)
45 45 endforeach()
46 46
47 47 option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF)
48 48 if(PythonQt_DEBUG)
49 49 add_definitions(-DPYTHONQT_DEBUG)
50 50 else()
51 51 remove_definitions(-DPYTHONQT_DEBUG)
52 52 endif()
53 53
54 54 #-----------------------------------------------------------------------------
55 55 # Setup Qt
56 56
57 57 set(minimum_required_qt_version "4.6.2")
58 58
59 59 find_package(Qt4)
60 60
61 61 if(QT4_FOUND)
62 62
63 63 set(found_qt_version ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})
64 64
65 65 if(${found_qt_version} VERSION_LESS ${minimum_required_qt_version})
66 66 message(FATAL_ERROR "error: PythonQt requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${found_qt_version}.")
67 67 endif()
68 68
69 69 # Enable required qt module
70 70 foreach(qtlib network opengl sql svg uitools webkit xml xmlpatterns)
71 71 string(TOUPPER ${qtlib} qtlib_uppercase)
72 72 if (NOT ${QT_QT${qtlib_uppercase}_FOUND})
73 73 message(FATAL_ERROR "QT_QT${${qtlib_uppercase} *not* FOUND - Try to disable PythonQt_Wrap_Qt${qtlib}")
74 74 endif()
75 75 set(QT_USE_QT${qtlib_uppercase} ${PythonQt_Wrap_Qt${qtlib}})
76 76 endforeach()
77 77
78 78 include(${QT_USE_FILE})
79 79 else()
80 80 message(FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable")
81 81 endif()
82 82
83 83 #-----------------------------------------------------------------------------
84 84 # Sources
85 85
86 86 set(sources
87 87 src/PythonQtClassInfo.cpp
88 88 src/PythonQtClassWrapper.cpp
89 89 src/PythonQtConversion.cpp
90 90 src/PythonQt.cpp
91 91 src/PythonQtImporter.cpp
92 92 src/PythonQtInstanceWrapper.cpp
93 93 src/PythonQtMethodInfo.cpp
94 94 src/PythonQtMisc.cpp
95 95 src/PythonQtObjectPtr.cpp
96 96 src/PythonQtQFileImporter.cpp
97 97 src/PythonQtSignalReceiver.cpp
98 98 src/PythonQtSlot.cpp
99 99 src/PythonQtSignal.cpp
100 100 src/PythonQtStdDecorators.cpp
101 101 src/PythonQtStdIn.cpp
102 102 src/PythonQtStdOut.cpp
103 103 src/gui/PythonQtScriptingConsole.cpp
104 104
105 105 generated_cpp/PythonQt_QtBindings.cpp
106 106
107 107 generated_cpp/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp
108 108 generated_cpp/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin_init.cpp
109 109 generated_cpp/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.cpp
110 110 generated_cpp/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin_init.cpp
111 111 )
112 112
113 113 #-----------------------------------------------------------------------------
114 114 # List headers. This is list is used for the install command.
115 115
116 116 set(headers
117 117 src/PythonQtClassInfo.h
118 118 src/PythonQtClassWrapper.h
119 119 src/PythonQtConversion.h
120 120 src/PythonQtCppWrapperFactory.h
121 121 src/PythonQtDoc.h
122 122 src/PythonQt.h
123 123 src/PythonQtImporter.h
124 124 src/PythonQtImportFileInterface.h
125 125 src/PythonQtInstanceWrapper.h
126 126 src/PythonQtMethodInfo.h
127 127 src/PythonQtMisc.h
128 128 src/PythonQtObjectPtr.h
129 129 src/PythonQtQFileImporter.h
130 130 src/PythonQtSignalReceiver.h
131 131 src/PythonQtSlot.h
132 src/PythonQtSignal.h
132 133 src/PythonQtStdDecorators.h
133 134 src/PythonQtStdIn.h
134 135 src/PythonQtStdOut.h
135 136 src/PythonQtSystem.h
136 137 src/PythonQtVariants.h
137 138 src/PythonQtPythonInclude.h
138 139 generated_cpp/PythonQt_QtBindings.h
139 140 )
140 141
141 142 #-----------------------------------------------------------------------------
142 143 # Headers that should run through moc
143 144
144 145 set(moc_sources
145 146 src/PythonQt.h
146 147 src/PythonQtSignalReceiver.h
147 148 src/PythonQtStdDecorators.h
148 149 src/gui/PythonQtScriptingConsole.h
149 150
150 151 generated_cpp/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h
151 152 generated_cpp/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h
152 153 )
153 154
154 155 #-----------------------------------------------------------------------------
155 156 # Add extra sources
156 157 foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
157 158
158 159 if (${PythonQt_Wrap_Qt${qtlib}})
159 160
160 161 ADD_DEFINITIONS(-DPYTHONQT_WRAP_Qt${qtlib})
161 162
162 163 set(file_prefix generated_cpp/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib})
163 164
164 165 foreach(index RANGE 0 10)
165 166
166 167 # Source files
167 168 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.cpp)
168 169 list(APPEND sources ${file_prefix}${index}.cpp)
169 170 endif()
170 171
171 172 # Headers that should run through moc
172 173 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.h)
173 174 list(APPEND moc_sources ${file_prefix}${index}.h)
174 175 endif()
175 176
176 177 endforeach()
177 178
178 179 list(APPEND sources ${file_prefix}_init.cpp)
179 180
180 181 endif()
181 182 endforeach()
182 183
183 184 #-----------------------------------------------------------------------------
184 185 # UI files
185 186 set(ui_sources )
186 187
187 188 #-----------------------------------------------------------------------------
188 189 # Resources
189 190 set(qrc_sources )
190 191
191 192 #-----------------------------------------------------------------------------
192 193 # Do wrapping
193 194 qt4_wrap_cpp(gen_moc_sources ${moc_sources})
194 195 qt4_wrap_ui(gen_ui_sources ${ui_sources})
195 196 qt4_add_resources(gen_qrc_sources ${qrc_sources})
196 197
197 198 #-----------------------------------------------------------------------------
198 199 # Build the library
199 200
200 201 include_directories(
201 202 ${CMAKE_CURRENT_SOURCE_DIR}/src
202 203 )
203 204
204 205 add_library(PythonQt SHARED
205 206 ${sources}
206 207 ${gen_moc_sources}
207 208 ${gen_ui_sources}
208 209 ${gen_qrc_sources}
209 210 )
210 211 set_target_properties(PythonQt PROPERTIES DEFINE_SYMBOL PYTHONQT_EXPORTS)
211 212
212 213 #
213 214 # That should solve linkage error on Mac when the project is used in a superbuild setup
214 215 # See http://blog.onesadcookie.com/2008/01/installname-magic.html
215 216 #
216 217 set_target_properties(PythonQt PROPERTIES
217 218 INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
218 219 )
219 220
220 221 target_link_libraries(PythonQt
221 222 ${PYTHON_LIBRARY}
222 223 ${QT_LIBRARIES}
223 224 )
224 225
225 226 #-----------------------------------------------------------------------------
226 227 # Install library (on windows, put the dll in 'bin' and the archive in 'lib')
227 228
228 229 install(TARGETS PythonQt
229 230 RUNTIME DESTINATION bin
230 231 LIBRARY DESTINATION lib
231 232 ARCHIVE DESTINATION lib)
232 233 install(FILES ${headers} DESTINATION include/PythonQt)
General Comments 0
You need to be logged in to leave comments. Login now