Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkcore
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkcore.

Source-pull-request: linuxdeepin/dtkcore#394
  • Loading branch information
deepin-ci-robot committed Nov 24, 2023
1 parent 5765b65 commit 7946563
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions cmake/DtkTools/DtkDBusMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
13 changes: 10 additions & 3 deletions tools/qdbusxml2cpp/qdbusxml2cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -56,6 +57,7 @@ static const char help[] =
" -N Don't use namespaces\n"
" -p <filename> Write the proxy code to <filename>\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"
Expand Down Expand Up @@ -158,6 +160,9 @@ static void parseCmdLine(QStringList args)
case 'N':
skipNamespaces = true;
break;
case 'S':
skipIncludeAnnotations = true;
break;

case '?':
case 'h':
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7946563

Please sign in to comment.