[CMake] Parallel moc for Qt files

Konstantin Tokarev annulen at yandex.ru
Fri Jul 7 07:27:14 EDT 2017



06.07.2017, 23:00, "Michael Jackson" <mike.jackson at bluequartz.net>:
> I have a large list of files that need to have Qt's 'moc' run on them
> (107 headers). I use all the normal CMake facilities for Qt based
> projects. I noticed that the generation of the moc files are done
> serially. Is there a flag or anything that I can use to run the
> generation in Parallel? I ask because each file takes about 3 seconds to
> run through moc. The code is heavily C++ templated which I think causes
> 'moc' to run more slowly. We have other places in the code where 'moc'
> must run and it does each file in the "blink of an eye".

Replace use of AUTOMOC with macros like qt5_generate_moc. Each moc file
will be generated by a separate custom command.

For example, I wrote 3 macros that wrap qt5_generate_moc for more
convenience [1], example usage is at [2].

[1] https://github.com/annulen/webkit/blob/qtwebkit-stable/Source/cmake/OptionsQt.cmake#L63
[2] https://github.com/annulen/webkit/blob/qtwebkit-stable/Source/WebCore/PlatformQt.cmake#L165

>
> Just curious.
>
> --
> Michael A. Jackson
> BlueQuartz Software, LLC
> [e]: mike.jackson at bluequartz.net
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

-- 
Regards,
Konstantin


More information about the CMake mailing list