##// END OF EJS Templates
Fix PythonQt*Config*.cmake
Orochimarufan -
r212:00d0962ac01d
parent child
Show More
@@ -1,179 +1,180
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 include(CTestUseLaunchers OPTIONAL)
4 include(CTestUseLaunchers OPTIONAL)
5
5
6 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
6 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)
13 else()
17 else()
14 remove_definitions(-DPYTHONQT_DEBUG)
18 remove_definitions(-DPYTHONQT_DEBUG)
15 endif()
19 endif()
16
20
17 if(NOT CMAKE_BUILD_TYPE)
21 if(NOT CMAKE_BUILD_TYPE)
18 set(CMAKE_BUILD_TYPE Release)
22 set(CMAKE_BUILD_TYPE Release)
19 endif()
23 endif()
20
24
21 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
22 # Qt
26 # Qt
23 option(PythonQt_Qt5 "Use Qt 5.x (5.1+)" OFF)
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)
27 include(PythonQt_Qt_4x)
31 include(PythonQt_Qt_4x)
28 endif(PythonQt_Qt5)
32 endif(PythonQt_Qt5)
29
33
30 #-----------------------------------------------------------------------------
34 #-----------------------------------------------------------------------------
31 # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers
35 # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers
32 # associated with the Qt version being used.
36 # associated with the Qt version being used.
33 set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}")
37 set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}")
34
38
35 if("${generated_cpp_suffix}" STREQUAL "_48")
39 if("${generated_cpp_suffix}" STREQUAL "_48")
36 set(generated_cpp_suffix "")
40 set(generated_cpp_suffix "")
37 endif()
41 endif()
38 if("${generated_cpp_suffix}" STREQUAL "_46")
42 if("${generated_cpp_suffix}" STREQUAL "_46")
39 set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version
43 set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version
40 endif()
44 endif()
41 if("${generated_cpp_suffix}" STREQUAL "_51")
45 if("${generated_cpp_suffix}" STREQUAL "_51")
42 set(generated_cpp_suffix "_50")
46 set(generated_cpp_suffix "_50")
43 endif()
47 endif()
44
48
45 #-----------------------------------------------------------------------------
49 #-----------------------------------------------------------------------------
46 # Generator
50 # Generator
47 if(PythonQt_Qt5)
51 if(PythonQt_Qt5)
48 add_subdirectory(generator_50 EXCLUDE_FROM_ALL)
52 add_subdirectory(generator_50 EXCLUDE_FROM_ALL)
49 add_custom_target(generator)
53 add_custom_target(generator)
50 add_dependencies(generator pythonqt_generator)
54 add_dependencies(generator pythonqt_generator)
51 endif()
55 endif()
52
56
53 # TODO
57 # TODO
54
58
55 #-----------------------------------------------------------------------------
59 #-----------------------------------------------------------------------------
56 # Build options
60 # Build options
57
61
58 #option(PythonQt_Wrap_QtAll "Make all Qt components available in python" OFF)
62 #option(PythonQt_Wrap_QtAll "Make all Qt components available in python" OFF)
59 #
63 #
60 #set(qtlibs core gui network opengl sql svg uitools webkit xml xmlpatterns)
64 #set(qtlibs core gui network opengl sql svg uitools webkit xml xmlpatterns)
61 #foreach(qtlib ${qtlibs})
65 #foreach(qtlib ${qtlibs})
62 # OPTION(PythonQt_Wrap_Qt${qtlib} "Make all of Qt${qtlib} available in python" OFF)
66 # OPTION(PythonQt_Wrap_Qt${qtlib} "Make all of Qt${qtlib} available in python" OFF)
63 #endforeach()
67 #endforeach()
64
68
65 # Force option if it applies
69 # Force option if it applies
66 #if(PythonQt_Wrap_QtAll)
70 #if(PythonQt_Wrap_QtAll)
67 # list(REMOVE_ITEM qtlibs xmlpatterns) # xmlpatterns wrapper does *NOT* build at all :(
71 # list(REMOVE_ITEM qtlibs xmlpatterns) # xmlpatterns wrapper does *NOT* build at all :(
68 # foreach(qtlib ${qtlibs})
72 # foreach(qtlib ${qtlibs})
69 # if(NOT ${PythonQt_Wrap_Qt${qtlib}})
73 # if(NOT ${PythonQt_Wrap_Qt${qtlib}})
70 # set(PythonQt_Wrap_Qt${qtlib} ON CACHE BOOL "Make all of Qt${qtlib} available in python" FORCE)
74 # set(PythonQt_Wrap_Qt${qtlib} ON CACHE BOOL "Make all of Qt${qtlib} available in python" FORCE)
71 # message(STATUS "Enabling [PythonQt_Wrap_Qt${qtlib}] because of [PythonQt_Wrap_QtAll] evaluates to True")
75 # message(STATUS "Enabling [PythonQt_Wrap_Qt${qtlib}] because of [PythonQt_Wrap_QtAll] evaluates to True")
72 # endif()
76 # endif()
73 # endforeach()
77 # endforeach()
74 #endif()
78 #endif()
75
79
76 #-----------------------------------------------------------------------------
80 #-----------------------------------------------------------------------------
77 # Add extra sources
81 # Add extra sources
78 #foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
82 #foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
79 #
83 #
80 # if (${PythonQt_Wrap_Qt${qtlib}})
84 # if (${PythonQt_Wrap_Qt${qtlib}})
81 #
85 #
82 # ADD_DEFINITIONS(-DPYTHONQT_WRAP_Qt${qtlib})
86 # ADD_DEFINITIONS(-DPYTHONQT_WRAP_Qt${qtlib})
83 #
87 #
84 # set(file_prefix generated_cpp${generated_cpp_suffix}/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib})
88 # set(file_prefix generated_cpp${generated_cpp_suffix}/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib})
85 #
89 #
86 # foreach(index RANGE 0 11)
90 # foreach(index RANGE 0 11)
87 #
91 #
88 # # Source files
92 # # Source files
89 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.cpp)
93 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.cpp)
90 # list(APPEND sources ${file_prefix}${index}.cpp)
94 # list(APPEND sources ${file_prefix}${index}.cpp)
91 # endif()
95 # endif()
92 #
96 #
93 # # Headers that should run through moc
97 # # Headers that should run through moc
94 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.h)
98 # if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.h)
95 # list(APPEND moc_sources ${file_prefix}${index}.h)
99 # list(APPEND moc_sources ${file_prefix}${index}.h)
96 # endif()
100 # endif()
97 #
101 #
98 # endforeach()
102 # endforeach()
99 #
103 #
100 # list(APPEND sources ${file_prefix}_init.cpp)
104 # list(APPEND sources ${file_prefix}_init.cpp)
101 #
105 #
102 # endif()
106 # endif()
103 #endforeach()
107 #endforeach()
104
108
105 #-----------------------------------------------------------------------------
109 #-----------------------------------------------------------------------------
106 # Find Python
110 # Find Python
107 option(PythonQt_Python3 "Use Python 3.x (3.3+)" OFF)
111 option(PythonQt_Python3 "Use Python 3.x (3.3+)" OFF)
108 option(PythonQt_Python "Use specific Python Version" OFF)
112 option(PythonQt_Python "Use specific Python Version" OFF)
109 if(PythonQt_Python)
113 if(PythonQt_Python)
110 find_package(Python ${PythonQt_Python} REQUIRED EXACT)
114 find_package(Python ${PythonQt_Python} REQUIRED EXACT)
111 elseif(PythonQt_Python3)
115 elseif(PythonQt_Python3)
112 find_package(Python 3.3 REQUIRED)
116 find_package(Python 3.3 REQUIRED)
113 else()
117 else()
114 find_package(Python 2.6 REQUIRED)
118 find_package(Python 2.6 REQUIRED)
115 endif()
119 endif()
116
120
117 if(NOT ${PYTHON_VERSION} VERSION_LESS 3)
121 if(NOT ${PYTHON_VERSION} VERSION_LESS 3)
118 set(PythonQt_Python3 ON)
122 set(PythonQt_Python3 ON)
119 else()
123 else()
120 set(PythonQt_Python3 OFF)
124 set(PythonQt_Python3 OFF)
121 endif()
125 endif()
122
126
123 include_directories(${PYTHON_INCLUDE_DIRS})
127 include_directories(${PYTHON_INCLUDE_DIRS})
124 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
128 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
125
129
126 #-----------------------------------------------------------------------------
130 #-----------------------------------------------------------------------------
127 # Library Name
131 # Library Name
128 # The variable PythonQt_LibraryName contains the PythonQt core library name
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_LibraryName ${PythonQt_LibraryName}5)
137 set(PythonQt ${PythonQt}5)
135 endif()
138 endif()
136
139
137 if(PythonQt_Python3)
140 if(PythonQt_Python3)
138 set(PythonQt_LibraryName ${PythonQt_LibraryName}_3)
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_LibraryName}${PythonQt_LibrarySuffix} (Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} + Python ${PYTHON_VERSION} | ${CMAKE_BUILD_TYPE})")
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
149 add_subdirectory(src)
150 add_subdirectory(src)
150
151
151 #-----------------------------------------------------------------------------
152 #-----------------------------------------------------------------------------
152 # Tests
153 # Tests
153 add_subdirectory(tests EXCLUDE_FROM_ALL)
154 add_subdirectory(tests EXCLUDE_FROM_ALL)
154 # test alias
155 # test alias
155 add_custom_target(test COMMAND tests/PythonQtTest WORKING_DIRECTORY ${CURRENT_BINARY_DIR})
156 add_custom_target(test COMMAND tests/PythonQtTest WORKING_DIRECTORY ${CURRENT_BINARY_DIR})
156 add_dependencies(test PythonQtTest)
157 add_dependencies(test PythonQtTest)
157
158
158 #-----------------------------------------------------------------------------
159 #-----------------------------------------------------------------------------
159 # Extenseions (QtAll)
160 # Extenseions (QtAll)
160 add_subdirectory(extensions)
161 add_subdirectory(extensions)
161 # QtAll alias
162 # QtAll alias
162 add_custom_target(QtAll)
163 add_custom_target(QtAll)
163 add_dependencies(QtAll ${PythonQt_QtAll})
164 add_dependencies(QtAll ${PythonQt_QtAll})
164
165
165 #-----------------------------------------------------------------------------
166 #-----------------------------------------------------------------------------
166 # Examples
167 # Examples
167 include_directories(src)
168 include_directories(src)
168 include_directories(extensions/PythonQt_QtAll)
169 include_directories(extensions/PythonQt_QtAll)
169 add_subdirectory(examples EXCLUDE_FROM_ALL)
170 add_subdirectory(examples EXCLUDE_FROM_ALL)
170
171
171 #-----------------------------------------------------------------------------
172 #-----------------------------------------------------------------------------
172 # uninstall target
173 # uninstall target
173 configure_file(
174 configure_file(
174 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
175 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
175 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
176 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
176 IMMEDIATE @ONLY)
177 IMMEDIATE @ONLY)
177
178
178 add_custom_target(uninstall
179 add_custom_target(uninstall
179 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
180 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
@@ -1,61 +1,59
1 project(NicePyConsole)
1 project(NicePyConsole)
2
2
3 SET(HEADERS
3 SET(HEADERS
4 SimpleConsole.h
4 SimpleConsole.h
5 NicePyConsole.h
5 NicePyConsole.h
6 PygmentsHighlighter.h
6 PygmentsHighlighter.h
7 PythonCompleter.h
7 PythonCompleter.h
8 PythonCompleterPopup.h
8 PythonCompleterPopup.h
9 )
9 )
10
10
11 SET(SOURCES
11 SET(SOURCES
12 SimpleConsole.cpp
12 SimpleConsole.cpp
13 NicePyConsole.cpp
13 NicePyConsole.cpp
14 main.cpp
14 main.cpp
15 PygmentsHighlighter.cpp
15 PygmentsHighlighter.cpp
16 PythonCompleter.cpp
16 PythonCompleter.cpp
17 PythonCompleterPopup.cpp
17 PythonCompleterPopup.cpp
18 )
18 )
19
19
20 SET(FILES
20 SET(FILES
21 PygmentsHighlighter.py
21 PygmentsHighlighter.py
22 PythonCompleter.py
22 PythonCompleter.py
23 module_completion.py
23 module_completion.py
24 )
24 )
25
25
26 SET(DIRS
26 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})
35 if(PythonQt_Qt5)
33 if(PythonQt_Qt5)
36 qt_use_modules(NicePyConsole Core Gui Widgets)
34 qt_use_modules(NicePyConsole Core Gui Widgets)
37 else()
35 else()
38 qt_use_modules(NicePyConsole Core Gui)
36 qt_use_modules(NicePyConsole Core Gui)
39 endif()
37 endif()
40
38
41 target_link_libraries(NicePyConsole ${PythonQt} ${PythonQt_QtAll} ${PYTHON_LIBRARIES})
39 target_link_libraries(NicePyConsole ${PythonQt} ${PythonQt_QtAll} ${PYTHON_LIBRARIES})
42
40
43 foreach(FILE ${FILES})
41 foreach(FILE ${FILES})
44 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${FILE}")
42 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${FILE}")
45 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
43 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
46 add_custom_command(OUTPUT "${OUT}"
44 add_custom_command(OUTPUT "${OUT}"
47 COMMAND "${CMAKE_COMMAND}" -E copy "${IN}" "${OUT}"
45 COMMAND "${CMAKE_COMMAND}" -E copy "${IN}" "${OUT}"
48 MAIN_DEPENDENCY "${IN}"
46 MAIN_DEPENDENCY "${IN}"
49 )
47 )
50 add_dependencies(NicePyConsole "${OUT}")
48 add_dependencies(NicePyConsole "${OUT}")
51 endforeach()
49 endforeach()
52
50
53 foreach(DIR ${DIRS})
51 foreach(DIR ${DIRS})
54 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${DIR}")
52 SET(OUT "${CMAKE_CURRENT_BINARY_DIR}/${DIR}")
55 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}")
53 SET(IN "${CMAKE_CURRENT_SOURCE_DIR}/${DIR}")
56 add_custom_command(OUTPUT "${OUT}"
54 add_custom_command(OUTPUT "${OUT}"
57 COMMAND "${CMAKE_COMMAND}" -E copy_directory "${IN}" "${OUT}"
55 COMMAND "${CMAKE_COMMAND}" -E copy_directory "${IN}" "${OUT}"
58 MAIN_DEPENDENCY "${IN}"
56 MAIN_DEPENDENCY "${IN}"
59 )
57 )
60 add_dependencies(NicePyConsole "${OUT}")
58 add_dependencies(NicePyConsole "${OUT}")
61 endforeach()
59 endforeach()
@@ -1,188 +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)
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
26 #LIST(APPEND HEADERS
28 #LIST(APPEND HEADERS
27 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.h
29 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.h
28 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.h
30 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.h
29 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.h
31 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.h
30 #)
32 #)
31
33
32 #LIST(APPEND SOURCES
34 #LIST(APPEND SOURCES
33 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.cpp
35 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core0.cpp
34 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.cpp
36 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core1.cpp
35 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.cpp
37 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core2.cpp
36 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp
38 # ${GEN}/com_trolltech_qt_core/com_trolltech_qt_core_init.cpp
37 #)
39 #)
38
40
39 ## Gui
41 ## Gui
40 #LIST(APPEND HEADERS
42 #LIST(APPEND HEADERS
41 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.h
43 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.h
42 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.h
44 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.h
43 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.h
45 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.h
44 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.h
46 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.h
45 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.h
47 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.h
46 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.h
48 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.h
47 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.h
49 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.h
48 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
50 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.h
49 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.h
51 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.h
50 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.h
52 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.h
51 #)
53 #)
52
54
53 #LIST(APPEND SOURCES
55 #LIST(APPEND SOURCES
54 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.cpp
56 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui0.cpp
55 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.cpp
57 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui1.cpp
56 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.cpp
58 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui2.cpp
57 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.cpp
59 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui3.cpp
58 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.cpp
60 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui4.cpp
59 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.cpp
61 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui5.cpp
60 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.cpp
62 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui6.cpp
61 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
63 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui7.cpp
62 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.cpp
64 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui8.cpp
63 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.cpp
65 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui9.cpp
64 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui_init.cpp
66 # ${GEN}/com_trolltech_qt_gui/com_trolltech_qt_gui_init.cpp
65 #)
67 #)
66
68
67 ## Network
69 ## Network
68 #LIST(APPEND HEADERS
70 #LIST(APPEND HEADERS
69 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.h
71 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.h
70 #)
72 #)
71
73
72 #LIST(APPEND SOURCES
74 #LIST(APPEND SOURCES
73 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.cpp
75 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network0.cpp
74 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp
76 # ${GEN}/com_trolltech_qt_network/com_trolltech_qt_network_init.cpp
75 #)
77 #)
76
78
77 ## OpenGL
79 ## OpenGL
78 #LIST(APPEND HEADERS
80 #LIST(APPEND HEADERS
79 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.h
81 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.h
80 #)
82 #)
81
83
82 #LIST(APPEND SOURCES
84 #LIST(APPEND SOURCES
83 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.cpp
85 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl0.cpp
84 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl_init.cpp
86 # ${GEN}/com_trolltech_qt_opengl/com_trolltech_qt_opengl_init.cpp
85 #)
87 #)
86
88
87 ## Sql
89 ## Sql
88 #LIST(APPEND HEADERS
90 #LIST(APPEND HEADERS
89 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.h
91 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.h
90 #)
92 #)
91
93
92 #LIST(APPEND SOURCES
94 #LIST(APPEND SOURCES
93 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.cpp
95 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql0.cpp
94 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql_init.cpp
96 # ${GEN}/com_trolltech_qt_sql/com_trolltech_qt_sql_init.cpp
95 #)
97 #)
96
98
97 ## Svg
99 ## Svg
98 #LIST(APPEND HEADERS
100 #LIST(APPEND HEADERS
99 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.h
101 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.h
100 #)
102 #)
101
103
102 #LIST(APPEND SOURCES
104 #LIST(APPEND SOURCES
103 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.cpp
105 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg0.cpp
104 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg_init.cpp
106 # ${GEN}/com_trolltech_qt_svg/com_trolltech_qt_svg_init.cpp
105 #)
107 #)
106
108
107 ## uitools
109 ## uitools
108 #LIST(APPEND HEADERS
110 #LIST(APPEND HEADERS
109 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h
111 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.h
110 #)
112 #)
111
113
112 #LIST(APPEND SOURCES
114 #LIST(APPEND SOURCES
113 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp
115 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools0.cpp
114 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp
116 # ${GEN}/com_trolltech_qt_uitools/com_trolltech_qt_uitools_init.cpp
115 #)
117 #)
116
118
117 ## WebKit
119 ## WebKit
118 #LIST(APPEND HEADERS
120 #LIST(APPEND HEADERS
119 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.h
121 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.h
120 #)
122 #)
121
123
122 #LIST(APPEND SOURCES
124 #LIST(APPEND SOURCES
123 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.cpp
125 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit0.cpp
124 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit_init.cpp
126 # ${GEN}/com_trolltech_qt_webkit/com_trolltech_qt_webkit_init.cpp
125 #)
127 #)
126
128
127 ## Xml
129 ## Xml
128 #LIST(APPEND HEADERS
130 #LIST(APPEND HEADERS
129 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.h
131 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.h
130 #)
132 #)
131
133
132 #LIST(APPEND SOURCES
134 #LIST(APPEND SOURCES
133 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.cpp
135 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml0.cpp
134 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml_init.cpp
136 # ${GEN}/com_trolltech_qt_xml/com_trolltech_qt_xml_init.cpp
135 #)
137 #)
136
138
137 #-------------------------------------------------------------------
139 #-------------------------------------------------------------------
138 # Build
140 # Build
139 set(PythonQt_QtAll ${PythonQt_LibraryName}_QtAll${PythonQt_LibrarySuffix} CACHE INTERNAL "")
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)
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} ${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
165
168
166 if(WIN32 AND NOT CYGWIN)
169 if(WIN32 AND NOT CYGWIN)
167 set(LIB_CMAKE_PATH "cmake")
170 set(LIB_CMAKE_PATH "cmake")
168 else()
171 else()
169 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt_QtAll}")
172 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt_QtAll}")
170 endif()
173 endif()
171
174
172 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")
173 export(PACKAGE ${PythonQt_QtAll})
176 export(PACKAGE ${PythonQt_QtAll})
174
177
175 # build tree
178 # build tree
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/PythonQt/QtAll")
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)
183
186
184 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)
185 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
186 ${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake
189 ${PROJECT_BINARY_DIR}/${PythonQt_QtAll}ConfigVersion.cmake
187 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev)
190 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT QtAll-dev)
188
191
@@ -1,21 +1,24
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)
3 # PythonQt - the PythonQt core target (PythonQt PythonQt_3 PythonQt5 PythonQt5_3)
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)
13 set(PythonQt_QtAll_INCLUDE_DIRS "@INCLUDE_DIRS@")
16 set(PythonQt_QtAll_INCLUDE_DIRS "@INCLUDE_DIRS@")
14
17
15 # Our library dependencies (contains definitions for IMPORTED targets)
18 # Our library dependencies (contains definitions for IMPORTED targets)
16 if(NOT TARGET @PythonQt_QtAll@)
19 if(NOT TARGET @PythonQt_QtAll@)
17 include("${PYTHONQT_QTALL_CMAKE_DIR}/@PythonQt_QtAll@Targets.cmake")
20 include("${PYTHONQT_QTALL_CMAKE_DIR}/@PythonQt_QtAll@Targets.cmake")
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@)
@@ -1,139 +1,137
1 project(PythonQt_Core)
1 project(PythonQt_Core)
2 cmake_minimum_required(VERSION 2.8.10)
2 cmake_minimum_required(VERSION 2.8.10)
3
3
4 #-----------------------------------------------------------------------------
4 #-----------------------------------------------------------------------------
5 # Sources
5 # Sources
6
6
7 set(SOURCES
7 set(SOURCES
8 PythonQtClassInfo.cpp
8 PythonQtClassInfo.cpp
9 PythonQtClassWrapper.cpp
9 PythonQtClassWrapper.cpp
10 PythonQtConversion.cpp
10 PythonQtConversion.cpp
11 PythonQt.cpp
11 PythonQt.cpp
12 PythonQtImporter.cpp
12 PythonQtImporter.cpp
13 PythonQtInstanceWrapper.cpp
13 PythonQtInstanceWrapper.cpp
14 PythonQtMethodInfo.cpp
14 PythonQtMethodInfo.cpp
15 PythonQtMisc.cpp
15 PythonQtMisc.cpp
16 PythonQtObjectPtr.cpp
16 PythonQtObjectPtr.cpp
17 PythonQtQFileImporter.cpp
17 PythonQtQFileImporter.cpp
18 PythonQtSignalReceiver.cpp
18 PythonQtSignalReceiver.cpp
19 PythonQtSlot.cpp
19 PythonQtSlot.cpp
20 PythonQtSignal.cpp
20 PythonQtSignal.cpp
21 PythonQtStdDecorators.cpp
21 PythonQtStdDecorators.cpp
22 PythonQtStdIn.cpp
22 PythonQtStdIn.cpp
23 PythonQtStdOut.cpp
23 PythonQtStdOut.cpp
24 gui/PythonQtScriptingConsole.cpp
24 gui/PythonQtScriptingConsole.cpp
25
25
26 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.cpp
26 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.cpp
27
27
28 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp
28 ../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
29 ../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
30 ../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
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 # List headers. This is list is used for the install command.
35 # List headers. This is list is used for the install command.
36
36
37 set(HEADERS
37 set(HEADERS
38 PythonQtClassInfo.h
38 PythonQtClassInfo.h
39 PythonQtClassWrapper.h
39 PythonQtClassWrapper.h
40 PythonQtConversion.h
40 PythonQtConversion.h
41 PythonQtCppWrapperFactory.h
41 PythonQtCppWrapperFactory.h
42 PythonQtDoc.h
42 PythonQtDoc.h
43 PythonQt.h
43 PythonQt.h
44 PythonQtImporter.h
44 PythonQtImporter.h
45 PythonQtImportFileInterface.h
45 PythonQtImportFileInterface.h
46 PythonQtInstanceWrapper.h
46 PythonQtInstanceWrapper.h
47 PythonQtMethodInfo.h
47 PythonQtMethodInfo.h
48 PythonQtMisc.h
48 PythonQtMisc.h
49 PythonQtObjectPtr.h
49 PythonQtObjectPtr.h
50 PythonQtQFileImporter.h
50 PythonQtQFileImporter.h
51 PythonQtSignalReceiver.h
51 PythonQtSignalReceiver.h
52 PythonQtSlot.h
52 PythonQtSlot.h
53 PythonQtSignal.h
53 PythonQtSignal.h
54 PythonQtStdDecorators.h
54 PythonQtStdDecorators.h
55 PythonQtStdIn.h
55 PythonQtStdIn.h
56 PythonQtStdOut.h
56 PythonQtStdOut.h
57 PythonQtSystem.h
57 PythonQtSystem.h
58 PythonQtVariants.h
58 PythonQtVariants.h
59 PythonQtPythonInclude.h
59 PythonQtPythonInclude.h
60 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.h
60 ../generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.h
61 )
61 )
62
62
63 #-----------------------------------------------------------------------------
63 #-----------------------------------------------------------------------------
64 # Headers that should run through moc
64 # Headers that should run through moc
65
65
66 set(SOURCES_MOC
66 set(SOURCES_MOC
67 PythonQt.h
67 PythonQt.h
68 PythonQtSignalReceiver.h
68 PythonQtSignalReceiver.h
69 PythonQtStdDecorators.h
69 PythonQtStdDecorators.h
70 gui/PythonQtScriptingConsole.h
70 gui/PythonQtScriptingConsole.h
71
71
72 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h
72 ../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
73 ../generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h
74 )
74 )
75
75
76 #-----------------------------------------------------------------------------
76 #-----------------------------------------------------------------------------
77 # Resources
77 # Resources
78 set(SOURCES_QRC )
78 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()
93 qt_use_modules(${PythonQt} Core Gui)
91 qt_use_modules(${PythonQt} Core Gui)
94 endif()
92 endif()
95 target_link_libraries(${PythonQt} ${PYTHON_LIBRARIES})
93 target_link_libraries(${PythonQt} ${PYTHON_LIBRARIES})
96
94
97 #
95 #
98 # 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
99 # See http://blog.onesadcookie.com/2008/01/installname-magic.html
97 # See http://blog.onesadcookie.com/2008/01/installname-magic.html
100 #
98 #
101 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")
102
100
103 #-----------------------------------------------------------------------------
101 #-----------------------------------------------------------------------------
104 # 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')
105
103
106 set_target_properties(${PythonQt} PROPERTIES PUBLIC_HEADER "${HEADERS}")
104 set_target_properties(${PythonQt} PROPERTIES PUBLIC_HEADER "${HEADERS}")
107
105
108 install(TARGETS ${PythonQt} EXPORT ${PythonQt}Targets COMPONENT core-dev
106 install(TARGETS ${PythonQt} EXPORT ${PythonQt}Targets COMPONENT core-dev
109 RUNTIME DESTINATION bin COMPONENT core
107 RUNTIME DESTINATION bin COMPONENT core
110 LIBRARY DESTINATION lib COMPONENT core
108 LIBRARY DESTINATION lib COMPONENT core
111 ARCHIVE DESTINATION lib COMPONENT core
109 ARCHIVE DESTINATION lib COMPONENT core
112 PUBLIC_HEADER DESTINATION include/PythonQt)
110 PUBLIC_HEADER DESTINATION include/PythonQt)
113
111
114 #-----------------------------------------------------------------------------
112 #-----------------------------------------------------------------------------
115 # Export CMake Config
113 # Export CMake Config
116
114
117 if(WIN32 AND NOT CYGWIN)
115 if(WIN32 AND NOT CYGWIN)
118 set(LIB_CMAKE_PATH "cmake")
116 set(LIB_CMAKE_PATH "cmake")
119 else()
117 else()
120 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt}")
118 set(LIB_CMAKE_PATH "lib/cmake/${PythonQt}")
121 endif()
119 endif()
122
120
123 export(TARGETS ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt}Targets.cmake")
121 export(TARGETS ${PythonQt} FILE "${PROJECT_BINARY_DIR}/${PythonQt}Targets.cmake")
124 export(PACKAGE ${PythonQt})
122 export(PACKAGE ${PythonQt})
125
123
126 # build tree
124 # build tree
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/PythonQt")
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)
134
132
135 install(EXPORT ${PythonQt}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
133 install(EXPORT ${PythonQt}Targets DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
136 install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake
134 install(FILES ${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PythonQt}Config.cmake
137 ${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake
135 ${PROJECT_BINARY_DIR}/${PythonQt}ConfigVersion.cmake
138 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
136 DESTINATION "${LIB_CMAKE_PATH}" COMPONENT core-dev)
139
137
General Comments 0
You need to be logged in to leave comments. Login now