Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Remote Object Compiler as standalone subproject

Qt Remote Object Compiler as standalone subproject

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 461 Views
  • 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.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by beecksche
    #1

    Hi,
    I want to use the QtRO Compiler (repc) in a subproject, which only generates the header file based on a .rep file. This generated file is further used in a library (src).

    I think of such a setup

    library.pro:

    TEMPLATE = subdirs
    
    SUBDIRS += \
            src \
            rep 
    
    src.depends += rep
    

    rep.pro:

    REPC_SOURCE = base.rep
    
    // should be saved in ../src/rep_base_source.h
    

    src.pro

    TEMPLATE = lib
    ...
    HEADERS += rep_base_source.h
    ...
    

    The problem is, that it's not working. I have no clue what to add to the rep.pro file to generate the file and save it to the correct directory. Or is this even the wrong approach?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I haven't tested it yet but are you sure the header is not generated in the build folder ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        @beecksche said in Qt Remote Object Compiler as standalone subproject:

        REPC_SOURCE = base.rep

        // should be saved in ../src/rep_base_source.h

        With the rep.pro file presented, this will fail for want of main() because the default TEMPLATE is app. There does not seem to be a qmake TEMPLATE to just build the REPC stuff. In any case, the result would be in the rep folder, not the src folder.

        Perhaps you want to take the rep directory out of the top PRO file and in src.pro either add:

        REPC_SOURCE += ../rep/base.rep
        

        and do nothing with HEADERS, or

        include(../rep/rep.pri)
        

        and then in rep/rep.pri:

        REPC_SOURCE += $${PWD}/base.rep
        
        1 Reply Last reply
        1
        • beeckscheB Offline
          beeckscheB Offline
          beecksche
          wrote on last edited by beecksche
          #4

          @SGaist unfortunately yes. The QtRO compiler with REPC_SOURCE or REPC_REPLICA variables in the .pro file is only running when building the project.

          @ChrisW67 i try to seperate the two building processes (repc and library building).

          I found a way by calling the repc explicity with system(...) in rep.pro:

          TEMPLATE = aux
          
          DISTFILES = base.rep #to show and edit in project tree
          
          SRC_HEADER = ../src/src_base.h
          REP_HEADER = ../src/rep_base.h
          
          system($$(QTDIR)/bin/repc.exe -i rep -o source  $$DISTFILES $$SRC_HEADER)
          system($$(QTDIR)/bin/repc.exe -i rep -o replica $$DISTFILES $$REP_HEADER)
          

          This creates the source and replica headers while qmake-ing the project. A not so critical but annoying problem is now, that the repc is called multiple times and so the headers are created multiple times aswell for one qmake call. Do you know a directive so that the pro file is executed only once?

          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