2 # Windows HybridCRT targets.
4 # https://github.com/microsoft/WindowsAppSDK/blob/77761e244289fda6b3d5f14c7bded189fed4fb89/docs/Coding-Guidelines/HybridCRT.md
5 # Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
6 # lib and instead linking against the Universal CRT DLL import library. This "Hybrid" linking mechanism is
7 # supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
8 # than they would otherwise be if the CRT, runtime, and STL were all statically linked in.
11 sub remove_from_flags {
12 my ($toRemove, $flags) = @_;
14 $flags =~ s/$toRemove//;
19 "VC-WIN32-HYBRIDCRT" => {
20 inherit_from => [ "VC-WIN32" ],
22 remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd",
23 release => "/MT"))->(@_))
25 lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib",
26 release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")),
28 "VC-WIN64A-HYBRIDCRT" => {
29 inherit_from => [ "VC-WIN64A" ],
31 remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd",
32 release => "/MT"))->(@_))
34 lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib",
35 release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")),