开发者

How it's better to add generatable sources files to qmake project?

开发者 https://www.devze.com 2023-04-06 05:48 出处:网络
There is somefile.h.in and script somefile.h.pl which generates number of files like \"somefile.h.gen\" or \"somefile_other.cpp.gen2\".

There is somefile.h.in and script somefile.h.pl which generates number of files like "somefile.h.gen" or "somefile_other.cpp.gen2".

How to add source generation开发者_开发问答 phase in qmake? In plain Makefile I'd just put things like

somefile.o: somefile.cpp somefile.h somefile.h.gen
        ...

soemfile.h.gen: somefile.h.in somefile.h.pl
        ./somefile.h.pl < somefile.h.in # writes somefile.h.gen and friends


I need to use QMAKE_EXTRA_COMPILERS feature:

PREPROCESS_FILES = somefile.h.in
preprocess.name = Generate various files based on somefile.h.in
preprocess.input = PREPROCESS_FILES
preprocess.output = ${QMAKE_FILE_BASE}.gen
preprocess.commands = perl $$PWD/somefile.h.pl $$PWD/somefile.h.in
preprocess.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += preprocess

PRE_TARGETDEPS += somefile.h.gen
0

精彩评论

暂无评论...
验证码 换一张
取 消