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 return $flags =~ s/$toRemove//r;
18 "VC-WIN32-HYBRIDCRT" => {
19 inherit_from => [ "VC-WIN32" ],
21 remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd",
22 release => "/MT"))->(@_))
24 lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib",
25 release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")),
27 "VC-WIN64A-HYBRIDCRT" => {
28 inherit_from => [ "VC-WIN64A" ],
30 remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd",
31 release => "/MT"))->(@_))
33 lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib",
34 release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")),