Skip to content

Commit 63a86c4

Browse files
committed
chore: win fix
1 parent f75b938 commit 63a86c4

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

.github/workflows/_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
- name: Install dependencies via vcpkg (Windows)
8989
if: runner.os == 'Windows'
9090
run: |
91-
vcpkg install openssl:x64-windows nghttp2:x64-windows --clean-after-build
91+
vcpkg install openssl:x64-windows nghttp2:x64-windows zlib:x64-windows --clean-after-build
9292
shell: bash
9393

9494
- name: Cache vendor dependencies

setup.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,36 @@ def get_library_paths():
253253
"nghttp2_lib": nghttp2_lib,
254254
}
255255

256+
elif IS_WINDOWS:
257+
# Windows - use vcpkg if available, otherwise default paths
258+
import os
259+
260+
vcpkg_root = os.environ.get("VCPKG_ROOT", "C:/vcpkg")
261+
vcpkg_installed = Path(vcpkg_root) / "installed" / "x64-windows"
262+
263+
if vcpkg_installed.exists():
264+
print(f"Using vcpkg dependencies from: {vcpkg_installed}")
265+
return {
266+
"openssl_include": str(vcpkg_installed / "include"),
267+
"openssl_lib": str(vcpkg_installed / "lib"),
268+
"nghttp2_include": str(vcpkg_installed / "include"),
269+
"nghttp2_lib": str(vcpkg_installed / "lib"),
270+
}
271+
else:
272+
# Fall back to default paths
273+
return {
274+
"openssl_include": "C:/Program Files/OpenSSL/include",
275+
"openssl_lib": "C:/Program Files/OpenSSL/lib",
276+
"nghttp2_include": "C:/Program Files/nghttp2/include",
277+
"nghttp2_lib": "C:/Program Files/nghttp2/lib",
278+
}
256279
else:
257-
# Windows or other platforms - use default system paths
280+
# Other platforms - use default system paths
258281
return {
259-
"openssl_include": "C:/Program Files/OpenSSL/include",
260-
"openssl_lib": "C:/Program Files/OpenSSL/lib",
261-
"nghttp2_include": "C:/Program Files/nghttp2/include",
262-
"nghttp2_lib": "C:/Program Files/nghttp2/lib",
282+
"openssl_include": "/usr/include",
283+
"openssl_lib": "/usr/lib",
284+
"nghttp2_include": "/usr/include",
285+
"nghttp2_lib": "/usr/lib",
263286
}
264287

265288

@@ -273,6 +296,12 @@ def get_library_paths():
273296
print(f" nghttp2 lib: {LIB_PATHS['nghttp2_lib']}")
274297
print()
275298

299+
# Platform-specific compile args for extensions
300+
if IS_WINDOWS:
301+
EXT_COMPILE_ARGS = ["/O2", "/DHAVE_NGHTTP2"]
302+
else:
303+
EXT_COMPILE_ARGS = ["-std=c11", "-O2", "-DHAVE_NGHTTP2"]
304+
276305
# Define C extension modules
277306
extensions = [
278307
# Main httpmorph C extension
@@ -296,7 +325,7 @@ def get_library_paths():
296325
LIB_PATHS["nghttp2_lib"],
297326
],
298327
libraries=["ssl", "crypto", "nghttp2", "z"],
299-
extra_compile_args=["-std=c11", "-O2", "-DHAVE_NGHTTP2"], # HTTP/2 enabled with EOF fix
328+
extra_compile_args=EXT_COMPILE_ARGS,
300329
language="c",
301330
),
302331
# HTTP/2 client extension
@@ -316,7 +345,7 @@ def get_library_paths():
316345
LIB_PATHS["nghttp2_lib"],
317346
],
318347
libraries=["ssl", "crypto", "nghttp2", "z"],
319-
extra_compile_args=["-std=c11", "-O2"],
348+
extra_compile_args=EXT_COMPILE_ARGS if IS_WINDOWS else ["-std=c11", "-O2"],
320349
language="c",
321350
),
322351
]

0 commit comments

Comments
 (0)