1## -*- mode: perl; -*- 2# Windows HybridCRT targets. 3# 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. 9 10 11sub remove_from_flags { 12 my ($toRemove, $flags) = @_; 13 14 $flags =~ s/$toRemove//; 15 return $flags; 16} 17 18my %targets = ( 19 "VC-WIN32-HYBRIDCRT" => { 20 inherit_from => [ "VC-WIN32" ], 21 cflags => sub { 22 remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd", 23 release => "/MT"))->(@_)) 24 }, 25 lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib", 26 release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")), 27 }, 28 "VC-WIN64A-HYBRIDCRT" => { 29 inherit_from => [ "VC-WIN64A" ], 30 cflags => sub { 31 remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd", 32 release => "/MT"))->(@_)) 33 }, 34 lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib", 35 release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")), 36 }, 37); 38