Qt Remote Object Compiler as standalone subproject
-
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
TEMPLATE = subdirs SUBDIRS += \ src \ rep src.depends += rep
REPC_SOURCE = base.rep // should be saved in ../src/rep_base_source.h
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?
-
Hi,
I haven't tested it yet but are you sure the header is not generated in the build folder ?
-
@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
-
@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?