Skip to content

Commit 72c592f

Browse files
bmehta001Copilot
andcommitted
Document zlib-ng compat mode as optional optimization
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f4043a7 commit 72c592f

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎docs/building-with-vcpkg.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,35 @@ Windows, macOS/iOS, and Android use platform-native HTTP clients (WinInet,
110110
NSURLSession, and HttpClient_Android respectively), so curl is not required
111111
on those platforms.
112112

113+
## Optional: SIMD-Optimized zlib with zlib-ng
114+
115+
The vcpkg port depends on stock `zlib` by default. If you want SIMD-optimized
116+
compression (Intel PCLMULQDQ/AVX2, ARM NEON, etc.), you can transparently
117+
replace zlib with [zlib-ng](https://github.com/zlib-ng/zlib-ng) in
118+
compatibility mode. No changes to the port or SDK code are needed.
119+
120+
**Add one line to your vcpkg triplet file** (e.g., `x64-windows-static.cmake`):
121+
122+
```cmake
123+
set(ZLIB_COMPAT ON)
124+
```
125+
126+
Then install `zlib-ng` instead of `zlib`:
127+
128+
```console
129+
vcpkg install zlib-ng mstelemetry --triplet=x64-windows-static
130+
```
131+
132+
With `ZLIB_COMPAT=ON`, zlib-ng installs as a drop-in replacement — it provides
133+
the same `zlib.h` header, the same function names (`deflate`, `inflate`,
134+
`crc32`), and the same `ZLIB::ZLIB` CMake target. All packages that depend on
135+
`zlib` (including `mstelemetry` and any other libraries like `onnxruntime`)
136+
will automatically use the optimized zlib-ng build.
137+
138+
> **Important:** All libraries in the same binary should link against the same
139+
> zlib. When using `ZLIB_COMPAT=ON`, ensure all dependencies resolve to
140+
> zlib-ng rather than mixing stock zlib and zlib-ng.
141+
113142
## How It Works: MATSDK_USE_VCPKG_DEPS
114143

115144
When the SDK detects it is being built via vcpkg (by checking for

0 commit comments

Comments
 (0)