-
Notifications
You must be signed in to change notification settings - Fork 141
build(cmake): Move all CppMacros.h includes into precompiled headers #2086
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
base: main
Are you sure you want to change the base?
build(cmake): Move all CppMacros.h includes into precompiled headers #2086
Conversation
|
Unfortunately Debug particleeditors will suddenly fail to compile for no apparent reason. Chat points to libci.lib but I was not able to resolve it by removing all suppressions ( |
| if (pobject) { \ | ||
| delete [] pobject; \ | ||
| pobject = NULL; \ | ||
| } \ |
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.
This magically failed to compile for no reason so I touched this and then it was fine.
D:\Projects\TheSuperHackers\GeneralsGameCode\Core\Tools\WW3D\max2w3d\util.h(113) : fatal error C1004: unexpected end of file found
Code is very strong here...
Analysis of the MFC DLL Linker ErrorThe Root CauseBefore this PR:
After this PR:
The Suggested FixesOption 1: Exclude CRT DllMain stub for MFC tools if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows")
target_link_options(g_particleeditor PRIVATE
/NODEFAULTLIB:libci.lib
/NODEFAULTLIB:libc.lib
)
# Force link order: remove MSVCRTD then re-add it after MFC
set_target_properties(g_particleeditor PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:MSVCRTD.lib /DEFAULTLIB:MSVCRTD.lib")
endif()Option 2: Create a lite version without resources (cleaner) # In Core/CMakeLists.txt
add_library(corei_always_lite INTERFACE)
target_link_libraries(corei_always_lite INTERFACE
core_utility
corei_libraries_include
)
target_precompile_headers(corei_always_lite INTERFACE [["Utility/CppMacros.h"]])Then have Option 3: Don't link gi_always into ParticleEditor Keep ParticleEditor linking individual components it needs, add The core issue is that MFC DLLs and static libraries with CRT dependencies don't mix well due to DllMain conflicts. Option 2 seems cleanest since it preserves your goal of making CppMacros.h available everywhere while avoiding the MFC conflict. |
|
I checked if eliminating Not pushed to this branch. |
oops, just saw it was a draft and didn't compile
This change moves all CppMacros.h includes into precompiled headers.
This way CppMacros.h is made available everywhere with
corei_always,gi_alwaysorzi_always.