From 79465637bd0e0fc41f3ef6973e0ad275a19db217 Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Fri, 24 Nov 2023 03:44:06 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkcore Synchronize source files from linuxdeepin/dtkcore. Source-pull-request: https://github.com/linuxdeepin/dtkcore/pull/394 --- cmake/DtkTools/DtkDBusMacros.cmake | 5 +++++ tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/cmake/DtkTools/DtkDBusMacros.cmake b/cmake/DtkTools/DtkDBusMacros.cmake index 9d8b672..b677dbf 100644 --- a/cmake/DtkTools/DtkDBusMacros.cmake +++ b/cmake/DtkTools/DtkDBusMacros.cmake @@ -33,6 +33,11 @@ function(dtk_add_dbus_interface _sources _interface _relativename) set(_params -m) endif() + get_source_file_property(_skipincludeannotations ${_interface} SKIP_INCLUDEANNOTATIONS) + if(_skipincludeannotations) + set(_params ${_params} -S) + endif() + get_source_file_property(_classname ${_interface} CLASSNAME) if(_classname) set(_params ${_params} -c ${_classname}) diff --git a/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index fe9aa47..c900165 100644 --- a/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -38,6 +38,7 @@ static QString inputFile; static bool skipNamespaces; static bool verbose; static bool includeMocs; +static bool skipIncludeAnnotations; static QString commandLine; static QStringList includes; static QStringList wantedInterfaces; @@ -56,6 +57,7 @@ static const char help[] = " -N Don't use namespaces\n" " -p Write the proxy code to \n" " -v Be verbose.\n" + " -S Skip include annotation headers from \"types/\".\n" " -V Show the program version and quit.\n" "\n" "If the file name given to the options -a and -p does not end in .cpp or .h, the\n" @@ -158,6 +160,9 @@ static void parseCmdLine(QStringList args) case 'N': skipNamespaces = true; break; + case 'S': + skipIncludeAnnotations = true; + break; case '?': case 'h': @@ -625,9 +630,11 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf } } - for (const QString &annotation : annotations) { - if (annotation.indexOf('<') == -1) { - hs << "#include \"types/" << annotation.toLower() << ".h\"" << endl; + if (!skipIncludeAnnotations) { + for (const QString &annotation : annotations) { + if (annotation.indexOf('<') == -1) { + hs << "#include \"types/" << annotation.toLower() << ".h\"" << endl; + } } } hs << endl;