diff --git a/setup_crypto.py b/setup_crypto.py index e533f40a1..ab316b106 100644 --- a/setup_crypto.py +++ b/setup_crypto.py @@ -1,6 +1,9 @@ # Support code for building a C extension with crypto code import os +import sys + +is_win32 = sys.platform.startswith('win32') def multi_join(paths, *path_segments): @@ -11,9 +14,16 @@ def multi_join(paths, *path_segments): def crypto_ext_kwargs(pc, system_prefix): if system_prefix: print('Detected OpenSSL [via BORG_OPENSSL_PREFIX]') + if is_win32: + lib_dir = system_prefix + lib_name = 'libcrypto' + else: + lib_dir = os.path.join(system_prefix, 'lib') + lib_name = 'crypto' + return dict(include_dirs=[os.path.join(system_prefix, 'include')], - library_dirs=[os.path.join(system_prefix, 'lib')], - libraries=['crypto']) + library_dirs=[lib_dir], + libraries=[lib_name]) if pc and pc.exists('libcrypto'): print('Detected OpenSSL [via pkg-config]')