Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qmake custom compilers: how to process generated header files with moc
Forum Updated to NodeBB v4.3 + New Features

Qmake custom compilers: how to process generated header files with moc

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 3.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jonjonas68
    wrote on 5 Dec 2012, 14:48 last edited by
    #1

    I've a code generator which generates QObject based classes,
    to use it with qmake I defined a custom compiler (see below).
    Both files were generated correctly, but my problem is, the generated header file should be processed by the moc compiler.
    I cannot figure out how to do this.
    If I try the undocumented config option moc_verify no header files will be generated at all.

    Does anyone know a solution, or is this impossible?

    gen_h.name = generator custom compiler - ${QMAKE_FILE_IN}
    gen_h.input = GEN_INPUT
    gen_h.output = ${QMAKE_FILE_BASE}.h
    gen_h.commands = generator ${QMAKE_FILE_NAME} --outputheader ${QMAKE_FILE_OUT}
    gen_h.CONFIG += target_predeps
    gen_h.dependency_type = TYPE_C
    gen_h.variable_out = HEADERS
    QMAKE_EXTRA_COMPILERS += gen_h

    gen_cpp.name = generator custom compiler - ${QMAKE_FILE_IN}
    gen_cpp.input = GEN_INPUT
    gen_cpp.output = ${QMAKE_FILE_BASE}.cpp
    gen_cpp.commands = generator ${QMAKE_FILE_NAME} --outputimplementation ${QMAKE_FILE_OUT} --include ${QMAKE_FILE_BASE}.h
    gen_cpp.CONFIG += target_predeps
    gen_cpp.dependency_type = TYPE_C
    gen_cpp.variable_out = GENERATED_SOURCES
    QMAKE_EXTRA_COMPILERS += gen_cpp

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZeRaler
      wrote on 12 Mar 2014, 18:32 last edited by
      #2

      I have the same issue.
      Any idea ?

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jonjonas68
        wrote on 14 Mar 2014, 09:58 last edited by
        #3

        From the digia support I've heard, that I should add moc_verify to the CONFIG of the custom compiler.

        gen_cpp.CONFIG += target_predeps moc_verify

        They send me a simple example where it works, but for my concrete pro files it doesn't work.

        So they send me a patch for qmake, which also doesn't help,
        so I'm stuck with this.

        --- a/qmake/generators/makefile.cpp
        +++ b/qmake/generators/makefile.cpp
        @@ -1636,7 +1636,8 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_
        if(project->values(comp + ".CONFIG").indexOf("moc_verify") != -1) {
        if(!file.isNull()) {
        QMakeSourceFileInfo::addSourceFile(file, QMakeSourceFileInfo::SEEK_MOCS);

        •        if(!mocable(file)) {
          
        •        // If it does not exist we assume it will be mocable for now
          
        •        if(QFile::exists(file) && !mocable(file)) {
                     return false;
                 } else {
                     project->values("MOCABLES").append(file);
          
        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZeRaler
          wrote on 14 Mar 2014, 17:12 last edited by
          #4

          Thanks for response,

          I did not have no more success with this.

          I'm still searching for a solution.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved