Page MenuHomePhabricator

Add possibility to add MOC generated files as header only
Closed, ResolvedPublic


At the moment header files that need to be moc'ed are set in the MOC_H_FILES variable. Those files are moc'ed via the qtX_wrap_cpp macro and then added as normal cpp files to the target. They are treated and compiled as separate translation units, which means the generated MOC file and the normal class file are compiled separately creating two obj files which must be linked together. This can cause a lot of overhead while compiling large projects with huge amounts of MOC generated files.

Another solution to handle MOC files is to generate them and add them as "header only" files to the target, so they won't get compiled separately. You can then include them in the class files cpp to build them. This only creates one obj file. This can decrease build time significantly.

I propose to add an optional parameter to the mitk_create_module and mitk_create_executable macros to make it possible to generate MOC files via the MOC_H_FILES variable but add them as header only. Users have then the opportunity to choose how they want to handle MOC files.

Event Timeline

User tweihs has pushed new remote branch: