mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
59 lines
2.2 KiB
Python
Executable file
59 lines
2.2 KiB
Python
Executable file
#!/usr/bin/python2
|
|
|
|
import sys, os, re
|
|
|
|
components = {
|
|
'Core': 'Q_CORE_EXPORT',
|
|
'Gui': 'Q_GUI_EXPORT',
|
|
'DBus': 'Q_DBUS_EXPORT',
|
|
'Declarative': 'Q_DECLARATIVE_EXPORT',
|
|
'Designer': 'QDESIGNER_COMPONENTS_EXPORT|QDESIGNER_EXTENSION_EXPORT|QT_FORMEDITOR_EXPORT|QT_PROPERTYEDITOR_EXPORT|QT_SIGNALSLOTEDITOR_EXPORT|QT_OBJECTINSPECTOR_EXPORT|QT_WIDGETBOX_EXPORT|QT_BUDDYEDITOR_EXPORT|QT_TABORDEREDITOR_EXPORT|QT_TASKMENU_EXPORT',
|
|
'Help': 'QHELP_EXPORT',
|
|
'Multimedia': 'Q_MULTIMEDIA_EXPORT',
|
|
'Network': 'Q_NETWORK_EXPORT',
|
|
'Sql': 'Q_SQL_EXPORT',
|
|
'Svg': 'Q_SVG_EXPORT',
|
|
'Xml': 'Q_XML_EXPORT',
|
|
'XmlPatterns': 'Q_XMLPATTERNS_EXPORT',
|
|
'Script': 'Q_SCRIPT_EXPORT',
|
|
'ScriptTools': 'Q_SCRIPTTOOLS_EXPORT',
|
|
'Test': 'Q_TESTLIB_EXPORT',
|
|
'UiTools': 'QDESIGNER_UILIB_EXPORT',
|
|
'OpenGL': 'Q_OPENGL_EXPORT',
|
|
}
|
|
mapoutput = 'src/shared/qclass_lib_map.h'
|
|
classcount = -1
|
|
mapdata = '// Automatically generated by genmap.py, DO NOT EDIT!\n\n'
|
|
mapdata += '#ifndef QT_CLASS_MAP_H\n#define QT_CLASS_MAP_H\n\n'
|
|
mapdata += 'static const ClassInfoEntry qclass_lib_map[] = {\n'
|
|
|
|
def exportscan(sdir, keyword, component):
|
|
dirmap = ''
|
|
global classcount
|
|
for sroot, sdir, lfiles in os.walk(sdir):
|
|
for sfile in lfiles:
|
|
if not sfile.endswith('.h') or sfile.endswith('_p.h'):
|
|
continue
|
|
sfull = '%s/%s' % (sroot, sfile)
|
|
with open(sfull, 'rb') as f:
|
|
scontent = f.read()
|
|
scontent = scontent.decode('utf-8')
|
|
for match in re.findall('(?:class|struct) (?:%s) (\w+)' % keyword, scontent):
|
|
dirmap += ' { "%s", "%s/%s"},\n' % (match, component, sfile)
|
|
classcount += 1
|
|
return dirmap
|
|
|
|
for component in components:
|
|
keyword = components[component]
|
|
mapdata += exportscan('src/%s' % component.lower(), keyword, 'Qt%s' % component)
|
|
|
|
mapdata += '};\n'
|
|
mapdata += 'static const int qclass_lib_count = %d;\n\n' % classcount
|
|
mapdata += '#endif\n'
|
|
|
|
with open(mapoutput, 'wb') as f:
|
|
sys.stdout.write('-- Writing: %s\n' % mapoutput)
|
|
if sys.version_info[0] == 3:
|
|
f.write(bytes(mapdata, 'utf-8'))
|
|
else:
|
|
f.write(mapdata)
|