Hi all,
just came across this:
https://www.qt.io/blog/2019/08/01/preco ... ming-cmake
https://gitlab.kitware.com/cmake/cmake/ ... uests/3553
https://cmake.org/cmake/help/git-stage/ ... aders.html
Just started to test it a little bit. The feature i think is very interesting is the reuse of precompiled header in other projects.
Does anyone has also started playing around with this new feature?
What do you think, if we could create one big precompiled header and all other projects are using this. Maybe we can reduce the compile time on windows.
BR Manuel
CMake 3.16 now supports precompiled headers
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
CMake 3.16 now supports precompiled headers
Last edited by Kunda1 on Sun Nov 03, 2019 11:54 am, edited 1 time in total.
Reason: Fixed typo in the thread summary
Reason: Fixed typo in the thread summary
Re: CMake 3.16 now supports precompiled headers
Very interesting.
Since pch is activated for the Windows builds we already have seen a reduction of around 40% which is the same number as provided by your links and that's why I don't expect a considerable reduction.
I don't think that we can reduce the compile time much further because we already use pch for our Windows builds. Our solution is not a general approach as in cmake but tailored for MSVC builds on Windows only.Maybe we can reduce the compile time on windows.
Since pch is activated for the Windows builds we already have seen a reduction of around 40% which is the same number as provided by your links and that's why I don't expect a considerable reduction.
Re: CMake 3.16 now supports precompiled headers
Can someone give me a little help what the cmake functions are doing?
GET_MSVC_PRECOMPILED_SOURCE(....)
Add_MSVC_PRECOMPILED_SOURCE(....)
@Werner, don’t you think we could also reduce the compile size when just using one big precompiled header file for all projects?
GET_MSVC_PRECOMPILED_SOURCE(....)
Add_MSVC_PRECOMPILED_SOURCE(....)
@Werner, don’t you think we could also reduce the compile size when just using one big precompiled header file for all projects?
Re: CMake 3.16 now supports precompiled headers
On travis it may reduce the build process by a a couple of minutes (for local builds it's probably much less). But the problem is that in the various PreCompiled.h files we have module-specific defines and handling them in a single PreCompiled.h is almost impossible. And if we even manage to get it working another major downside would be that as soon as you make a change you end up in re-compiling the whole project -- while for module-specific PCH's you would only rebuild that affected module.
If you create a VS project and manually activate PCH it will activate some special compiler flags for the .cpp files. Therefore it must distinguish between the file the must be built as very first (the PreCompiled.cpp) and all other .cpp files. The ADD_MSVC_PRECOMPILED_HEADER macro just uses the MSVC-specific compiler switches.Can someone give me a little help what the cmake functions are doing?
GET_MSVC_PRECOMPILED_SOURCE can be used if in a CMake file you use a single variable to keep source and header files. Because the compiler switches can only be applied to source files you must extract the source files.
Re: CMake 3.16 now supports precompiled headers
If anybody is prepared to invest the effort on Linux, and share some results, that would be great. As reducing the (GCC) compile time on Travis would help for sure. And nice set of links by the way. For example on Linux ccache is commonly used and the hint about the need to set up ccache sloppiness:
https://ccache.dev/manual/latest.html#_ ... ed_headers
Is useful.
https://ccache.dev/manual/latest.html#_ ... ed_headers
Is useful.
Re: CMake 3.16 now supports precompiled headers
Thanks for the explanation...wmayer wrote: ↑Sun Nov 03, 2019 7:29 pm If you create a VS project and manually activate PCH it will activate some special compiler flags for the .cpp files. Therefore it must distinguish between the file the must be built as very first (the PreCompiled.cpp) and all other .cpp files. The ADD_MSVC_PRECOMPILED_HEADER macro just uses the MSVC-specific compiler switches.
GET_MSVC_PRECOMPILED_SOURCE can be used if in a CMake file you use a single variable to keep source and header files. Because the compiler switches can only be applied to source files you must extract the source files.