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