@@ -7,6 +7,10 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) | |||
|
7 | 7 | |
|
8 | 8 | #----------------------------------------------------------------------------- |
|
9 | 9 | # Debug |
|
10 | SET(PythonQt_VERSION 2.2.0) | |
|
11 | ||
|
12 | #----------------------------------------------------------------------------- | |
|
13 | # Debug | |
|
10 | 14 | option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF) |
|
11 | 15 | if(PythonQt_DEBUG) |
|
12 | 16 | add_definitions(-DPYTHONQT_DEBUG) |
@@ -20,7 +24,7 endif() | |||
|
20 | 24 | |
|
21 | 25 | #----------------------------------------------------------------------------- |
|
22 | 26 | # Qt |
|
23 |
option(PythonQt_Qt5 "Use Qt 5.x |
|
|
27 | option(PythonQt_Qt5 "Use Qt 5.x" OFF) | |
|
24 | 28 | if(PythonQt_Qt5) |
|
25 | 29 | include(PythonQt_Qt_5x) |
|
26 | 30 | else(PythonQt_Qt5) |
@@ -125,24 +129,21 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK) | |||
|
125 | 129 | |
|
126 | 130 | #----------------------------------------------------------------------------- |
|
127 | 131 | # Library Name |
|
128 |
# The variable PythonQt |
|
|
132 | # The variable PythonQt contains the PythonQt core library name | |
|
129 | 133 | # It incorporates library mayor versions |
|
130 | # The variable PythonQt_LibrarySuffix is "" or "_d", if it is a debug build | |
|
131 | set(PythonQt_LibraryName PythonQt) | |
|
134 | set(PythonQt PythonQt) | |
|
132 | 135 | |
|
133 | 136 | if(PythonQt_Qt5) |
|
134 |
set(PythonQt |
|
|
137 | set(PythonQt ${PythonQt}5) | |
|
135 | 138 | endif() |
|
136 | 139 | |
|
137 | 140 | if(PythonQt_Python3) |
|
138 |
set(PythonQt |
|
|
141 | set(PythonQt ${PythonQt}_3) | |
|
139 | 142 | endif() |
|
140 | 143 | |
|
141 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | |
|
142 | set(PythonQt_LibrarySuffix _d) | |
|
143 | endif() | |
|
144 | set(CMAKE_DEBUG_POSTFIX "_d") | |
|
144 | 145 | |
|
145 |
message(STATUS "Building ${PythonQt |
|
|
146 | message(STATUS "Building ${PythonQt} (Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} + Python ${PYTHON_VERSION} | ${CMAKE_BUILD_TYPE})") | |
|
146 | 147 | |
|
147 | 148 | #----------------------------------------------------------------------------- |
|
148 | 149 | # Core |
@@ -27,8 +27,6 SET(DIRS | |||
|
27 | 27 | pygments |
|
28 | 28 | ) |
|
29 | 29 | |
|
30 | find_package(${PythonQt}) | |
|
31 | ||
|
32 | 30 | qt_wrap_cpp(GEN_MOC ${HEADERS}) |
|
33 | 31 | |
|
34 | 32 | add_executable(NicePyConsole ${SOURCES} ${GEN_MOC}) |
@@ -12,14 +12,16 SET(SOURCES | |||
|
12 | 12 | #------------------------------------------------------------------- |
|
13 | 13 | # Generated stuff |
|
14 | 14 | SET(GEN ../../generated_cpp${generated_cpp_suffix}) |
|
15 | SET(GEN_HEADERS) | |
|
16 | SET(GEN_SOURCES) | |
|
15 | 17 | |
|
16 | 18 | foreach(MODULE core gui network opengl sql svg uitools webkit xml) |
|
17 | 19 | SET(MODULE_TROLL com_trolltech_qt_${MODULE}) |
|
18 | 20 | SET(MODULE_BASE ${GEN}/${MODULE_TROLL}/${MODULE_TROLL}) |
|
19 | 21 | FILE(GLOB HFILES ${MODULE_BASE}*.h) |
|
20 | 22 | FILE(GLOB CFILES ${MODULE_BASE}*.cpp) |
|
21 | LIST(APPEND HEADERS ${HFILES}) | |
|
22 | LIST(APPEND SOURCES ${CFILES}) | |
|
23 | LIST(APPEND GEN_HEADERS ${HFILES}) | |
|
24 | LIST(APPEND GEN_SOURCES ${CFILES}) | |
|
23 | 25 | endforeach() |
|
24 | 26 | |
|
25 | 27 | ## Core |
@@ -136,13 +138,11 endforeach() | |||
|
136 | 138 | |
|
137 | 139 | #------------------------------------------------------------------- |
|
138 | 140 | # Build |
|
139 |
set(PythonQt_QtAll ${PythonQt |
|
|
140 | ||
|
141 | find_package(${PythonQt}) | |
|
141 | set(PythonQt_QtAll ${PythonQt}_QtAll CACHE INTERNAL "") | |
|
142 | 142 | |
|
143 | 143 | include_directories(../../src) |
|
144 | 144 | add_definitions(-DPYTHONQT_QTALL_EXPORTS) |
|
145 | qt_wrap_cpp(GEN_MOC ${HEADERS}) | |
|
145 | qt_wrap_cpp(GEN_MOC ${GEN_HEADERS}) | |
|
146 | 146 | |
|
147 | 147 | SET(QT Core Gui Network OpenGL Sql Svg UiTools WebKit Xml) |
|
148 | 148 | if(PythonQt_Qt5) |
@@ -150,15 +150,18 if(PythonQt_Qt5) | |||
|
150 | 150 | endif() |
|
151 | 151 | |
|
152 | 152 | |
|
153 | add_library(${PythonQt_QtAll} SHARED ${SOURCES} ${GEN_MOC}) | |
|
153 | add_library(${PythonQt_QtAll} SHARED ${SOURCES} ${HEADERS} ${GEN_SOURCES} ${GEN_MOC}) | |
|
154 | 154 | qt_use_modules(${PythonQt_QtAll} ${QT}) |
|
155 | 155 | |
|
156 | 156 | target_link_libraries(${PythonQt_QtAll} ${PythonQt} ${PYTHON_LIBRARIES}) |
|
157 | 157 | |
|
158 | set_target_properties(${PythonQt_QtAll} PROPERTIES PUBLIC_HEADER "${HEADERS}") | |
|
159 | ||
|
158 | 160 | install(TARGETS ${PythonQt_QtAll} EXPORT ${PythonQt_QtAll}Targets COMPONENT QtAll |
|
159 | 161 | RUNTIME DESTINATION bin |
|
160 | 162 | LIBRARY DESTINATION lib |
|
161 |
ARCHIVE DESTINATION lib |
|
|
163 | ARCHIVE DESTINATION lib | |
|
164 | PUBLIC_HEADER DESTINATION include/PythonQt) | |
|
162 | 165 | |
|
163 | 166 | #----------------------------------------------------------------------------- |
|
164 | 167 | # Export CMake Config |
@@ -176,7 +179,7 export(PACKAGE ${PythonQt_QtAll}) | |||
|
176 | 179 | set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") |
|
177 | 180 | configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Config.cmake" @ONLY) |
|
178 | 181 | # install tree |
|
179 |
set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include |
|
|
182 | set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") | |
|
180 | 183 | configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake" @ONLY) |
|
181 | 184 | # both |
|
182 | 185 | configure_file(PythonQt_QtAllConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake" @ONLY) |
@@ -4,9 +4,12 | |||
|
4 | 4 | # PythonQt_QtAll - the PythonQt QtAll target |
|
5 | 5 | # PythonQt_QtAll_INCLUDE_DIRS - include directories for PythonQt |
|
6 | 6 | # PythonQt_QtAll_LIBRARIES - libraries to link against |
|
7 | # PythonQt_QtAll_QT - linked Qt modules | |
|
7 | 8 | |
|
8 | set(PythonQt @PythonQt@) | |
|
9 | 9 | set(PythonQt_QtAll @PythonQt_QtAll@) |
|
10 | set(PythonQt_QtAll_QT @QT@) | |
|
11 | ||
|
12 | find_package(@PythonQt@) | |
|
10 | 13 | |
|
11 | 14 | # Compute paths |
|
12 | 15 | get_filename_component(PYTHONQT_QTALL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) |
@@ -18,4 +21,4 if(NOT TARGET @PythonQt_QtAll@) | |||
|
18 | 21 | endif() |
|
19 | 22 | |
|
20 | 23 | # These are IMPORTED targets created by @PythonQt_QtAll@Targets.cmake |
|
21 | set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@) | |
|
24 | set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@ @PythonQt@) |
@@ -79,14 +79,12 set(SOURCES_QRC ) | |||
|
79 | 79 | |
|
80 | 80 | #----------------------------------------------------------------------------- |
|
81 | 81 | # Build the library |
|
82 | set(PythonQt ${PythonQt_LibraryName}${PythonQt_LibrarySuffix} CACHE INTERNAL "") | |
|
83 | ||
|
84 | 82 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
|
85 | 83 | |
|
86 | 84 | qt_wrap_cpp(GEN_MOC ${SOURCES_MOC}) |
|
87 | 85 | qt_add_resources(GEN_QRC ${SOURCES_QRC}) |
|
88 | 86 | |
|
89 | add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC}) | |
|
87 | add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC} ${HEADERS}) | |
|
90 | 88 | if(PythonQt_Qt5) |
|
91 | 89 | qt_use_modules(${PythonQt} Core Gui Widgets) |
|
92 | 90 | else() |
@@ -127,7 +125,7 export(PACKAGE ${PythonQt}) | |||
|
127 | 125 | set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}") |
|
128 | 126 | configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}Config.cmake" @ONLY) |
|
129 | 127 | # install tree |
|
130 |
set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include |
|
|
128 | set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") | |
|
131 | 129 | configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake" @ONLY) |
|
132 | 130 | # both |
|
133 | 131 | configure_file(PythonQtConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake" @ONLY) |
General Comments 0
You need to be logged in to leave comments.
Login now