Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to complie lanms with vs2017 on windows. #285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lanms/__init__.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
30 changes: 30 additions & 0 deletions lanms/lanms.cmd
Original file line number Diff line number Diff line change
@@ -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
)
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).