##// END OF EJS Templates
More PythonQt*Config.cmake fixes
Orochimarufan -
r213:89db53e7cd3e
parent child
Show More
@@ -1,180 +1,184
1 1 project(PythonQt)
2 2 cmake_minimum_required(VERSION 2.8.10)
3 3
4 IF(POLICY CMP0020)
5 cmake_policy(SET CMP0020 NEW)
6 ENDIF()
7
4 8 include(CTestUseLaunchers OPTIONAL)
5 9
6 10 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
7 11
8 12 #-----------------------------------------------------------------------------
9 13 # Debug
10 14 SET(PythonQt_VERSION 2.2.0)
11 15
12 16 #-----------------------------------------------------------------------------
13 17 # Debug
14 18 option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF)
15 19 if(PythonQt_DEBUG)
16 20 add_definitions(-DPYTHONQT_DEBUG)
17 21 else()
18 22 remove_definitions(-DPYTHONQT_DEBUG)
19 23 endif()
20 24
21 25 if(NOT CMAKE_BUILD_TYPE)
22 26 set(CMAKE_BUILD_TYPE Release)
23 27 endif()
24 28
25 29 #-----------------------------------------------------------------------------
26 30 # Qt
27 31 option(PythonQt_Qt5 "Use Qt 5.x" OFF)
28 32 if(PythonQt_Qt5)
29 33 include(PythonQt_Qt_5x)
30 34 else(PythonQt_Qt5)
31 35 include(PythonQt_Qt_4x)
32 36 endif(PythonQt_Qt5)
33 37
34 38 #-----------------------------------------------------------------------------
35 39 # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers
36 40 # associated with the Qt version being used.
37 41 set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}")
38 42
39 43 if("${generated_cpp_suffix}" STREQUAL "_48")
40 44 set(generated_cpp_suffix "")
41 45 endif()
42 46 if("${generated_cpp_suffix}" STREQUAL "_46")
43 47 set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version
44 48 endif()
45 49 if("${generated_cpp_suffix}" STREQUAL "_51")
46 50 set(generated_cpp_suffix "_50")
47 51 endif()
48 52
49 53 #-----------------------------------------------------------------------------
50 54 # Generator
51 55 if(PythonQt_Qt5)
52 56 add_subdirectory(generator_50 EXCLUDE_FROM_ALL)
53 57 add_custom_target(generator)
54 58 add_dependencies(generator pythonqt_generator)
55 59 endif()
56 60
57 61 # TODO
58 62
59 63 #-----------------------------------------------------------------------------
60 64 # Build options
61 65
62 66 #option(PythonQt_Wrap_QtAll "Make all Qt components available in python" OFF)
63 67 #
64 68 #set(qtlibs core gui network opengl sql svg uitools webkit xml xmlpatterns)
65 69 #foreach(qtlib ${qtlibs})
66 70 # OPTION(PythonQt_Wrap_Qt${qtlib} "Make all of Qt${qtlib} available in python" OFF)
67 71 #endforeach()
68 72
69 73 # Force option if it applies
70 74 #if(PythonQt_Wrap_QtAll)
71 75 # list(REMOVE_ITEM qtlibs xmlpatterns) # xmlpatterns wrapper does *NOT* build at all :(
72 76 # foreach(qtlib ${qtlibs})
73 77 # if(NOT ${PythonQt_Wrap_Qt${qtlib}})
74 78 # set(PythonQt_Wrap_Qt${qtlib} ON CACHE BOOL "Make all of Qt${qtlib} available in python" FORCE)
75 79 # message(STATUS "Enabling [PythonQt_Wrap_Qt${qtlib}] because of [PythonQt_Wrap_QtAll] evaluates to True")
76 80 # endif()
77 81 # endforeach()
78 82 #endif()
79 83
80 84 #-----------------------------------------------------------------------------
81 85 # Add extra sources
82 86 #foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
83 87 #
84 88 # if (${PythonQt_Wrap_Qt${qtlib}})
85 89 #
86 90 # ADD_DEFINITIONS(-DPYTHONQT_WRAP_Qt${qtlib})
87 91 #
88 92 # set(file_prefix generated_cpp${generated_cpp_suffix}/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib})
89 93 #
90 94 # foreach(index RANGE 0 11)
91 95 #
92 96 # # Source files
93 97 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.cpp)
94 98 # list(APPEND sources ${file_prefix}${index}.cpp)
95 99 # endif()
96 100 #
97 101 # # Headers that should run through moc
98 102 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.h)
99 103 # list(APPEND moc_sources ${file_prefix}${index}.h)
100 104 # endif()
101 105 #
102 106 # endforeach()
103 107 #
104 108 # list(APPEND sources ${file_prefix}_init.cpp)
105 109 #
106 110 # endif()
107 111 #endforeach()
108 112
109 113 #-----------------------------------------------------------------------------
110 114 # Find Python
111 115 option(PythonQt_Python3 "Use Python 3.x (3.3+)" OFF)
112 116 option(PythonQt_Python "Use specific Python Version" OFF)
113 117 if(PythonQt_Python)
114 118 find_package(Python ${PythonQt_Python} REQUIRED EXACT)
115 119 elseif(PythonQt_Python3)
116 120 find_package(Python 3.3 REQUIRED)
117 121 else()
118 122 find_package(Python 2.6 REQUIRED)
119 123 endif()
120 124
121 125 if(NOT ${PYTHON_VERSION} VERSION_LESS 3)
122 126 set(PythonQt_Python3 ON)
123 127 else()
124 128 set(PythonQt_Python3 OFF)
125 129 endif()
126 130
127 131 include_directories(${PYTHON_INCLUDE_DIRS})
128 132 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
129 133
130 134 #-----------------------------------------------------------------------------
131 135 # Library Name
132 136 # The variable PythonQt contains the PythonQt core library name
133 137 # It incorporates library mayor versions
134 138 set(PythonQt PythonQt)
135 139
136 140 if(PythonQt_Qt5)
137 141 set(PythonQt ${PythonQt}5)
138 142 endif()
139 143
140 144 if(PythonQt_Python3)
141 145 set(PythonQt ${PythonQt}_3)
142 146 endif()
143 147
144 148 set(CMAKE_DEBUG_POSTFIX "_d")
145 149
146 150 message(STATUS "Building ${PythonQt} (Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} + Python ${PYTHON_VERSION} | ${CMAKE_BUILD_TYPE})")
147 151
148 152 #-----------------------------------------------------------------------------
149 153 # Core
150 154 add_subdirectory(src)
151 155
152 156 #-----------------------------------------------------------------------------
153 157 # Tests
154 158 add_subdirectory(tests EXCLUDE_FROM_ALL)
155 159 # test alias
156 160 add_custom_target(test COMMAND tests/PythonQtTest WORKING_DIRECTORY ${CURRENT_BINARY_DIR})
157 161 add_dependencies(test PythonQtTest)
158 162
159 163 #-----------------------------------------------------------------------------
160 164 # Extenseions (QtAll)
161 165 add_subdirectory(extensions)
162 166 # QtAll alias
163 167 add_custom_target(QtAll)
164 168 add_dependencies(QtAll ${PythonQt_QtAll})
165 169
166 170 #-----------------------------------------------------------------------------
167 171 # Examples
168 172 include_directories(src)
169 173 include_directories(extensions/PythonQt_QtAll)
170 174 add_subdirectory(examples EXCLUDE_FROM_ALL)
171 175
172 176 #-----------------------------------------------------------------------------
173 177 # uninstall target
174 178 configure_file(
175 179 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
176 180 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
177 181 IMMEDIATE @ONLY)
178 182
179 183 add_custom_target(uninstall
180 184 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
@@ -1,183 +1,189
1 1 # - Find python
2 2 # This module searches for both the python interpreter and the python libraries
3 3 # and determines where they are located
4 4 #
5 5 #
6 6 # PYTHON_FOUND - The requested Python components were found
7 7 # PYTHON_EXECUTABLE - path to the Python interpreter
8 8 # PYTHON_INCLUDE_DIRS - path to the Python header files
9 9 # PYTHON_LIBRARIES - the libraries to link against for python
10 10 # PYTHON_VERSION - the python version
11 11 #
12 12
13 13 #=============================================================================
14 14 # Copyright 2010 Branan Purvine-Riley
15 15 # 2013 Orochimarufan
16 16 #
17 17 # Redistribution and use in source and binary forms, with or without
18 18 # modification, are permitted provided that the following conditions
19 19 # are met:
20 20 #
21 21 # * Redistributions of source code must retain the above copyright
22 22 # notice, this list of conditions and the following disclaimer.
23 23 #
24 24 # * Redistributions in binary form must reproduce the above copyright
25 25 # notice, this list of conditions and the following disclaimer in the
26 26 # documentation and/or other materials provided with the distribution.
27 27 #
28 28 # * Neither the names of Kitware, Inc., the Insight Software Consortium,
29 29 # nor the names of their contributors may be used to endorse or promote
30 30 # products derived from this software without specific prior written
31 31 # permission.
32 32 #
33 33 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
34 34 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
35 35 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
36 36 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
37 37 # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
38 38 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
39 39 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
40 40 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
41 41 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42 42 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
43 43 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44 44 #=============================================================================
45 45
46 46 IF("3" STREQUAL "${Python_FIND_VERSION_MAJOR}")
47 47 SET(PYTHON_3_OK "TRUE")
48 48 SET(PYTHON_2_OK "FALSE") # redundant in version selection code, but skips a FOREACH
49 49 ELSE("3" STREQUAL "${Python_FIND_VERSION_MAJOR}")
50 50 SET(PYTHON_2_OK "TRUE")
51 51 # don't set PYTHON_3_OK to false here - if the user specified it we want to search for Python 2 & 3
52 52 ENDIF("3" STREQUAL "${Python_FIND_VERSION_MAJOR}")
53 53
54 54 # This is heavily inspired by FindBoost.cmake, with the addition of a second version list to keep
55 55 # python 2 and python 3 separate
56 56 IF(Python_FIND_VERSION_EXACT)
57 57 SET(_PYTHON_TEST_VERSIONS "${Python_FIND_VERSION_MAJOR}.${Python_FIND_VERSION_MINOR}")
58 58 ELSE(Python_FIND_VERSION_EXACT)
59 59 # Version lists
60 60 SET(_PYTHON_3_KNOWN_VERSIONS ${PYTHON_3_ADDITIONAL_VERSIONS}
61 61 "3.3" "3.2" "3.1" "3.0")
62 62 SET(_PYTHON_2_KNOWN_VERSIONS ${PYTHON_2_ADDITIONAL_VERSIONS}
63 63 "2.7" "2.6" "2.5" "2.4" "2.3" "2.2" "2.1" "2.0" "1.6" "1.5")
64 64 SET(_PYTHON_2_TEST_VERSIONS)
65 65 SET(_PYTHON_3_TEST_VERSIONS)
66 66 SET(_PYTHON_TEST_VERSIONS)
67 67 IF(Python_FIND_VERSION)
68 68 # python 3 versions
69 69 IF(PYTHON_3_OK)
70 70 FOREACH(version ${_PYTHON_3_KNOWN_VERSIONS})
71 71 IF(NOT ${version} VERSION_LESS ${Python_FIND_VERSION})
72 72 LIST(APPEND _PYTHON_3_TEST_VERSIONS ${version})
73 73 ENDIF(NOT ${version} VERSION_LESS ${Python_FIND_VERSION})
74 74 ENDFOREACH(version)
75 75 ENDIF(PYTHON_3_OK)
76 76 # python 2 versions
77 77 IF(PYTHON_2_OK)
78 78 FOREACH(version ${_PYTHON_2_KNOWN_VERSIONS})
79 79 IF(NOT ${version} VERSION_LESS ${Python_FIND_VERSION})
80 80 LIST(APPEND _PYTHON_2_TEST_VERSIONS ${version})
81 81 ENDIF(NOT ${version} VERSION_LESS ${Python_FIND_VERSION})
82 82 ENDFOREACH(version)
83 83 ENDIF(PYTHON_2_OK)
84 84 # all versions
85 85 ELSE(Python_FIND_VERSION)
86 86 IF(PYTHON_3_OK)
87 87 LIST(APPEND _PYTHON_3_TEST_VERSIONS ${_PYTHON_3_KNOWN_VERSIONS})
88 88 ENDIF(PYTHON_3_OK)
89 89 IF(PYTHON_2_OK)
90 90 LIST(APPEND _PYTHON_2_TEST_VERSIONS ${_PYTHON_2_KNOWN_VERSIONS})
91 91 ENDIF(PYTHON_2_OK)
92 92 ENDIF(Python_FIND_VERSION)
93 93 # fix python3 version flags
94 94 IF(PYTHON_3_OK)
95 95 FOREACH(version ${_PYTHON_3_TEST_VERSIONS})
96 96 IF(${version} VERSION_GREATER 3.1)
97 97 LIST(APPEND _PYTHON_TEST_VERSIONS "${version}mu" "${version}m" "${version}u" "${version}")
98 98 ELSE(${version} VERSION_GREATER 3.1)
99 99 LIST(APPEND _PYTHON_TEST_VERSIONS ${version})
100 100 ENDIF(${version} VERSION_GREATER 3.1)
101 101 ENDFOREACH(version)
102 102 ENDIF(PYTHON_3_OK)
103 103 IF(PYTHON_2_OK)
104 104 LIST(APPEND _PYTHON_TEST_VERSIONS ${_PYTHON_2_TEST_VERSIONS})
105 105 ENDIF(PYTHON_2_OK)
106 106 ENDIF(Python_FIND_VERSION_EXACT)
107 107
108 108 SET(_PYTHON_EXE_VERSIONS)
109 109 FOREACH(version ${_PYTHON_TEST_VERSIONS})
110 110 LIST(APPEND _PYTHON_EXE_VERSIONS python${version})
111 111 ENDFOREACH(version ${_PYTHON_TEST_VERSIONS})
112 112
113 113 IF(WIN32)
114 114 SET(_PYTHON_REGISTRY_KEYS)
115 115 FOREACH(version ${_PYTHON_TEST_VERSIONS})
116 116 LIST(APPEND _PYTHON_REGISTRY_KEYS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${version}\\InstallPath])
117 117 ENDFOREACH(version ${_PYTHON_TEST_VERSIONS})
118 118 # this will find any standard windows Python install before it finds anything from Cygwin
119 119 FIND_PROGRAM(PYTHON_EXECUTABLE NAMES python ${_PYTHON_EXE_VERSIONS} PATHS ${_PYTHON_REGISTRY_KEYS})
120 120 ELSE(WIN32)
121 121 FIND_PROGRAM(PYTHON_EXECUTABLE NAMES ${_PYTHON_EXE_VERSIONS} PATHS)
122 122 ENDIF(WIN32)
123 123
124 124 EXECUTE_PROCESS(COMMAND "${PYTHON_EXECUTABLE}" "-c" "from sys import *; stdout.write('%i.%i.%i' % version_info[:3])" OUTPUT_VARIABLE PYTHON_VERSION)
125 125
126 126 # Get our library path and include directory from python
127 127 IF(${PYTHON_VERSION} VERSION_GREATER 3.1)
128 128 SET(_PYTHON_SYSCONFIG "sysconfig")
129 129 SET(_PYTHON_SC_INCLUDE "sysconfig.get_path('include')")
130 130 ELSE()
131 131 SET(_PYTHON_SYSCONFIG "distutils.sysconfig")
132 132 SET(_PYTHON_SC_INCLUDE "distutils.sysconfig.get_python_inc()")
133 133 ENDIF()
134 134
135 EXECUTE_PROCESS(
136 COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LIBDIR'))"
137 OUTPUT_VARIABLE _PYTHON_LIBRARY_PATH
138 )
139 135 IF(WIN32)
140 136 EXECUTE_PROCESS(
141 COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LIBRARY'))"
142 OUTPUT_VARIABLE _PYTHON_LIBRARY_NAME
137 COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('prefix'))"
138 OUTPUT_VARIABLE _PYTHON_PREFIX
139 )
140 EXECUTE_PROCESS(
141 COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('py_version_nodot'))"
142 OUTPUT_VARIABLE _PYTHON_VERSION_MAJOR
143 143 )
144 SET(_PYTHON_LIBRARY_PATH ${_PYTHON_PREFIX}/libs)
145 SET(_PYTHON_LIBRARY_NAME libpython${_PYTHON_VERSION_MAJOR}.a)
144 146 ELSE(WIN32)
145 147 EXECUTE_PROCESS(
148 COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LIBDIR'))"
149 OUTPUT_VARIABLE _PYTHON_LIBRARY_PATH
150 )
151 EXECUTE_PROCESS(
146 152 COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_var('LDLIBRARY'))"
147 153 OUTPUT_VARIABLE _PYTHON_LIBRARY_NAME
148 154 )
149 155 # Multiarch
150 156 EXECUTE_PROCESS(
151 157 COMMAND "${PYTHON_EXECUTABLE}" -c "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SYSCONFIG}.get_config_vars().get('MULTIARCH', 'PYTHON_LIBRARY_MULTIARCH-NOTFOUND'))"
152 158 OUTPUT_VARIABLE _PYTHON_LIBRARY_MULTIARCH
153 159 )
154 160 IF(NOT "${_PYTHON_LIBRARY_MULTIARCH}" STREQUAL "PYTHON_LIBRARY_MULTIARCH-NOTFOUND")
155 161 SET(_PYTHON_LIBRARY_PATH_X ${_PYTHON_LIBRARY_PATH})
156 162 SET(_PYTHON_LIBRARY_PATH)
157 163 FOREACH(path ${_PYTHON_LIBRARY_PATH_X})
158 164 LIST(APPEND _PYTHON_LIBRARY_PATH "${path}/${_PYTHON_LIBRARY_MULTIARCH}" "${path}")
159 165 ENDFOREACH(path)
160 166 ENDIF(NOT "${_PYTHON_LIBRARY_MULTIARCH}" STREQUAL "PYTHON_LIBRARY_MULTIARCH-NOTFOUND")
161 167 ENDIF(WIN32)
162 168 EXECUTE_PROCESS(COMMAND "${PYTHON_EXECUTABLE}"
163 169 "-c" "import ${_PYTHON_SYSCONFIG}; import sys; sys.stdout.write(${_PYTHON_SC_INCLUDE})"
164 170 OUTPUT_VARIABLE PYTHON_INCLUDE_DIR
165 171 )
166 172
167 173 FIND_FILE(PYTHON_LIBRARY ${_PYTHON_LIBRARY_NAME} PATHS ${_PYTHON_LIBRARY_PATH} NO_DEFAULT_PATH)
168 174 FIND_FILE(PYTHON_HEADER "Python.h" PATHS ${PYTHON_INCLUDE_DIR} NO_DEFAULT_PATH)
169 175
170 176 set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
171 177 set(PYTHON_LIBRARIES ${PYTHON_LIBRARY})
172 178
173 179 INCLUDE(FindPackageHandleStandardArgs)
174 180 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Python
175 181 REQUIRED_VARS PYTHON_EXECUTABLE PYTHON_HEADER PYTHON_LIBRARY
176 182 VERSION_VAR PYTHON_VERSION
177 183 )
178 184
179 185 MARK_AS_ADVANCED(PYTHON_EXECUTABLE)
180 186 MARK_AS_ADVANCED(PYTHON_INCLUDE_DIRS)
181 187 MARK_AS_ADVANCED(PYTHON_LIBRARIES)
182 188 MARK_AS_ADVANCED(PYTHON_VERSION)
183 189
@@ -1,191 +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 15 SET(GEN_HEADERS)
16 16 SET(GEN_SOURCES)
17 17
18 18 foreach(MODULE core gui network opengl sql svg uitools webkit xml)
19 19 SET(MODULE_TROLL com_trolltech_qt_${MODULE})
20 20 SET(MODULE_BASE ${GEN}/${MODULE_TROLL}/${MODULE_TROLL})
21 21 FILE(GLOB HFILES ${MODULE_BASE}*.h)
22 22 FILE(GLOB CFILES ${MODULE_BASE}*.cpp)
23 23 LIST(APPEND GEN_HEADERS ${HFILES})
24 24 LIST(APPEND GEN_SOURCES ${CFILES})
25 25 endforeach()
26 26
27 27 ## Core
28 28 #LIST(APPEND HEADERS
29 29 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.h
30 30 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.h
31 31 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.h
32 32 #)
33 33
34 34 #LIST(APPEND SOURCES
35 35 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.cpp
36 36 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.cpp
37 37 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.cpp
38 38 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp
39 39 #)
40 40
41 41 ## Gui
42 42 #LIST(APPEND HEADERS
43 43 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.h
44 44 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.h
45 45 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.h
46 46 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.h
47 47 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.h
48 48 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.h
49 49 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.h
50 50 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
51 51 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.h
52 52 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.h
53 53 #)
54 54
55 55 #LIST(APPEND SOURCES
56 56 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.cpp
57 57 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.cpp
58 58 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.cpp
59 59 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.cpp
60 60 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.cpp
61 61 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.cpp
62 62 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.cpp
63 63 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
64 64 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.cpp
65 65 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.cpp
66 66 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui_init.cpp
67 67 #)
68 68
69 69 ## Network
70 70 #LIST(APPEND HEADERS
71 71 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.h
72 72 #)
73 73
74 74 #LIST(APPEND SOURCES
75 75 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.cpp
76 76 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp
77 77 #)
78 78
79 79 ## OpenGL
80 80 #LIST(APPEND HEADERS
81 81 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.h
82 82 #)
83 83
84 84 #LIST(APPEND SOURCES
85 85 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.cpp
86 86 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl_init.cpp
87 87 #)
88 88
89 89 ## Sql
90 90 #LIST(APPEND HEADERS
91 91 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.h
92 92 #)
93 93
94 94 #LIST(APPEND SOURCES
95 95 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.cpp
96 96 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql_init.cpp
97 97 #)
98 98
99 99 ## Svg
100 100 #LIST(APPEND HEADERS
101 101 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.h
102 102 #)
103 103
104 104 #LIST(APPEND SOURCES
105 105 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.cpp
106 106 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg_init.cpp
107 107 #)
108 108
109 109 ## uitools
110 110 #LIST(APPEND HEADERS
111 111 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h
112 112 #)
113 113
114 114 #LIST(APPEND SOURCES
115 115 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp
116 116 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp
117 117 #)
118 118
119 119 ## WebKit
120 120 #LIST(APPEND HEADERS
121 121 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.h
122 122 #)
123 123
124 124 #LIST(APPEND SOURCES
125 125 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.cpp
126 126 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit_init.cpp
127 127 #)
128 128
129 129 ## Xml
130 130 #LIST(APPEND HEADERS
131 131 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.h
132 132 #)
133 133
134 134 #LIST(APPEND SOURCES
135 135 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.cpp
136 136 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml_init.cpp
137 137 #)
138 138
139 139 #-------------------------------------------------------------------
140 140 # Build
141 141 set(PythonQt_QtAll ${PythonQt}_QtAll CACHE INTERNAL "")
142 142
143 143 include_directories(../../src)
144 144 add_definitions(-DPYTHONQT_QTALL_EXPORTS)
145 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 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 158 set_target_properties(${PythonQt_QtAll} PROPERTIES PUBLIC_HEADER "${HEADERS}")
159 159
160 160 install(TARGETS ${PythonQt_QtAll} EXPORT ${PythonQt_QtAll}Targets COMPONENT QtAll
161 161 RUNTIME DESTINATION bin
162 162 LIBRARY DESTINATION lib
163 163 ARCHIVE DESTINATION lib
164 164 PUBLIC_HEADER DESTINATION include/PythonQt)
165 165
166 166 #-----------------------------------------------------------------------------
167 167 # Export CMake Config
168 168
169 169 if(WIN32 AND NOT CYGWIN)
170 170 set(LIB_CMAKE_PATH "cmake")
171 171 else()
172 172 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt_QtAll}")
173 173 endif()
174 174
175 175 export(TARGETS ${PythonQt_QtAll} ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Targets.cmake")
176 176 export(PACKAGE ${PythonQt_QtAll})
177 177
178 178 # build tree
179 179 set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
180 180 configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Config.cmake" @ONLY)
181 181 # install tree
182 set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
182 set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/PythonQt")
183 183 configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake" @ONLY)
184 184 # both
185 185 configure_file(PythonQt_QtAllConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake" @ONLY)
186 186
187 187 install(EXPORT ${PythonQt_QtAll}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev)
188 188 install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake
189 189 ${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake
190 190 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev)
191 191
@@ -1,24 +1,23
1 1 # - Config file for the PythonQt package
2 2 # It defines the following variables
3 # PythonQt - the PythonQt core target (PythonQt PythonQt_3 PythonQt5 PythonQt5_3)
4 3 # PythonQt_QtAll - the PythonQt QtAll target
5 4 # PythonQt_QtAll_INCLUDE_DIRS - include directories for PythonQt
6 5 # PythonQt_QtAll_LIBRARIES - libraries to link against
7 6 # PythonQt_QtAll_QT - linked Qt modules
8 7
9 8 set(PythonQt_QtAll @PythonQt_QtAll@)
10 9 set(PythonQt_QtAll_QT @QT@)
11 10
12 find_package(@PythonQt@)
13
14 11 # Compute paths
15 12 get_filename_component(PYTHONQT_QTALL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
16 13 set(PythonQt_QtAll_INCLUDE_DIRS "@INCLUDE_DIRS@")
17 14
18 15 # Our library dependencies (contains definitions for IMPORTED targets)
19 16 if(NOT TARGET @PythonQt_QtAll@)
20 17 include("${PYTHONQT_QTALL_CMAKE_DIR}/@PythonQt_QtAll@Targets.cmake")
21 18 endif()
22 19
20 find_package(@PythonQt@)
21
23 22 # These are IMPORTED targets created by @PythonQt_QtAll@Targets.cmake
24 set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@ @PythonQt@)
23 set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@)
@@ -1,137 +1,137
1 1 project(PythonQt_Core)
2 cmake_minimum_required(VERSION 2.8.10)
3 2
4 3 #-----------------------------------------------------------------------------
5 4 # Sources
6 5
7 6 set(SOURCES
8 7 PythonQtClassInfo.cpp
9 8 PythonQtClassWrapper.cpp
10 9 PythonQtConversion.cpp
11 10 PythonQt.cpp
12 11 PythonQtImporter.cpp
13 12 PythonQtInstanceWrapper.cpp
14 13 PythonQtMethodInfo.cpp
15 14 PythonQtMisc.cpp
16 15 PythonQtObjectPtr.cpp
17 16 PythonQtQFileImporter.cpp
18 17 PythonQtSignalReceiver.cpp
19 18 PythonQtSlot.cpp
20 19 PythonQtSignal.cpp
21 20 PythonQtStdDecorators.cpp
22 21 PythonQtStdIn.cpp
23 22 PythonQtStdOut.cpp
24 23 gui/PythonQtScriptingConsole.cpp
25 24
26 25 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.cpp
27 26
28 27 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp
29 28 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin_init.cpp
30 29 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.cpp
31 30 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin_init.cpp
32 31 )
33 32
34 33 #-----------------------------------------------------------------------------
35 34 # List headers. This is list is used for the install command.
36 35
37 36 set(HEADERS
38 37 PythonQtClassInfo.h
39 38 PythonQtClassWrapper.h
40 39 PythonQtConversion.h
41 40 PythonQtCppWrapperFactory.h
42 41 PythonQtDoc.h
43 42 PythonQt.h
44 43 PythonQtImporter.h
45 44 PythonQtImportFileInterface.h
46 45 PythonQtInstanceWrapper.h
47 46 PythonQtMethodInfo.h
48 47 PythonQtMisc.h
49 48 PythonQtObjectPtr.h
50 49 PythonQtQFileImporter.h
51 50 PythonQtSignalReceiver.h
52 51 PythonQtSlot.h
53 52 PythonQtSignal.h
54 53 PythonQtStdDecorators.h
55 54 PythonQtStdIn.h
56 55 PythonQtStdOut.h
57 56 PythonQtSystem.h
58 57 PythonQtVariants.h
59 58 PythonQtPythonInclude.h
60 59 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.h
61 60 )
62 61
63 62 #-----------------------------------------------------------------------------
64 63 # Headers that should run through moc
65 64
66 65 set(SOURCES_MOC
67 66 PythonQt.h
68 67 PythonQtSignalReceiver.h
69 68 PythonQtStdDecorators.h
70 69 gui/PythonQtScriptingConsole.h
71 70
72 71 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h
73 72 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h
74 73 )
75 74
76 75 #-----------------------------------------------------------------------------
77 76 # Resources
78 77 set(SOURCES_QRC )
79 78
80 79 #-----------------------------------------------------------------------------
81 80 # Build the library
82 81 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
82 add_definitions(-DPYTHONQT_EXPORTS)
83 83
84 84 qt_wrap_cpp(GEN_MOC ${SOURCES_MOC})
85 85 qt_add_resources(GEN_QRC ${SOURCES_QRC})
86 86
87 87 add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC} ${HEADERS})
88 88 if(PythonQt_Qt5)
89 89 qt_use_modules(${PythonQt} Core Gui Widgets)
90 90 else()
91 91 qt_use_modules(${PythonQt} Core Gui)
92 92 endif()
93 93 target_link_libraries(${PythonQt} ${PYTHON_LIBRARIES})
94 94
95 95 #
96 96 # That should solve linkage error on Mac when the project is used in a superbuild setup
97 97 # See http://blog.onesadcookie.com/2008/01/installname-magic.html
98 98 #
99 99 set_target_properties(${PythonQt} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
100 100
101 101 #-----------------------------------------------------------------------------
102 102 # Install library (on windows, put the dll in 'bin' and the archive in 'lib')
103 103
104 104 set_target_properties(${PythonQt} PROPERTIES PUBLIC_HEADER "${HEADERS}")
105 105
106 106 install(TARGETS ${PythonQt} EXPORT ${PythonQt}Targets COMPONENT core-dev
107 107 RUNTIME DESTINATION bin COMPONENT core
108 108 LIBRARY DESTINATION lib COMPONENT core
109 109 ARCHIVE DESTINATION lib COMPONENT core
110 110 PUBLIC_HEADER DESTINATION include/PythonQt)
111 111
112 112 #-----------------------------------------------------------------------------
113 113 # Export CMake Config
114 114
115 115 if(WIN32 AND NOT CYGWIN)
116 116 set(LIB_CMAKE_PATH "cmake")
117 117 else()
118 118 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt}")
119 119 endif()
120 120
121 121 export(TARGETS ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt}Targets.cmake")
122 122 export(PACKAGE ${PythonQt})
123 123
124 124 # build tree
125 125 set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
126 126 configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}Config.cmake" @ONLY)
127 127 # install tree
128 set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include")
128 set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/PythonQt")
129 129 configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake" @ONLY)
130 130 # both
131 131 configure_file(PythonQtConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake" @ONLY)
132 132
133 133 install(EXPORT ${PythonQt}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
134 134 install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake
135 135 ${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake
136 136 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
137 137
General Comments 0
You need to be logged in to leave comments. Login now