From 18514b5e52d52e1fe87abd2830871e1f3e902f49 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 19 Oct 2014 18:03:31 +0300 Subject: Add support for msvc --- setup.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6f2f6cb..a8a2531 100644 --- a/setup.py +++ b/setup.py @@ -180,7 +180,24 @@ class MyBuildExt(build_ext): ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c")) ext.include_dirs.append(AMALGAMATION_ROOT) - ext.extra_link_args.append("-lcrypto") + if sys.platform == "win32": + # Try to locate openssl + openssl_conf = os.environ.get('OPENSSL_CONF') + if not openssl_conf: + sys.exit('Fatal error: OpenSSL could not be detected!') + openssl = os.path.dirname(os.path.dirname(openssl_conf)) + + # Configure the compiler + ext.include_dirs.append(os.path.join(openssl, "include")) + ext.define_macros.append(("inline", "__inline")) + + # Configure the linker + ext.extra_link_args.append("libeay32.lib") + ext.extra_link_args.append( + "/LIBPATH:" + os.path.join(openssl, "lib") + ) + else: + ext.extra_link_args.append("-lcrypto") if self.static: self._build_extension(ext) -- cgit v1.2.3