Skip to content

Commit

Permalink
Fix windows nt loadlibrary problem
Browse files Browse the repository at this point in the history
  • Loading branch information
marco committed Nov 10, 2023
1 parent 56d9599 commit 80593e7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,30 @@ Manual Installation
```

Compile python platform portable whl (no library installation required)

-----------------------------------------------------------------------
## Linux/OSX
```
mkdir build
cd build
cmake -DPORTABLE_PYTHON_PACKAGE=True .. # Linux and OSX
cmake -G "MinGW Makefiles" -DPORTABLE_PYTHON_PACKAGE=True .. # Windows MSYS2/MinGW64
make -j # on Linux
mingw32-make # on Windows
cmake -DCMAKE_BUILD_TYPE=Release -DPORTABLE_PYTHON_PACKAGE=True ..
make -j
cd ../src/python_bindings/
# pip3 debug --verbose to get the compatible tags
OSX: python3 setup.py bdist_wheel --plat-name macosx-14-0-arm64
Linux: python3 setup.py bdist_wheel --plat-name manylinux1_x86_64
Win32: python3 setup.py bdist_wheel --plat-name win_amd64
N.B.: pip3 debug --verbose to get the compatible tags
```

## Windows with MSYS/MinGW64

```
mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DPORTABLE_PYTHON_PACKAGE=True ..
mingw32-make -j
cd ../src/python_bindings/
python3 setup.py bdist_wheel --plat-name win_amd64
python3 setup.py bdist_wheel --plat-name mingw_x86_64
N.B.: pip3 debug --verbose to get the compatible tags
```


Expand Down
2 changes: 2 additions & 0 deletions src/python_bindings/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Create portable Windows python package (MSYS2/Mingw64)
mingw32-make
cd ../src/python_bindings/
python3 setup.py bdist_wheel --plat-name win_amd64
python3 setup.py bdist_wheel --plat-name mingw_x86_64


N.B.: Use pip3 debug --verbose to get the compatible platform name tags

Expand Down
8 changes: 1 addition & 7 deletions src/python_bindings/libscientific/loadlibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ def load_library_for_nt():
"""
try:
lib_path = f'{pathlib.Path(__file__).parent}'
_ = ctypes.CDLL(f'{lib_path}/libgcc_s_seh-1.dll', winmode=0)
_ = ctypes.CDLL(f'{lib_path}/libquadmath-0.dll', winmode=0)
_ = ctypes.CDLL(f'{lib_path}/libgfortran-5.dll', winmode=0)
_ = ctypes.CDLL(f'{lib_path}/libblas.dll', winmode=0)
_ = ctypes.CDLL(f'{lib_path}/libsqlite3-0.dll', winmode=0)
_ = ctypes.CDLL(f'{lib_path}/libwinpthread-1.dll', winmode=0)
return ctypes.CDLL(f'{lib_path}/libscientific.dll', winmode=0)
return ctypes.WinDLL(f'{lib_path}\\libscientific.dll')
except TypeError:
return None

Expand Down

0 comments on commit 80593e7

Please sign in to comment.