[SYCL][UR][CMake] Stop creating debug library builds on Windows during release builds
Currently the SYCL library and its constituents build both a release build and a debug build (/MDd) on Windows, no matter what the build type is. This PR changes the build to only build in the mode specified by the CMAKE_BUILD_TYPE, meaning that packaging of release builds must build both explicitly and copy the files into the packages.
To allow parity with old builds, the -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL can be used during configuration to use the debug UCRT in release mode, generating "d"-suffixed libraries. This can also be controlled in the configure.py script using the --use-debug-crt-dll option.
Additionally, this PR adds a new test that checks that library files in build mode all have the required postfix ("d" or "d-preview") when they link with Windows debug URCT, and the release variant if not.
I believe we are ready to consider this, so I've moved it to ready-for-review.
I don't think that
Currently the SYCL library and its constituents build both a release build and a debug build (/MDd) on Windows, no matter what the build type is.
is accurate. IMO, it's more like 4 configurations:
- release build with release C/C++ runtime
- debug build with debug C/C++ runtime
- Optimized/possibly stripped "release-like" build with debug C/C++ runtime (and
/MDdwould imply-D_DEBUGand-UNDEBUG, but whatever). - non-optimized/non-stripped "debug-like" without MSVC's
_DEBUGand linked with C/C++ runtime (most useless one).
I think before this we could ship 1 and 3, but after this I'm afraid we'd have to ship 1 and 2 and I'm really not sure if we want this. Am I missing anything?
I don't think that
Currently the SYCL library and its constituents build both a release build and a debug build (/MDd) on Windows, no matter what the build type is.
is accurate. IMO, it's more like 4 configurations:
- release build with release C/C++ runtime
- debug build with debug C/C++ runtime
- Optimized/possibly stripped "release-like" build with debug C/C++ runtime (and
/MDdwould imply-D_DEBUGand-UNDEBUG, but whatever).- non-optimized/non-stripped "debug-like" without MSVC's
_DEBUGand linked with C/C++ runtime (most useless one).I think before this we could ship 1 and 3, but after this I'm afraid we'd have to ship 1 and 2 and I'm really not sure if we want this. Am I missing anything?
Correct. The configurations are not exactly 1:1. I believe our current d-suffixed approach doesn't follow the rest of the libraries out there. That said, release builds can enable optimizations on top of debug mode. Maybe we should include RelWithDebugInfo as enabling /MDd too?
Alternatively, I can add an option that enables debug UCRT for the current build, which releases can use.