summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiannis Adamopoulos <johnyadams@outlook.com>2014-10-19 18:03:31 +0300
committerKali Kaneko <kali@leap.se>2014-11-10 23:23:22 +0100
commit18514b5e52d52e1fe87abd2830871e1f3e902f49 (patch)
tree4e7412487ad342046e29238bc1ee92bf3a6d82c5
parente91f1c8b61bab65d19a3169cb9c9d2d2fb84e232 (diff)
Add support for msvc
-rw-r--r--setup.py19
1 files changed, 18 insertions, 1 deletions
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)