##// END OF EJS Templates
florianlink -
r202:ca58bd51b222
parent child
Show More
@@ -0,0 +1,162
1 cmake_minimum_required(VERSION 2.8)
2
3 #-----------------------------------------------------------------------------
4 project(PythonQtGenerator)
5 #-----------------------------------------------------------------------------
6
7 include(CTestUseLaunchers OPTIONAL)
8
9 #-----------------------------------------------------------------------------
10 # Setup Qt
11
12 set(minimum_required_qt_version "4.6.2")
13
14 find_package(Qt4)
15
16 if(QT4_FOUND)
17
18 set(found_qt_version ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})
19
20 if(${found_qt_version} VERSION_LESS ${minimum_required_qt_version})
21 message(FATAL_ERROR "error: PythonQt requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${found_qt_version}.")
22 endif()
23
24 set(QT_USE_QTXML ON)
25
26 include(${QT_USE_FILE})
27 else()
28 message(FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable")
29 endif()
30
31 #-----------------------------------------------------------------------------
32 # Sources
33
34 set(sources
35 parser/ast.cpp
36 parser/binder.cpp
37 parser/class_compiler.cpp
38 parser/codemodel.cpp
39 parser/codemodel_finder.cpp
40 parser/compiler_utils.cpp
41 parser/control.cpp
42 parser/declarator_compiler.cpp
43 parser/default_visitor.cpp
44 parser/dumptree.cpp
45 parser/lexer.cpp
46 parser/list.cpp
47 parser/name_compiler.cpp
48 parser/parser.cpp
49 parser/smallobject.cpp
50 parser/tokens.cpp
51 parser/type_compiler.cpp
52 parser/visitor.cpp
53
54 abstractmetabuilder.cpp
55 abstractmetalang.cpp
56 asttoxml.cpp
57 customtypes.cpp
58 fileout.cpp
59 generator.cpp
60 generatorset.cpp
61 generatorsetqtscript.cpp
62 main.cpp
63 metajava.cpp
64 metaqtscriptbuilder.cpp
65 metaqtscript.cpp
66 prigenerator.cpp
67 reporthandler.cpp
68 setupgenerator.cpp
69 shellgenerator.cpp
70 shellheadergenerator.cpp
71 shellimplgenerator.cpp
72 typeparser.cpp
73 typesystem.cpp
74 )
75
76 #-----------------------------------------------------------------------------
77 # List headers. This list is used for the install command.
78
79 set(headers
80 )
81
82 #-----------------------------------------------------------------------------
83 # Headers that should run through moc
84
85 set(moc_sources
86 fileout.h
87 generator.h
88 generatorset.h
89 generatorsetqtscript.h
90 prigenerator.h
91 setupgenerator.h
92 shellgenerator.h
93 shellheadergenerator.h
94 shellimplgenerator.h
95 )
96
97 #-----------------------------------------------------------------------------
98 # UI files
99
100 set(ui_sources )
101
102 #-----------------------------------------------------------------------------
103 # Resources
104
105 set(qrc_sources
106 generator.qrc
107 )
108
109 #-----------------------------------------------------------------------------
110 # Do wrapping
111 qt4_wrap_cpp(gen_moc_sources ${moc_sources})
112 qt4_wrap_ui(gen_ui_sources ${ui_sources})
113 qt4_add_resources(gen_qrc_sources ${qrc_sources})
114
115 #-----------------------------------------------------------------------------
116 # Copy file expected by the generator and specify install rules
117
118 file(GLOB files_to_copy RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "build_*.txt" "typesystem_*.xml")
119 list(APPEND files_to_copy qtscript_masterinclude.h parser/rpp/pp-qt-configuration)
120 foreach(file ${files_to_copy})
121 configure_file(
122 ${file}
123 ${CMAKE_CURRENT_BINARY_DIR}/${file}
124 COPYONLY
125 )
126 get_filename_component(destination_dir ${file} PATH)
127 install(FILES ${file} DESTINATION bin/${destination_dir})
128 endforeach()
129
130 #-----------------------------------------------------------------------------
131 # Build the library
132
133 SOURCE_GROUP("Resources" FILES
134 ${qrc_sources}
135 ${ui_sources}
136 ${files_to_copy}
137 )
138
139 include_directories(
140 ${CMAKE_CURRENT_SOURCE_DIR}
141 ${CMAKE_CURRENT_SOURCE_DIR}/parser
142 ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp
143 )
144
145 add_definitions(-DRXX_ALLOCATOR_INIT_0)
146
147 add_executable(${PROJECT_NAME}
148 ${sources}
149 ${gen_moc_sources}
150 ${gen_ui_sources}
151 ${gen_qrc_sources}
152 )
153
154 target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES})
155
156 #-----------------------------------------------------------------------------
157 # Install library (on windows, put the dll in 'bin' and the archive in 'lib')
158
159 install(TARGETS ${PROJECT_NAME}
160 RUNTIME DESTINATION bin
161 LIBRARY DESTINATION lib
162 ARCHIVE DESTINATION lib)
@@ -1,35 +1,11
1 1 cmake_minimum_required(VERSION 2.8)
2 2
3 3 #-----------------------------------------------------------------------------
4 # See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
5 #
6
7 SET(project_policies
8 CMP0001 # NEW: CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
9 CMP0002 # NEW: Logical target names must be globally unique.
10 CMP0003 # NEW: Libraries linked via full path no longer produce linker search paths.
11 CMP0004 # NEW: Libraries linked may NOT have leading or trailing whitespace.
12 CMP0005 # NEW: Preprocessor definition values are now escaped automatically.
13 CMP0006 # NEW: Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
14 CMP0007 # NEW: List command no longer ignores empty elements.
15 CMP0008 # NEW: Libraries linked by full-path must have a valid library file name.
16 CMP0009 # NEW: FILE GLOB_RECURSE calls should not follow symlinks by default.
17 CMP0010 # NEW: Bad variable reference syntax is an error.
18 CMP0011 # NEW: Included scripts do automatic cmake_policy PUSH and POP.
19 CMP0012 # NEW: if() recognizes numbers and boolean constants.
20 CMP0013 # NEW: Duplicate binary directories are not allowed.
21 CMP0014 # NEW: Input directories must have CMakeLists.txt
22 )
23 FOREACH(policy ${project_policies})
24 IF(POLICY ${policy})
25 CMAKE_POLICY(SET ${policy} NEW)
26 ENDIF()
27 ENDFOREACH()
28
29 #-----------------------------------------------------------------------------
30 4 project(PythonQt)
31 5 #-----------------------------------------------------------------------------
32 6
7 include(CTestUseLaunchers OPTIONAL)
8
33 9 #-----------------------------------------------------------------------------
34 10 # Python libraries
35 11
@@ -40,10 +16,24 add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
40 16 #-----------------------------------------------------------------------------
41 17 # Build options
42 18
43 foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
19 option(PythonQt_Wrap_QtAll "Make all Qt components available in python" OFF)
20
21 set(qtlibs core gui network opengl sql svg uitools webkit xml xmlpatterns)
22 foreach(qtlib ${qtlibs})
44 23 OPTION(PythonQt_Wrap_Qt${qtlib} "Make all of Qt${qtlib} available in python" OFF)
45 24 endforeach()
46 25
26 # Force option if it applies
27 if(PythonQt_Wrap_QtAll)
28 list(REMOVE_ITEM qtlibs xmlpatterns) # xmlpatterns wrapper does *NOT* build at all :(
29 foreach(qtlib ${qtlibs})
30 if(NOT ${PythonQt_Wrap_Qt${qtlib}})
31 set(PythonQt_Wrap_Qt${qtlib} ON CACHE BOOL "Make all of Qt${qtlib} available in python" FORCE)
32 message(STATUS "Enabling [PythonQt_Wrap_Qt${qtlib}] because of [PythonQt_Wrap_QtAll] evaluates to True")
33 endif()
34 endforeach()
35 endif()
36
47 37 option(PythonQt_DEBUG "Enable/Disable PythonQt debug output" OFF)
48 38 if(PythonQt_DEBUG)
49 39 add_definitions(-DPYTHONQT_DEBUG)
@@ -81,6 +71,17 else()
81 71 endif()
82 72
83 73 #-----------------------------------------------------------------------------
74 # The variable "generated_cpp_suffix" allows to conditionnally compile the generated wrappers
75 # associated with the Qt version being used.
76 set(generated_cpp_suffix "_${QT_VERSION_MAJOR}${QT_VERSION_MINOR}")
77 if("${generated_cpp_suffix}" STREQUAL "_48")
78 set(generated_cpp_suffix "")
79 endif()
80 if("${generated_cpp_suffix}" STREQUAL "_46")
81 set(generated_cpp_suffix "_47") # Also use 4.7 wrappers for 4.6.x version
82 endif()
83
84 #-----------------------------------------------------------------------------
84 85 # Sources
85 86
86 87 set(sources
@@ -102,12 +103,12 set(sources
102 103 src/PythonQtStdOut.cpp
103 104 src/gui/PythonQtScriptingConsole.cpp
104 105
105 generated_cpp/PythonQt_QtBindings.cpp
106 generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.cpp
106 107
107 generated_cpp/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp
108 generated_cpp/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin_init.cpp
109 generated_cpp/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.cpp
110 generated_cpp/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin_init.cpp
108 generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.cpp
109 generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin_init.cpp
110 generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.cpp
111 generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin_init.cpp
111 112 )
112 113
113 114 #-----------------------------------------------------------------------------
@@ -136,7 +137,7 set(headers
136 137 src/PythonQtSystem.h
137 138 src/PythonQtVariants.h
138 139 src/PythonQtPythonInclude.h
139 generated_cpp/PythonQt_QtBindings.h
140 generated_cpp${generated_cpp_suffix}/PythonQt_QtBindings.h
140 141 )
141 142
142 143 #-----------------------------------------------------------------------------
@@ -148,8 +149,8 set(moc_sources
148 149 src/PythonQtStdDecorators.h
149 150 src/gui/PythonQtScriptingConsole.h
150 151
151 generated_cpp/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h
152 generated_cpp/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h
152 generated_cpp${generated_cpp_suffix}/com_trolltech_qt_core_builtin/com_trolltech_qt_core_builtin0.h
153 generated_cpp${generated_cpp_suffix}/com_trolltech_qt_gui_builtin/com_trolltech_qt_gui_builtin0.h
153 154 )
154 155
155 156 #-----------------------------------------------------------------------------
@@ -160,9 +161,9 foreach(qtlib core gui network opengl sql svg uitools webkit xml xmlpatterns)
160 161
161 162 ADD_DEFINITIONS(-DPYTHONQT_WRAP_Qt${qtlib})
162 163
163 set(file_prefix generated_cpp/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib})
164 set(file_prefix generated_cpp${generated_cpp_suffix}/com_trolltech_qt_${qtlib}/com_trolltech_qt_${qtlib})
164 165
165 foreach(index RANGE 0 10)
166 foreach(index RANGE 0 11)
166 167
167 168 # Source files
168 169 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file_prefix}${index}.cpp)
General Comments 0
You need to be logged in to leave comments. Login now