diff --git a/cmake/DtkTools/DtkDBusMacros.cmake b/cmake/DtkTools/DtkDBusMacros.cmake index 9d8b672c..296b24da 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_INCLUDE_ANNOTATIONS) + 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 fe9aa476..c9001654 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;