|
1 | 1 | from setuptools import Extension, setup
|
2 | 2 | import os
|
| 3 | +from os.path import dirname as dname |
| 4 | +from os.path import join as pjoin |
3 | 5 | # import numpy # <-- apparently a big no-no now.
|
4 | 6 | import sys
|
5 | 7 |
|
|
37 | 39 | lSrc = ["src/_das2.c"]
|
38 | 40 |
|
39 | 41 | if sys.platform == 'win32':
|
| 42 | + |
| 43 | + if bLinkStatic: # currently a synonym for not-conda |
| 44 | + # A windows hack, since we're not allowed to import numpy |
| 45 | + # inside setup.py. Any help on gitting rid of this hack |
| 46 | + # would be highly appreciated |
| 47 | + sPyDir = dname(sys.executable) |
| 48 | + lInc.append( |
| 49 | + pjoin(sPyDir, "lib", "site-packages", "numpy", "core", "include") |
| 50 | + ) |
| 51 | + |
| 52 | + sVcRoot = os.getenv("VCPKG_ROOT") |
| 53 | + if sVcRoot: |
| 54 | + sVcLibDir = pjoin(sVcRoot, "installed","x64-windows-static","lib") |
| 55 | + sVcIncDir = pjoin(sVcRoot, "installed","x64-windows-static","include") |
| 56 | + else: |
| 57 | + # With no other input, assume it's next door |
| 58 | + sVcLibDir = "..\\vcpkg\\installed\\x64-windows-static\\lib" |
| 59 | + sVcIncDir = "..\\vcpkg\\installed\\x64-windows-static\\include" |
| 60 | + |
| 61 | + print('(setup.py) VCPKG_LIBDIR = %s'%sVcLibDir) |
| 62 | + |
| 63 | + lLibDirs.append( sVcLibDir ) |
| 64 | + lInc.append( sVcIncDir ) |
| 65 | + lExObjs = ['%s/libdas2.3.lib'%sCLibDir] |
| 66 | + lLibs = [ |
| 67 | + "fftw3", "libexpatMD", "libssl", "libcrypto", "Advapi32", |
| 68 | + "User32", "Crypt32", "zlib", "pthreadVC3", "ws2_32" |
| 69 | + ] |
| 70 | + else: |
| 71 | + # Anaconda will setup the lib directories for us, but still |
| 72 | + # link das2C statically. Also anaconda and vcpkg use different |
| 73 | + # names for expaxt library |
| 74 | + lExObjs = ['%s/libdas2.3.lib'%sCLibDir] |
| 75 | + lLibs = [ |
| 76 | + "fftw3", "expat", "libssl", "libcrypto", |
| 77 | + "zlib", "pthreadVC3", "ws2_32" |
| 78 | + ] |
| 79 | + |
40 | 80 | print("setup.py: Using Headers from %s"%lInc)
|
41 | 81 | print("setup.py: Using Libs from %s"%lLibDirs)
|
| 82 | + |
42 | 83 | ext = Extension(
|
43 | 84 | "_das2"
|
44 | 85 | ,sources=lSrc
|
45 | 86 | ,include_dirs=lInc
|
46 | 87 | ,define_macros=lDefs
|
47 | 88 | ,library_dirs=lLibDirs
|
48 |
| - ,libraries=[ |
49 |
| - "libdas2.3", "fftw3", "expat", "libssl", "libcrypto", |
50 |
| - "zlib", "pthreadVC3", "ws2_32" |
51 |
| - ] |
52 |
| - ,extra_objects=['%s/libdas2.3.a'%sCLibDir] |
| 89 | + ,libraries=lLibs |
| 90 | + ,extra_objects=lExObjs |
53 | 91 | )
|
54 | 92 | elif sys.platform == 'darwin':
|
55 | 93 |
|
|
0 commit comments