##// END OF EJS Templates
Add PythonQt*Config.cmake
Orochimarufan -
r211:6242b5a89014
parent child
Show More
@@ -0,0 +1,24
1 cmake_policy(SET CMP0007 OLD)
2
3 if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4 message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
5 endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
6
7 file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
8 string(REGEX REPLACE "\n" ";" files "${files}")
9 list(REVERSE files)
10 foreach (file ${files})
11 message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
12 if (EXISTS "$ENV{DESTDIR}${file}")
13 execute_process(
14 COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
15 OUTPUT_VARIABLE rm_out
16 RESULT_VARIABLE rm_retval
17 )
18 if(NOT ${rm_retval} EQUAL 0)
19 message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
20 endif (NOT ${rm_retval} EQUAL 0)
21 else (EXISTS "$ENV{DESTDIR}${file}")
22 message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
23 endif (EXISTS "$ENV{DESTDIR}${file}")
24 endforeach(file)
@@ -0,0 +1,21
1 # - Config file for the PythonQt package
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
5 # PythonQt_QtAll_INCLUDE_DIRS - include directories for PythonQt
6 # PythonQt_QtAll_LIBRARIES - libraries to link against
7
8 set(PythonQt @PythonQt@)
9 set(PythonQt_QtAll @PythonQt_QtAll@)
10
11 # Compute paths
12 get_filename_component(PYTHONQT_QTALL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
13 set(PythonQt_QtAll_INCLUDE_DIRS "@INCLUDE_DIRS@")
14
15 # Our library dependencies (contains definitions for IMPORTED targets)
16 if(NOT TARGET @PythonQt_QtAll@)
17 include("${PYTHONQT_QTALL_CMAKE_DIR}/@PythonQt_QtAll@Targets.cmake")
18 endif()
19
20 # These are IMPORTED targets created by @PythonQt_QtAll@Targets.cmake
21 set(PythonQt_QtAll_LIBRARIES @PythonQt_QtAll@)
@@ -0,0 +1,11
1 set(PACKAGE_VERSION "@PythonQt_VERSION@")
2
3 # Check whether the requested PACKAGE_FIND_VERSION is compatible
4 if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
5 set(PACKAGE_VERSION_COMPATIBLE FALSE)
6 else()
7 set(PACKAGE_VERSION_COMPATIBLE TRUE)
8 if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
9 set(PACKAGE_VERSION_EXACT TRUE)
10 endif()
11 endif()
@@ -0,0 +1,22
1 # - Config file for the PythonQt package
2 # It defines the following variables
3 # PythonQt - the PythonQt core target (PythonQt PythonQt_3 PythonQt5 PythonQt5_3)
4 # PythonQt_INCLUDE_DIRS - include directories for PythonQt
5 # PythonQt_LIBRARIES - libraries to link against
6
7 set(PythonQt @PythonQt@)
8 set(PythonQt_Qt5 @PythonQt_Qt5@)
9 set(PythonQt_Python3 @PythonQt_Python3@)
10 set(PythonQt_Python @PYTHON_VERSION@)
11
12 # Compute paths
13 get_filename_component(PYTHONQT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
14 set(PythonQt_INCLUDE_DIRS "@INCLUDE_DIRS@")
15
16 # Our library dependencies (contains definitions for IMPORTED targets)
17 if(NOT TARGET @PythonQt@)
18 include("${PYTHONQT_CMAKE_DIR}/@PythonQt@Targets.cmake")
19 endif()
20
21 # These are IMPORTED targets created by @PythonQt@Targets.cmake
22 set(PythonQt_LIBRARIES @PythonQt@)
@@ -0,0 +1,11
1 set(PACKAGE_VERSION "@PythonQt_VERSION@")
2
3 # Check whether the requested PACKAGE_FIND_VERSION is compatible
4 if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
5 set(PACKAGE_VERSION_COMPATIBLE FALSE)
6 else()
7 set(PACKAGE_VERSION_COMPATIBLE TRUE)
8 if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
9 set(PACKAGE_VERSION_EXACT TRUE)
10 endif()
11 endif()
@@ -1,159 +1,179
1 1 project(PythonQt)
2 2 cmake_minimum_required(VERSION 2.8.10)
3 3
4 4 include(CTestUseLaunchers OPTIONAL)
5 5
6 6 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
7 7
8 8 #-----------------------------------------------------------------------------
9 9 # Debug
10 10 option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF)
11 11 if(PythonQt_DEBUG)
12 12 add_definitions(-DPYTHONQT_DEBUG)
13 13 else()
14 14 remove_definitions(-DPYTHONQT_DEBUG)
15 15 endif()
16 16
17 if(NOT CMAKE_BUILD_TYPE)
18 set(CMAKE_BUILD_TYPE Release)
19 endif()
20
17 21 #-----------------------------------------------------------------------------
18 22 # Qt
19 23 option(PythonQt_Qt5 "Use Qt 5.x (5.1+)" OFF)
20 24 if(PythonQt_Qt5)
21 25 include(PythonQt_Qt_5x)
22 26 else(PythonQt_Qt5)
23 27 include(PythonQt_Qt_4x)
24 28 endif(PythonQt_Qt5)
25 29
26 30 #-----------------------------------------------------------------------------
27 31 # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers
28 32 # associated with the Qt version being used.
29 33 set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}")
30 34
31 35 if("${generated_cpp_suffix}" STREQUAL "_48")
32 36 set(generated_cpp_suffix "")
33 37 endif()
34 38 if("${generated_cpp_suffix}" STREQUAL "_46")
35 39 set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version
36 40 endif()
37 41 if("${generated_cpp_suffix}" STREQUAL "_51")
38 42 set(generated_cpp_suffix "_50")
39 43 endif()
40 44
41 45 #-----------------------------------------------------------------------------
42 46 # Generator
43 47 if(PythonQt_Qt5)
44 48 add_subdirectory(generator_50 EXCLUDE_FROM_ALL)
45 49 add_custom_target(generator)
46 50 add_dependencies(generator pythonqt_generator)
47 51 endif()
48 52
49 53 # TODO
50 54
51 55 #-----------------------------------------------------------------------------
52 56 # Build options
53 57
54 58 #option(PythonQt_Wrap_QtAll "Make all Qt components available in python" OFF)
55 59 #
56 60 #set(qtlibs core gui network opengl sql svg uitools webkit xml xmlpatterns)
57 61 #foreach(qtlib ${qtlibs})
58 62 # OPTION(PythonQt_Wrap_Qt${qtlib} "Make all of Qt${qtlib} available in python" OFF)
59 63 #endforeach()
60 64
61 65 # Force option if it applies
62 66 #if(PythonQt_Wrap_QtAll)
63 67 # list(REMOVE_ITEM qtlibs xmlpatterns) # xmlpatterns wrapper does *NOT* build at all :(
64 68 # foreach(qtlib ${qtlibs})
65 69 # if(NOT ${PythonQt_Wrap_Qt${qtlib}})
66 70 # set(PythonQt_Wrap_Qt${qtlib} ON CACHE BOOL "Make all of Qt${qtlib} available in python" FORCE)
67 71 # message(STATUS "Enabling [PythonQt_Wrap_Qt${qtlib}] because of [PythonQt_Wrap_QtAll] evaluates to True")
68 72 # endif()
69 73 # endforeach()
70 74 #endif()
71 75
72 76 #-----------------------------------------------------------------------------
73 77 # Add extra sources
74 78 #foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
75 79 #
76 80 # if (${PythonQt_Wrap_Qt${qtlib}})
77 81 #
78 82 # ADD_DEFINITIONS(-DPYTHONQT_WRAP_Qt${qtlib})
79 83 #
80 84 # set(file_prefix generated_cpp${generated_cpp_suffix}/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib})
81 85 #
82 86 # foreach(index RANGE 0 11)
83 87 #
84 88 # # Source files
85 89 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.cpp)
86 90 # list(APPEND sources ${file_prefix}${index}.cpp)
87 91 # endif()
88 92 #
89 93 # # Headers that should run through moc
90 94 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.h)
91 95 # list(APPEND moc_sources ${file_prefix}${index}.h)
92 96 # endif()
93 97 #
94 98 # endforeach()
95 99 #
96 100 # list(APPEND sources ${file_prefix}_init.cpp)
97 101 #
98 102 # endif()
99 103 #endforeach()
100 104
101 105 #-----------------------------------------------------------------------------
102 106 # Find Python
103 107 option(PythonQt_Python3 "Use Python 3.x (3.3+)" OFF)
104 108 option(PythonQt_Python "Use specific Python Version" OFF)
105 109 if(PythonQt_Python)
106 110 find_package(Python ${PythonQt_Python} REQUIRED EXACT)
107 111 elseif(PythonQt_Python3)
108 112 find_package(Python 3.3 REQUIRED)
109 113 else()
110 114 find_package(Python 2.6 REQUIRED)
111 115 endif()
112 116
117 if(NOT ${PYTHON_VERSION} VERSION_LESS 3)
118 set(PythonQt_Python3 ON)
119 else()
120 set(PythonQt_Python3 OFF)
121 endif()
122
113 123 include_directories(${PYTHON_INCLUDE_DIRS})
114 124 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
115 125
116 126 #-----------------------------------------------------------------------------
117 127 # Library Name
118 128 # The variable PythonQt_LibraryName contains the PythonQt core library name
119 129 # It incorporates library mayor versions
120 130 # The variable PythonQt_LibrarySuffix is "" or "_d", if it is a debug build
121 131 set(PythonQt_LibraryName PythonQt)
122 132
123 133 if(PythonQt_Qt5)
124 134 set(PythonQt_LibraryName ${PythonQt_LibraryName}5)
125 135 endif()
126 136
127 if(NOT ${PYTHON_VERSION} VERSION_LESS 3)
137 if(PythonQt_Python3)
128 138 set(PythonQt_LibraryName ${PythonQt_LibraryName}_3)
129 139 endif()
130 140
131 if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
141 if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
132 142 set(PythonQt_LibrarySuffix _d)
133 143 endif()
134 144
135 145 message(STATUS "Building ${PythonQt_LibraryName}${PythonQt_LibrarySuffix} (Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} + Python ${PYTHON_VERSION} | ${CMAKE_BUILD_TYPE})")
136 146
137 147 #-----------------------------------------------------------------------------
138 148 # Core
139 149 add_subdirectory(src)
140 150
141 151 #-----------------------------------------------------------------------------
142 152 # Tests
143 153 add_subdirectory(tests EXCLUDE_FROM_ALL)
144 154 # test alias
145 155 add_custom_target(test COMMAND tests/PythonQtTest WORKING_DIRECTORY ${CURRENT_BINARY_DIR})
146 156 add_dependencies(test PythonQtTest)
147 157
148 158 #-----------------------------------------------------------------------------
149 159 # Extenseions (QtAll)
150 add_subdirectory(extensions EXCLUDE_FROM_ALL)
160 add_subdirectory(extensions)
151 161 # QtAll alias
152 162 add_custom_target(QtAll)
153 add_dependencies(QtAll PythonQt_QtAll)
163 add_dependencies(QtAll ${PythonQt_QtAll})
154 164
155 165 #-----------------------------------------------------------------------------
156 166 # Examples
157 167 include_directories(src)
158 168 include_directories(extensions/PythonQt_QtAll)
159 169 add_subdirectory(examples EXCLUDE_FROM_ALL)
170
171 #-----------------------------------------------------------------------------
172 # uninstall target
173 configure_file(
174 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
175 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
176 IMMEDIATE @ONLY)
177
178 add_custom_target(uninstall
179 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
@@ -1,61 +1,61
1 1 project(NicePyConsole)
2 2
3 3 SET(HEADERS
4 4 SimpleConsole.h
5 5 NicePyConsole.h
6 6 PygmentsHighlighter.h
7 7 PythonCompleter.h
8 8 PythonCompleterPopup.h
9 9 )
10 10
11 11 SET(SOURCES
12 12 SimpleConsole.cpp
13 13 NicePyConsole.cpp
14 14 main.cpp
15 15 PygmentsHighlighter.cpp
16 16 PythonCompleter.cpp
17 17 PythonCompleterPopup.cpp
18 18 )
19 19
20 20 SET(FILES
21 21 PygmentsHighlighter.py
22 22 PythonCompleter.py
23 23 module_completion.py
24 24 )
25 25
26 26 SET(DIRS
27 27 pygments
28 28 )
29 29
30 find_package(${PythonQt})
31
30 32 qt_wrap_cpp(GEN_MOC ${HEADERS})
31 33
32 34 add_executable(NicePyConsole ${SOURCES} ${GEN_MOC})
33 35 if(PythonQt_Qt5)
34 36 qt_use_modules(NicePyConsole Core Gui Widgets)
35 37 else()
36 38 qt_use_modules(NicePyConsole Core Gui)
37 39 endif()
38 40
39 get_property(PythonQt_lib TARGET ${PythonQt} PROPERTY LOCATION)
40 get_property(PythonQt_QtAll_lib TARGET ${PythonQt_QtAll} PROPERTY LOCATION)
41 target_link_libraries(NicePyConsole ${PythonQt_lib} ${PythonQt_QtAll_lib} ${PYTHON_LIBRARIES})
41 target_link_libraries(NicePyConsole ${PythonQt} ${PythonQt_QtAll} ${PYTHON_LIBRARIES})
42 42
43 43 foreach(FILE ${FILES})
44 44 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${FILE}")
45 45 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
46 46 add_custom_command(OUTPUT "${OUT}"
47 47 COMMAND "${CMAKE_COMMAND}" -E copy "${IN}" "${OUT}"
48 48 MAIN_DEPENDENCY "${IN}"
49 49 )
50 50 add_dependencies(NicePyConsole "${OUT}")
51 51 endforeach()
52 52
53 53 foreach(DIR ${DIRS})
54 54 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${DIR}")
55 55 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}")
56 56 add_custom_command(OUTPUT "${OUT}"
57 57 COMMAND "${CMAKE_COMMAND}" -E copy_directory "${IN}" "${OUT}"
58 58 MAIN_DEPENDENCY "${IN}"
59 59 )
60 60 add_dependencies(NicePyConsole "${OUT}")
61 61 endforeach()
@@ -1,160 +1,188
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
16 16 foreach(MODULE core gui network opengl sql svg uitools webkit xml)
17 17 SET(MODULE_TROLL com_trolltech_qt_${MODULE})
18 18 SET(MODULE_BASE ${GEN}/${MODULE_TROLL}/${MODULE_TROLL})
19 19 FILE(GLOB HFILES ${MODULE_BASE}*.h)
20 20 FILE(GLOB CFILES ${MODULE_BASE}*.cpp)
21 21 LIST(APPEND HEADERS ${HFILES})
22 22 LIST(APPEND SOURCES ${CFILES})
23 23 endforeach()
24 24
25 25 ## Core
26 26 #LIST(APPEND HEADERS
27 27 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.h
28 28 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.h
29 29 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.h
30 30 #)
31 31
32 32 #LIST(APPEND SOURCES
33 33 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.cpp
34 34 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.cpp
35 35 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.cpp
36 36 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp
37 37 #)
38 38
39 39 ## Gui
40 40 #LIST(APPEND HEADERS
41 41 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.h
42 42 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.h
43 43 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.h
44 44 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.h
45 45 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.h
46 46 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.h
47 47 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.h
48 48 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
49 49 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.h
50 50 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.h
51 51 #)
52 52
53 53 #LIST(APPEND SOURCES
54 54 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.cpp
55 55 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.cpp
56 56 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.cpp
57 57 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.cpp
58 58 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.cpp
59 59 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.cpp
60 60 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.cpp
61 61 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
62 62 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.cpp
63 63 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.cpp
64 64 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui_init.cpp
65 65 #)
66 66
67 67 ## Network
68 68 #LIST(APPEND HEADERS
69 69 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.h
70 70 #)
71 71
72 72 #LIST(APPEND SOURCES
73 73 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.cpp
74 74 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp
75 75 #)
76 76
77 77 ## OpenGL
78 78 #LIST(APPEND HEADERS
79 79 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.h
80 80 #)
81 81
82 82 #LIST(APPEND SOURCES
83 83 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.cpp
84 84 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl_init.cpp
85 85 #)
86 86
87 87 ## Sql
88 88 #LIST(APPEND HEADERS
89 89 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.h
90 90 #)
91 91
92 92 #LIST(APPEND SOURCES
93 93 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.cpp
94 94 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql_init.cpp
95 95 #)
96 96
97 97 ## Svg
98 98 #LIST(APPEND HEADERS
99 99 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.h
100 100 #)
101 101
102 102 #LIST(APPEND SOURCES
103 103 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.cpp
104 104 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg_init.cpp
105 105 #)
106 106
107 107 ## uitools
108 108 #LIST(APPEND HEADERS
109 109 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h
110 110 #)
111 111
112 112 #LIST(APPEND SOURCES
113 113 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp
114 114 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp
115 115 #)
116 116
117 117 ## WebKit
118 118 #LIST(APPEND HEADERS
119 119 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.h
120 120 #)
121 121
122 122 #LIST(APPEND SOURCES
123 123 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.cpp
124 124 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit_init.cpp
125 125 #)
126 126
127 127 ## Xml
128 128 #LIST(APPEND HEADERS
129 129 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.h
130 130 #)
131 131
132 132 #LIST(APPEND SOURCES
133 133 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.cpp
134 134 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml_init.cpp
135 135 #)
136 136
137 137 #-------------------------------------------------------------------
138 138 # Build
139 139 set(PythonQt_QtAll ${PythonQt_LibraryName}_QtAll${PythonQt_LibrarySuffix} CACHE INTERNAL "")
140 140
141 find_package(${PythonQt})
142
141 143 include_directories(../../src)
142 144 add_definitions(-DPYTHONQT_QTALL_EXPORTS)
143 145 qt_wrap_cpp(GEN_MOC ${HEADERS})
144 146
145 147 SET(QT Core Gui Network OpenGL Sql Svg UiTools WebKit Xml)
146 148 if(PythonQt_Qt5)
147 149 LIST(APPEND QT Widgets WebKitWidgets)
148 150 endif()
149 151
150 152
151 153 add_library(${PythonQt_QtAll} SHARED ${SOURCES} ${GEN_MOC})
152 154 qt_use_modules(${PythonQt_QtAll} ${QT})
153 155
154 get_property(PythonQt_lib TARGET ${PythonQt} PROPERTY LOCATION)
155 target_link_libraries(${PythonQt_QtAll} ${PythonQt_lib} ${PYTHON_LIBRARIES})
156 target_link_libraries(${PythonQt_QtAll} ${PythonQt} ${PYTHON_LIBRARIES})
156 157
157 install(TARGETS ${PythonQt_QtAll}
158 install(TARGETS ${PythonQt_QtAll} EXPORT ${PythonQt_QtAll}Targets COMPONENT QtAll
158 159 RUNTIME DESTINATION bin
159 160 LIBRARY DESTINATION lib
160 161 ARCHIVE DESTINATION lib)
162
163 #-----------------------------------------------------------------------------
164 # Export CMake Config
165
166 if(WIN32 AND NOT CYGWIN)
167 set(LIB_CMAKE_PATH "cmake")
168 else()
169 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt_QtAll}")
170 endif()
171
172 export(TARGETS ${PythonQt_QtAll} ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Targets.cmake")
173 export(PACKAGE ${PythonQt_QtAll})
174
175 # build tree
176 set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
177 configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}Config.cmake" @ONLY)
178 # install tree
179 set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/PythonQt/QtAll")
180 configure_file(PythonQt_QtAllConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake" @ONLY)
181 # both
182 configure_file(PythonQt_QtAllConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake" @ONLY)
183
184 install(EXPORT ${PythonQt_QtAll}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev)
185 install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt_QtAll}Config.cmake
186 ${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake
187 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev)
188
@@ -1,110 +1,139
1 1 project(PythonQt_Core)
2 2 cmake_minimum_required(VERSION 2.8.10)
3 3
4 4 #-----------------------------------------------------------------------------
5 5 # Sources
6 6
7 7 set(SOURCES
8 8 PythonQtClassInfo.cpp
9 9 PythonQtClassWrapper.cpp
10 10 PythonQtConversion.cpp
11 11 PythonQt.cpp
12 12 PythonQtImporter.cpp
13 13 PythonQtInstanceWrapper.cpp
14 14 PythonQtMethodInfo.cpp
15 15 PythonQtMisc.cpp
16 16 PythonQtObjectPtr.cpp
17 17 PythonQtQFileImporter.cpp
18 18 PythonQtSignalReceiver.cpp
19 19 PythonQtSlot.cpp
20 20 PythonQtSignal.cpp
21 21 PythonQtStdDecorators.cpp
22 22 PythonQtStdIn.cpp
23 23 PythonQtStdOut.cpp
24 24 gui/PythonQtScriptingConsole.cpp
25 25
26 26 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.cpp
27 27
28 28 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp
29 29 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin_init.cpp
30 30 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.cpp
31 31 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin_init.cpp
32 32 )
33 33
34 34 #-----------------------------------------------------------------------------
35 35 # List headers. This is list is used for the install command.
36 36
37 37 set(HEADERS
38 38 PythonQtClassInfo.h
39 39 PythonQtClassWrapper.h
40 40 PythonQtConversion.h
41 41 PythonQtCppWrapperFactory.h
42 42 PythonQtDoc.h
43 43 PythonQt.h
44 44 PythonQtImporter.h
45 45 PythonQtImportFileInterface.h
46 46 PythonQtInstanceWrapper.h
47 47 PythonQtMethodInfo.h
48 48 PythonQtMisc.h
49 49 PythonQtObjectPtr.h
50 50 PythonQtQFileImporter.h
51 51 PythonQtSignalReceiver.h
52 52 PythonQtSlot.h
53 53 PythonQtSignal.h
54 54 PythonQtStdDecorators.h
55 55 PythonQtStdIn.h
56 56 PythonQtStdOut.h
57 57 PythonQtSystem.h
58 58 PythonQtVariants.h
59 59 PythonQtPythonInclude.h
60 60 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.h
61 61 )
62 62
63 63 #-----------------------------------------------------------------------------
64 64 # Headers that should run through moc
65 65
66 66 set(SOURCES_MOC
67 67 PythonQt.h
68 68 PythonQtSignalReceiver.h
69 69 PythonQtStdDecorators.h
70 70 gui/PythonQtScriptingConsole.h
71 71
72 72 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h
73 73 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h
74 74 )
75 75
76 76 #-----------------------------------------------------------------------------
77 77 # Resources
78 78 set(SOURCES_QRC )
79 79
80 80 #-----------------------------------------------------------------------------
81 81 # Build the library
82 82 set(PythonQt ${PythonQt_LibraryName}${PythonQt_LibrarySuffix} CACHE INTERNAL "")
83 83
84 84 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
85 85
86 86 qt_wrap_cpp(GEN_MOC ${SOURCES_MOC})
87 87 qt_add_resources(GEN_QRC ${SOURCES_QRC})
88 88
89 add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC} ${HEADERS})
89 add_library(${PythonQt} SHARED ${SOURCES} ${GEN_MOC} ${GEN_QRC})
90 90 if(PythonQt_Qt5)
91 91 qt_use_modules(${PythonQt} Core Gui Widgets)
92 92 else()
93 93 qt_use_modules(${PythonQt} Core Gui)
94 94 endif()
95 95 target_link_libraries(${PythonQt} ${PYTHON_LIBRARIES})
96 96
97 97 #
98 98 # That should solve linkage error on Mac when the project is used in a superbuild setup
99 99 # See http://blog.onesadcookie.com/2008/01/installname-magic.html
100 100 #
101 101 set_target_properties(${PythonQt} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
102 102
103 103 #-----------------------------------------------------------------------------
104 104 # Install library (on windows, put the dll in 'bin' and the archive in 'lib')
105 105
106 install(TARGETS ${PythonQt}
107 RUNTIME DESTINATION bin
108 LIBRARY DESTINATION lib
109 ARCHIVE DESTINATION lib)
110 install(FILES ${headers} DESTINATION include/PythonQt)
106 set_target_properties(${PythonQt} PROPERTIES PUBLIC_HEADER "${HEADERS}")
107
108 install(TARGETS ${PythonQt} EXPORT ${PythonQt}Targets COMPONENT core-dev
109 RUNTIME DESTINATION bin COMPONENT core
110 LIBRARY DESTINATION lib COMPONENT core
111 ARCHIVE DESTINATION lib COMPONENT core
112 PUBLIC_HEADER DESTINATION include/PythonQt)
113
114 #-----------------------------------------------------------------------------
115 # Export CMake Config
116
117 if(WIN32 AND NOT CYGWIN)
118 set(LIB_CMAKE_PATH "cmake")
119 else()
120 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt}")
121 endif()
122
123 export(TARGETS ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt}Targets.cmake")
124 export(PACKAGE ${PythonQt})
125
126 # build tree
127 set(INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
128 configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}Config.cmake" @ONLY)
129 # install tree
130 set(INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/PythonQt")
131 configure_file(PythonQtConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake" @ONLY)
132 # both
133 configure_file(PythonQtConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake" @ONLY)
134
135 install(EXPORT ${PythonQt}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
136 install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake
137 ${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake
138 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
139
General Comments 0
You need to be logged in to leave comments. Login now