summaryrefslogtreecommitdiffstats
path: root/Configurations
diff options
context:
space:
mode:
authorklaus triendl <klaus@triendl.eu>2023-01-19 14:14:48 +0200
committerPauli <pauli@openssl.org>2023-03-15 08:49:40 +1100
commit18891efdf4813547bc4e5b3791ac7af72fa277c8 (patch)
tree1a70b7a1a348e2d6f752c99f5d5b9f1d8400ac70 /Configurations
parent9191dfb0ef48f95002aecfa8e11d9db434b4093d (diff)
Added 'hybrid CRT' targets for the Windows platform
Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20081)
Diffstat (limited to 'Configurations')
-rw-r--r--Configurations/50-win-hybridcrt.conf36
1 files changed, 36 insertions, 0 deletions
diff --git a/Configurations/50-win-hybridcrt.conf b/Configurations/50-win-hybridcrt.conf
new file mode 100644
index 0000000000..2ddd25a42a
--- /dev/null
+++ b/Configurations/50-win-hybridcrt.conf
@@ -0,0 +1,36 @@
+## -*- mode: perl; -*-
+# Windows HybridCRT targets.
+#
+# https://github.com/microsoft/WindowsAppSDK/blob/77761e244289fda6b3d5f14c7bded189fed4fb89/docs/Coding-Guidelines/HybridCRT.md
+# Link statically against the runtime and STL, but link dynamically against the CRT by ignoring the static CRT
+# lib and instead linking against the Universal CRT DLL import library. This "Hybrid" linking mechanism is
+# supported according to the CRT maintainer. Dynamic linking against the CRT makes the binaries a bit smaller
+# than they would otherwise be if the CRT, runtime, and STL were all statically linked in.
+
+
+sub remove_from_flags {
+ my ($toRemove, $flags) = @_;
+
+ return $flags =~ s/$toRemove//r;
+}
+
+my %targets = (
+ "VC-WIN32-HYBRIDCRT" => {
+ inherit_from => [ "VC-WIN32" ],
+ cflags => sub {
+ remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd",
+ release => "/MT"))->(@_))
+ },
+ lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib",
+ release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")),
+ },
+ "VC-WIN64A-HYBRIDCRT" => {
+ inherit_from => [ "VC-WIN64A" ],
+ cflags => sub {
+ remove_from_flags(qr/\/MDd?\s/, add(picker(debug => "/MTd",
+ release => "/MT"))->(@_))
+ },
+ lflags => add(picker(debug => "/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib",
+ release => "/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")),
+ },
+);