-
Notifications
You must be signed in to change notification settings - Fork 753
Compiling Tesseract and Leptonica
Sometimes custom versions of tesseract library might be needed.
To produce the valid libtesseract
and leptonica
dll's, each library must be built with statically linked dependencies and then placed in x64/x86 directory from where the C# wrapper will load it.
Note: AVX optimizations are currently disabled for the builds supplied with this wrapper as they are known to cause DllNotFoundException on some configurations. Using custom build might increase perfomance on modern CPU's.
See the Compiling#windows tesseract page for the full description of the building process and this issue which describes static linking.
Clone master branch of tesseract repo and edit cppan.yml
file:
local_settings:
short_local_names: true <-- optional, uncomment to produce dll without long prefixes in filename
generator: Visual Studio 15 2017 Win64 <-- Uncomment and set your generator
use_shared_libs: false
projects:
libtesseract:
shared_only: true
Run (you need to have cppan.exe be in your $PATH):
cppan --build .
cppan will create link to the Visual Studio solution and build it. Alternatively, cppan --generate .
can be used to only generate solution. Then, build can be started manually from the Visual Studio (building only libtesseract
project is enough).
Note: cppan generated Win32 project for me despite
Visual Studio 15 2017 Win64
generator. Neither settingcurrent_build: vs2017_64
nor setting generator underbuild
section worked, so I had to change
builds:
vs2017:
generator: Visual Studio 15 2017 Win64
libtesseract.dll
will be in the bin directory of the generated solution.
git clone https://github.com/DanBloomberg/leptonica.git
cd leptonica
cppan
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" -DCPPAN_BUILD_SHARED_LIBS=0 ..
cmake --build . --config Release
The produced leptonica dll will reside in the bin directory of the generated solution.
Thanks to ArXen42 and tdhintz (See Issue 436)