Skip to contentSkip to conversation

vcpkg: link lzo statically

PATCH In review Lev Stipakov 2 participants 2 messages Feb 16, 2022 – Feb 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vcpkg: link lzo statically

From: Lev Stipakov <[email protected]...>

Having .dll for a single executable doesn't make
much sense. Static linking removes 117kb .dll
and grows .exe size by only 4kb.

---
 contrib/vcpkg-triplets/arm64-windows-ovpn.cmake | 3 ++-
 contrib/vcpkg-triplets/x64-windows-ovpn.cmake   | 3 ++-
 contrib/vcpkg-triplets/x86-windows-ovpn.cmake   | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
contrib/vcpkg-triplets/arm64-windows-ovpn.cmake +2 -1
index dd3c6c0a..dc600056 100644
@@ -2,6 +2,7 @@ set(VCPKG_TARGET_ARCHITECTURE arm64)
 set(VCPKG_CRT_LINKAGE dynamic)
 set(VCPKG_LIBRARY_LINKAGE dynamic)
 
-if(PORT STREQUAL "lz4")
+set(STATIC_PORTS lz4 lzo)
+if(PORT IN_LIST STATIC_PORTS)
     set(VCPKG_LIBRARY_LINKAGE static)
 endif()
contrib/vcpkg-triplets/x64-windows-ovpn.cmake +2 -1
index 7036ed2d..76e5cd55 100644
@@ -2,6 +2,7 @@ set(VCPKG_TARGET_ARCHITECTURE x64)
 set(VCPKG_CRT_LINKAGE dynamic)
 set(VCPKG_LIBRARY_LINKAGE dynamic)
 
-if(PORT STREQUAL "lz4")
+set(STATIC_PORTS lz4 lzo)
+if(PORT IN_LIST STATIC_PORTS)
     set(VCPKG_LIBRARY_LINKAGE static)
 endif()
contrib/vcpkg-triplets/x86-windows-ovpn.cmake +2 -1
index 7d3bf340..643d7bdd 100644
@@ -2,6 +2,7 @@ set(VCPKG_TARGET_ARCHITECTURE x86)
 set(VCPKG_CRT_LINKAGE dynamic)
 set(VCPKG_LIBRARY_LINKAGE dynamic)
 
-if(PORT STREQUAL "lz4")
+set(STATIC_PORTS lz4 lzo)
+if(PORT IN_LIST STATIC_PORTS)
     set(VCPKG_LIBRARY_LINKAGE static)
 endif()
Signature · 1 line
2.23.0.windows.1
Acked-by on v1 1/1
#1 lore raw

That came out of the "shouldn't we simplify our build scripts to make lz4 dynamic"... turns out that dynamic libs used by a single binary only are particulary inefficient here. Thus, going the other way :)

I have not tested this, just looked at it, and it looks reasonable (and affects only .cmake stuff)

Your patch has been applied to the master branch.

commit cac1ebd859e9d60642d2375a2c0bdacac35ca12c (master) commit eded6a32edcb7d4378140fcbf984fae4d8735029 (release/2.5)

Author: Lev Stipakov
Date:   Wed Feb 16 15:42:27 2022 +0200
     vcpkg: link lzo statically

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23807.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering