Custom Build Step
Solved
General and Desktop
-
Hello,
I built the repc (https://doc.qt.io/qt-6/qtremoteobjects-repc.html) from sources with some adjustments needed for my project.
Now I want to invoke repc.exe on all repc-qualified files (.rep files) when building.
How can I do that
-
Solution:
.qmake.confOUT_ROOT=$$shadowed($$PWD) # Build rep_class_source.h with customized repc c_repc_source.output = rep_${QMAKE_FILE_BASE}_source.h c_repc_source.commands = $$OUT_ROOT/bin/repc -i rep -o source ${QMAKE_FILE_NAME} rep_${QMAKE_FILE_BASE}_source.h c_repc_source.input = C_REPC_SOURCE QMAKE_EXTRA_COMPILERS += c_repc_source # Build rep_class_replica.h with customized repc c_repc_replica.output = rep_${QMAKE_FILE_BASE}_replica.h c_repc_replica.commands = $$OUT_ROOT/bin/repc -i rep -o replica ${QMAKE_FILE_NAME} rep_${QMAKE_FILE_BASE}_replica.h c_repc_replica.input = C_REPC_REPLICA QMAKE_EXTRA_COMPILERS += c_repc_replica
usage
C_REPC_SOURCE += \ ExampleClass/ExampleClass.rep \ C_REPC_REPLICA += \ ExampleClass/ExampleClass.rep \
-
Solution:
.qmake.confOUT_ROOT=$$shadowed($$PWD) # Build rep_class_source.h with customized repc c_repc_source.output = rep_${QMAKE_FILE_BASE}_source.h c_repc_source.commands = $$OUT_ROOT/bin/repc -i rep -o source ${QMAKE_FILE_NAME} rep_${QMAKE_FILE_BASE}_source.h c_repc_source.input = C_REPC_SOURCE QMAKE_EXTRA_COMPILERS += c_repc_source # Build rep_class_replica.h with customized repc c_repc_replica.output = rep_${QMAKE_FILE_BASE}_replica.h c_repc_replica.commands = $$OUT_ROOT/bin/repc -i rep -o replica ${QMAKE_FILE_NAME} rep_${QMAKE_FILE_BASE}_replica.h c_repc_replica.input = C_REPC_REPLICA QMAKE_EXTRA_COMPILERS += c_repc_replica
usage
C_REPC_SOURCE += \ ExampleClass/ExampleClass.rep \ C_REPC_REPLICA += \ ExampleClass/ExampleClass.rep \
-
-
Absolutely! To run repc.exe on all .rep files during builds, add a custom step in your project config. Utilize the relevant build system (e.g., CMake or qmake) to integrate repc.exe with the needed options for .rep file processing, ensuring automatic execution in each build.