-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile CalcManager project with or without precompiled headers #436
Compile CalcManager project with or without precompiled headers #436
Conversation
…se pch through forced inclusion of the header.
This is great! I'll check GCC and clang builds and leave my review at some point today. Many thanks for implementing my idea. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExpressionCommandInterface.h
is not part of the diff, hence I can't comment there, but:
diff --git a/src/CalcManager/ExpressionCommandInterface.h b/src/CalcManager/ExpressionCommandInterface.h
index ce89dd8..cc80745 100644
--- a/src/CalcManager/ExpressionCommandInterface.h
+++ b/src/CalcManager/ExpressionCommandInterface.h
@@ -4,6 +4,7 @@
#pragma once
#include "CalculatorVector.h"
#include "Command.h"
+#include <memory> // for std::shared_ptr
class ISerializeCommandVisitor;
@janisozaur, how are you identifying these extra header dependencies? I rebased my branch on top of #211 and I was able to build with CMake/Clang with no problems. |
GCC/libstdc++ and lots of time spent on writing code for the trinity of compilers. |
I see. I don't have GCC set up so I can't verify your changes right now. I'll have to trust you :) |
Second suggestion.. How do you feel about taking this change so we can unblock #211, then we can add onto it to support GCC? |
It must've been transitively included via other file. I don't claim this is exhaustive, but it works in my case. Of you find any more missing headers, I'd suggest you include them. I might spend more time on that in the future. It's not really blocking #211 in my opinion, but I can see how having this merged first would lead to having nicer history. |
Co-Authored-By: danbelcher-MSFT <[email protected]>
Co-Authored-By: danbelcher-MSFT <[email protected]>
Co-Authored-By: danbelcher-MSFT <[email protected]>
Co-Authored-By: danbelcher-MSFT <[email protected]>
Co-Authored-By: danbelcher-MSFT <[email protected]>
Co-Authored-By: danbelcher-MSFT <[email protected]>
@janisozaur, can you take a second look? I tried requesting your review again through GitHub but the 'refresh' button doesn't seem to be working for me right now. Sorry if I spammed you with notifications! @mcooley, I need your review so I can merge. |
Sure, I'll re-review. |
@janisozaur, I'm ready to merge this change now. I took your suggestions without a way to validate with GCC. If you find that I broke something, feel free to comment on this PR or supply a fix. |
…osoft#436) Fixes microsoft#324 . Description of the changes: In an effort to support other compilers (microsoft#109), this change reworks how precompiled headers are handled. For toolchains where precompiled headers are not used, there is unnecessary compilation cost because each source file explicity includes the pch, meaning all system headers in the pch were recompiled for each translation unit. This change modifies the project's files so that each translation unit includes a minimal set of dependent headers. For MSVC users, the precompiled headers option is still enabled and the precompiled header is added to each translation unit using the compiler's Forced Includes option. The end result is that MSVC users still see the same build times, but other toolchains are free to use or not use precompiled headers. Risks introduced Given that our CI build uses MSVC, this change introduces the risk that a system header is added to the pch and the CalcManager project builds correctly, but builds could be broken for other toolsets that don't use pch. We know we want to add support for Clang in our CI build (microsoft#211). It seems reasonable to also compile without precompiled headers there so that we can regression test this setup. How changes were validated: Rebuild CalcManager project. Compile time: ~4.5s. Disable precompiled headers, keeping explicit include for pch in each source file. Compile time: ~13s. Remove explicit pch inclusion and add the appropriate headers to each translation unit to allow the project to compile. Compile time: ~8s. Re-enable pch and include it using the Forced Includes compiler option. MSVC compile time: ~4.5s. Minor changes Delete 'targetver.h'. I found this while looking around for system headers in the project. It's unused and unreferenced so let's remove it.
Fixes #324 .
Description of the changes:
In an effort to support other compilers (#109), this change reworks how precompiled headers are handled. For toolchains where precompiled headers are not used, there is unnecessary compilation cost because each source file explicity includes the pch, meaning all system headers in the pch were recompiled for each translation unit. This change modifies the project's files so that each translation unit includes a minimal set of dependent headers. For MSVC users, the precompiled headers option is still enabled and the precompiled header is added to each translation unit using the compiler's Forced Includes option. The end result is that MSVC users still see the same build times, but other toolchains are free to use or not use precompiled headers.
Risks introduced
Given that our CI build uses MSVC, this change introduces the risk that a system header is added to the pch and the CalcManager project builds correctly, but builds could be broken for other toolsets that don't use pch. We know we want to add support for Clang in our CI build (#211). It seems reasonable to also compile without precompiled headers there so that we can regression test this setup.
How changes were validated:
~4.5s
.~13s
.~8s
.~4.5s
.Minor changes