mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
make Python recommended not required
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
ab7cee87fc
commit
d088897d13
21 changed files with 49 additions and 53 deletions
|
@ -228,7 +228,7 @@ set_package_properties(PythonInterp PROPERTIES
|
|||
PURPOSE "UI class maps generator script"
|
||||
DESCRIPTION "Programming language that lets you work quickly"
|
||||
URL "https://www.python.org/"
|
||||
TYPE REQUIRED
|
||||
TYPE RECOMMENDED
|
||||
)
|
||||
|
||||
find_package(OpenSSL)
|
||||
|
@ -463,6 +463,22 @@ if(NOT KATIE_PLATFORM MATCHES "(win32|wince|mac)" AND NOT KATIE_BOOTSTRAP)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(PYTHONINTERP_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/genmap.py
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE genmap_result
|
||||
ERROR_VARIABLE genmap_error
|
||||
)
|
||||
if(NOT genmap_result EQUAL 0)
|
||||
message(SEND_ERROR "${genmap_error}")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING
|
||||
"\nUsing pre-generated classes map"
|
||||
)
|
||||
endif()
|
||||
|
||||
# various sources use #include <shared/blah.h>
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src)
|
||||
|
||||
|
|
|
@ -27,20 +27,6 @@ else()
|
|||
endif()
|
||||
set(KATIE_QDBUSXML2CPP "qdbusxml2cpp")
|
||||
|
||||
macro(KATIE_GENERATE_MAP SUBDIR KEYWORD)
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/genmap.py ${SUBDIR} ${KEYWORD}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE genmap_result
|
||||
ERROR_VARIABLE genmap_error
|
||||
)
|
||||
if(NOT genmap_result EQUAL 0)
|
||||
message(SEND_ERROR "${genmap_error}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
set(CLASSMAPOUT ${CMAKE_BINARY_DIR}/include/qclass_lib_map.h)
|
||||
file(WRITE ${CLASSMAPOUT} "")
|
||||
macro(KATIE_GENERATE_PUBLIC PUBLIC_INCLUDES SUBDIR)
|
||||
set(metaout ${CMAKE_BINARY_DIR}/include/${SUBDIR}/${SUBDIR})
|
||||
set(metadata "#ifndef Qt${SUBDIR}_META_H\n#define Qt${SUBDIR}_META_H\n\n")
|
||||
|
@ -60,7 +46,6 @@ macro(KATIE_GENERATE_PUBLIC PUBLIC_INCLUDES SUBDIR)
|
|||
endforeach(pubheader)
|
||||
set(metadata "${metadata}\n#endif\n")
|
||||
file(WRITE ${metaout} "${metadata}")
|
||||
file(APPEND ${CLASSMAPOUT} "#include <${SUBDIR}_map.h>\n")
|
||||
endmacro()
|
||||
|
||||
macro(KATIE_GENERATE_MISC MISC_INCLUDES SUBDIR)
|
||||
|
@ -108,12 +93,11 @@ endfunction()
|
|||
|
||||
# the purpose of this function is to ensure that (1) the output string is not
|
||||
# null so that when it is passed to another function/macro it does not complain
|
||||
# about inproper number of arguments and (2) it joins the input which if
|
||||
# quoted has semicolons to it (if it is a list) that the sub-command
|
||||
# (e.g. gcc) can not handle. that's a dirty hack to support gcc and clang at
|
||||
# the same time along with custom target COMPILE_FLAGS/LINK_FLAGS without
|
||||
# doing compiler checks all over the place. if anyone has a better solution
|
||||
# I'll be glad to drop the function bellow!
|
||||
# about inproper number of arguments and (2) it joins the input which if quoted
|
||||
# has semicolons in it (if it is a list) that the sub-command (e.g. gcc) can
|
||||
# not handle. that's a dirty hack to support gcc and clang at the same time
|
||||
# along with custom target COMPILE_FLAGS/LINK_FLAGS without doing compiler
|
||||
# checks all over the place.
|
||||
function(KATIE_FIXUP_STRING INSTR OUTSTR)
|
||||
string(STRIP "${INSTR}" instrtrimmed)
|
||||
if("${instrtrimmed}" STREQUAL "")
|
||||
|
|
|
@ -2,14 +2,29 @@
|
|||
|
||||
import sys, os, re
|
||||
|
||||
headersdir = os.getcwd()
|
||||
component = sys.argv[1]
|
||||
keyword = sys.argv[2]
|
||||
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'
|
||||
mapdata = '#ifndef QT_CLASS_MAP_H\n#define QT_CLASS_MAP_H\n\n'
|
||||
|
||||
mapoutput = '%s/include/%s_map.h' % (headersdir, component)
|
||||
mapdata = '#ifndef %s_MAP_H\n#define %s_MAP_H\n\n' % (component, component)
|
||||
|
||||
def exportscan(sdir):
|
||||
def exportscan(sdir, keyword, component):
|
||||
dirmap = ''
|
||||
for sroot, sdir, lfiles in os.walk(sdir):
|
||||
for sfile in lfiles:
|
||||
|
@ -23,11 +38,13 @@ def exportscan(sdir):
|
|||
dirmap += 'QT_CLASS_LIB(%s, %s, %s)\n' % (match, component, sfile)
|
||||
return dirmap
|
||||
|
||||
mapdata += exportscan('%s/include/%s' % (headersdir, component))
|
||||
mapdata += exportscan('%s/privateinclude/%s' % (headersdir, component))
|
||||
for component in components:
|
||||
keyword = components[component]
|
||||
mapdata += exportscan('src/%s' % component, keyword, 'Qt%s' % component.capitalize())
|
||||
|
||||
mapdata += '\n#endif\n'
|
||||
|
||||
sys.stderr.write('-- Writing: %s\n' % os.path.basename(mapoutput))
|
||||
sys.stdout.write('-- Writing: %s\n' % mapoutput)
|
||||
with open(mapoutput, 'wb') as f:
|
||||
if sys.version_info[0] == 3:
|
||||
f.write(bytes(mapdata, 'utf-8'))
|
||||
|
|
|
@ -362,7 +362,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${CORE_HEADERS}" QtCore)
|
||||
katie_generate_public("${CORE_PUBLIC_HEADERS}" QtCore)
|
||||
katie_generate_map(QtCore Q_CORE_EXPORT)
|
||||
katie_resources(${CORE_SOURCES} ${CORE_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -123,7 +123,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${DBUS_HEADERS}" QtDBus)
|
||||
katie_generate_public("${DBUS_PUBLIC_HEADERS}" QtDBus)
|
||||
katie_generate_map(QtDBus Q_DBUS_EXPORT)
|
||||
katie_resources(${DBUS_SOURCES} ${DBUS_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -73,7 +73,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${DECLARATIVE_HEADERS}" QtDeclarative)
|
||||
katie_generate_public("${DECLARATIVE_PUBLIC_HEADERS}" QtDeclarative)
|
||||
katie_generate_map(QtDeclarative Q_DECLARATIVE_EXPORT)
|
||||
katie_resources("${DECLARATIVE_SOURCES}")
|
||||
katie_resources("${DECLARATIVE_HEADERS}")
|
||||
katie_setup_flags()
|
||||
|
|
|
@ -114,7 +114,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${DESIGNER_HEADERS}" QtDesigner)
|
||||
katie_generate_public("${DESIGNER_PUBLIC_HEADERS}" QtDesigner)
|
||||
katie_generate_map(QtDesigner "QDESIGNER_COMPONENTS_EXPORT|QDESIGNER_EXTENSION_EXPORT")
|
||||
katie_resources("${DESIGNER_SOURCES}")
|
||||
katie_resources("${DESIGNER_HEADERS}")
|
||||
katie_setup_flags()
|
||||
|
|
|
@ -79,10 +79,6 @@ endif()
|
|||
# headers go in one place!
|
||||
katie_generate_misc("${DESIGNERCOMPONENTS_HEADERS}" QtDesignerComponents)
|
||||
katie_generate_public("${DESIGNERCOMPONENTS_PUBLIC_HEADERS}" QtDesignerComponents)
|
||||
katie_generate_map(
|
||||
QtDesignerComponents
|
||||
"QT_FORMEDITOR_EXPORT|QT_PROPERTYEDITOR_EXPORT|QT_SIGNALSLOTEDITOR_EXPORT|QT_OBJECTINSPECTOR_EXPORT|QT_WIDGETBOX_EXPORT|QT_BUDDYEDITOR_EXPORT|QT_TABORDEREDITOR_EXPORT|QT_TASKMENU_EXPORT"
|
||||
)
|
||||
katie_resources(${DESIGNERCOMPONENTS_SOURCES})
|
||||
katie_resources(${DESIGNERCOMPONENTS_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
|
|
@ -485,7 +485,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${GUI_HEADERS}" QtGui)
|
||||
katie_generate_public("${GUI_PUBLIC_HEADERS}" QtGui)
|
||||
katie_generate_map(QtGui Q_GUI_EXPORT)
|
||||
katie_resources(${GUI_SOURCES} ${GUI_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ include_directories(
|
|||
|
||||
katie_generate_misc("${HELP_HEADERS}" QtHelp)
|
||||
katie_generate_public("${HELP_PUBLIC_HEADERS}" QtHelp)
|
||||
katie_generate_map(QtHelp QHELP_EXPORT)
|
||||
katie_resources(${HELP_SOURCES} ${HELP_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ include_directories(
|
|||
|
||||
katie_generate_misc("${MULTIMEDIA_HEADERS}" QtMultimedia)
|
||||
katie_generate_public("${MULTIMEDIA_PUBLIC_HEADERS}" QtMultimedia)
|
||||
katie_generate_map(QtMultimedia Q_MULTIMEDIA_EXPORT)
|
||||
katie_resources("${MULTIMEDIA_SOURCES}")
|
||||
katie_resources("${MULTIMEDIA_HEADERS}")
|
||||
katie_setup_flags()
|
||||
|
|
|
@ -83,7 +83,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${NETWORK_HEADERS}" QtNetwork)
|
||||
katie_generate_public("${NETWORK_PUBLIC_HEADERS}" QtNetwork)
|
||||
katie_generate_map(QtNetwork Q_NETWORK_EXPORT)
|
||||
katie_resources(${NETWORK_SOURCES} ${NETWORK_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -195,7 +195,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${OPENGL_HEADERS}" QtOpenGL)
|
||||
katie_generate_public("${OPENGL_PUBLIC_HEADERS}" QtOpenGL)
|
||||
katie_generate_map(QtOpenGL Q_OPENGL_EXPORT)
|
||||
katie_resources(${OPENGL_SOURCES} ${OPENGL_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -291,7 +291,6 @@ set(SCRIPT_RESOURCES
|
|||
|
||||
katie_generate_misc("${SCRIPT_HEADERS}" QtScript)
|
||||
katie_generate_public("${SCRIPT_PUBLIC_HEADERS}" QtScript)
|
||||
katie_generate_map(QtScript Q_SCRIPT_EXPORT)
|
||||
katie_resources(${SCRIPT_RESOURCES})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ include_directories(
|
|||
|
||||
katie_generate_misc("${SCRIPTTOOLS_HEADERS}" QtScriptTools)
|
||||
katie_generate_public("${SCRIPTTOOLS_PUBLIC_HEADERS}" QtScriptTools)
|
||||
katie_generate_map(QtScriptTools Q_SCRIPTTOOLS_EXPORT)
|
||||
katie_resources(${SCRIPTTOOLS_SOURCES} ${SCRIPTTOOLS_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -76,7 +76,6 @@ include_directories(
|
|||
|
||||
katie_generate_misc("${SQL_HEADERS}" QtSql)
|
||||
katie_generate_public("${SQL_PUBLIC_HEADERS}" QtSql)
|
||||
katie_generate_map(QtSql Q_SQL_EXPORT)
|
||||
katie_resources(${SQL_SOURCES} ${SQL_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${SVG_HEADERS}" QtSvg)
|
||||
katie_generate_public("${SVG_PUBLIC_HEADERS}" QtSvg)
|
||||
katie_generate_map(QtSvg Q_SVG_EXPORT)
|
||||
katie_resources(${SVG_SOURCES} ${SVG_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -134,7 +134,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${TEST_HEADERS}" QtTest)
|
||||
katie_generate_public("${TEST_PUBLIC_HEADERS}" QtTest)
|
||||
katie_generate_map(QtTest Q_TESTLIB_EXPORT)
|
||||
katie_resources(${TEST_SOURCES} ${TEST_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ include_directories(
|
|||
|
||||
katie_generate_misc("${UITOOLS_HEADERS}" QtUiTools)
|
||||
katie_generate_public("${UITOOLS_PUBLIC_HEADERS}" QtUiTools)
|
||||
katie_generate_map(QtUiTools QDESIGNER_UILIB_EXPORT)
|
||||
katie_resources(${UITOOLS_SOURCES} ${UITOOLS_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ endif()
|
|||
|
||||
katie_generate_misc("${XML_HEADERS}" QtXml)
|
||||
katie_generate_public("${XML_PUBLIC_HEADERS}" QtXml)
|
||||
katie_generate_map(QtXml Q_XML_EXPORT)
|
||||
katie_resources(${XML_SOURCES} ${XML_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ include_directories(
|
|||
|
||||
katie_generate_misc("${XMLPATTERNS_HEADERS}" QtXmlPatterns)
|
||||
katie_generate_public("${XMLPATTERNS_PUBLIC_HEADERS}" QtXmlPatterns)
|
||||
katie_generate_map(QtXmlPatterns Q_XMLPATTERNS_EXPORT)
|
||||
katie_resources(${XMLPATTERNS_SOURCES} ${XMLPATTERNS_HEADERS})
|
||||
katie_setup_flags()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue