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