diff --git a/lanms/__init__.py b/lanms/__init__.py index 649d6468..44f133eb 100644 --- a/lanms/__init__.py +++ b/lanms/__init__.py @@ -1,11 +1,13 @@ import subprocess import os import numpy as np +import platform BASE_DIR = os.path.dirname(os.path.realpath(__file__)) -if subprocess.call(['make', '-C', BASE_DIR]) != 0: # return value - raise RuntimeError('Cannot compile lanms: {}'.format(BASE_DIR)) +if platform.system() != "Windows": + if subprocess.call(['make', '-C', BASE_DIR]) != 0: # return value + raise RuntimeError('Cannot compile lanms: {}'.format(BASE_DIR)) def merge_quadrangle_n9(polys, thres=0.3, precision=10000): diff --git a/lanms/lanms.cmd b/lanms/lanms.cmd new file mode 100644 index 00000000..a38adf23 --- /dev/null +++ b/lanms/lanms.cmd @@ -0,0 +1,30 @@ +@echo off + +for /f %%i in ('where python') do set python_path=%%i +::set python_path=D:/Python/v3.6.5 +if exist %python_path% ( + set python_dir=%python_path:~0,-11% +) else ( + @echo error: can't found python.exe, please delete "::" and set python_path manually at line 4 + pause + exit +) + +set vs2017_path="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build/vcvars64.bat" +if exist %vs2017_path% ( + call %vs2017_path% + del adaptor.pyd + cl adaptor.cpp ./include/clipper/clipper.cpp /I ./include /I %python_dir%/include /LD /Fe:adaptor.pyd /link/LIBPATH:%python_dir%/libs + del adaptor.exp adaptor.obj clipper.obj adaptor.lib +) else ( + @echo can't found vs2017, please set vs2017_path manually at line 14, example: + @echo Visual Studio install path is"D:/Visual Studio/Enterprise 2017",set vs2017_path="D:/Visual Studio/Enterprise 2017/VC/Auxiliary/Build/vcvars64.bat" + pause + exit +) + +if not exist adaptor.pyd ( + @echo build adaptor.pyd failed + pause + exit +) \ No newline at end of file diff --git a/readme.md b/readme.md index 0d293da1..8d4c0704 100644 --- a/readme.md +++ b/readme.md @@ -96,5 +96,7 @@ Here are some test examples on icdar2015, enjoy the beautiful text boxes! ### Troubleshooting + How to compile lanms on Windows ? + See https://github.com/argman/EAST/issues/120 ++ How to compile lanms with visual studio 2017 on Windows + + Double click lanms/lanms.cmd Please let me know if you encounter any issues(my email boostczc@gmail dot com).