Skip to content

Commit e3faceb

Browse files
committed
FastDSS: adjust compilation on Windows.
1 parent 0b6159c commit e3faceb

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

dss_build.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ def process_header(src, extern_py=False, implement_py=False, prefix='', flags=No
124124
# loaded without changing LD_LIBRARY_PATH.
125125
if sys.platform == 'linux':
126126
extra['extra_link_args'] = ["-Wl,-R,$ORIGIN/."]
127+
elif sys.platform == 'win32':
128+
# Due to some specifics on Windows, we need to skip the lib included via pragma
129+
python3xx_lib = f"python{sys.version_info.major}{sys.version_info.minor}.lib"
130+
extra['extra_link_args'] = [f"/NODEFAULTLIB:{python3xx_lib}"]
127131

128132
ffi_builders = {}
129133

src/_fastdss.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111
// TODO: enums in int32 and one_int32 results, e.g. LoadModels
1212

1313
#define PY_SSIZE_T_CLEAN
14-
// #define Py_LIMITED_API 0x03070000
14+
1515
#include <string.h>
16+
#ifdef _WIN32
17+
#if defined(_MSC_VER)
18+
#pragma comment(lib, "python3.lib")
19+
#endif
20+
#endif
21+
1622
#include <Python.h>
1723
#include <structmember.h>
1824
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION

0 commit comments

Comments
 (0)