Skip to content

Conversation

pow2clk
Copy link
Collaborator

@pow2clk pow2clk commented Oct 17, 2023

A slightly complex series of events causes invocations of hctbuild after the first to enable asserts in release builds. This sets the build type even when it isn't needed to avoid it.

Because the build type was not being set when generating for visual studio in hctbuild, when generating the cmake files using CMakeLists, it would produce an alarming message saying it was defaulting to debug, but, in fact, since it didn't care for the purposes of sln file generation, that wasn't actually a problem, just confusing. It did set a variable to enable asserts, but didn't do this for release variant builds

The real problem occurs if hctbuild is invoked again, at that point, instead of defaulting to Debug, it leaves the build type empty because of another variable set in the cache.

Additionally, since the first invocation enabled asserts, that also comes from the cache and so code that strips NDEBUG from all build variants is invoked because the build type is, in fact, not debug, it's an empty string.

A slightly complex series of events causes invocations of hctbuild after the first to enable asserts in release builds. This sets the build type even when it isn't needed to avoid it. Because the build type was not being set when generating for visual studio in hctbuild, when generating the cmake files using CMakeLists, it would produce an alarming message saying it was defaulting to debug, but, in fact, since it didn't care for the purposes of sln file generation, that wasn't actually a problem, just confusing. It did set a variable to enable asserts, but didn't do this for release variant builds The real problem occurs if hctbuild is invoked again, at that point, instead of defaulting to Debug, it leaves the build type empty because of another variable set in the cache. Additionally, since the first invocation enabled asserts, that also comes from the cache and so code that strips NDEBUG from all build variants is invoked because the build type is, in fact, not debug, it's an empty string.
@pow2clk pow2clk enabled auto-merge (squash) October 17, 2023 18:04
@pow2clk pow2clk merged commit a56078a into microsoft:main Oct 17, 2023
@pow2clk pow2clk deleted the fix-hctbuild branch October 18, 2023 15:10
pow2clk pushed a commit to pow2clk/DirectXShaderCompiler that referenced this pull request Oct 18, 2023
The previous PR microsoft#5881 didn't do what it meant to and had a lot of debug code due to a mistaken commit. This reverts that commit and restores the setting of the build type flag
message(CMAKE_BUILD_TYPE0!!!!!="${CMAKE_BUILD_TYPE}")
message(CMAKE_CONFIGURATION_TYPES!!!!!="${CMAKE_CONFIGURATION_TYPES}")
message(CMAKE_CXX_FLAGS_RELEASE!!!!!="${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_STANDARD 17)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave all these messages in?

pow2clk pushed a commit that referenced this pull request Oct 18, 2023
The previous PR #5881 didn't do what it meant to and had a lot of debug code due to a mistaken commit. This reverts that commit and restores the setting of the build type flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants