Hello.
I'm desperately trying to compile Tesseract-ocr (4.0) on a Windows Machine with some restrictions.
- We are doing multi-platforms : an automated compilation must be possible (command-line)
- We are using specific 3rd party libraries : the compilation must accept custom path / libraries for most of its dependencies
- We are already using most of the 3rd party libraries for other part of the code : the compilation must not recompile them (thus, no cppan)
- Leptonica has been built with our special 3rdparty (ZLib, LibPng ..)
- Our project must "include" tesseract alongside theses specific 3rdparty
Problem :
I have strong issue specifying custom paths for Tesseract. Under Unix (CentOS, Ubuntu 16/18, Debian 8/9 ..), I was able to achieve my goal with the tools autogen autoconf autoheaders pkg-config.
Under Windows, autoconf-archive and pkg-config are unavailable (from what I know) ; making autoconf unusable. I was neither able to compile using CMake and specifying a custom path for Leptonica.
Under Linux :
- Merging libraries ZLib/LibPng/LibTiff/LibJpeg with Leptonica (ar)
- Creating a modified pkg-config with the path to this modified liblept.a
- autogen.sh
- LIBLEPT_HEADERSDIR=`pwd`/Leptonica/include ./configure --prefix=`pwd`/install --with-extra-libraries=PATH/TO/LEPTONICA PKG_CONFIG_PATH=PATH/TO/PKG LDFLAGS="-LPATH/TO/LEPTONICA" CPPFLAGS="-IPATH/TO/ZLIB -IPATH/TO/LIBPNG ..."
- make
Under Windows :
- Trying with pkg-config : installation of pkg-config with mingw failed
- Trying with cppan + cmake visual studio : could not figure how to separate cppan from tesseract in the project
- Trying with cmake, CMAKE_PREFIX_PATH, CMAKE_MODULE_PATH, Leptonica_DIR : missing config files from Leptonica (LeptonicaConfig.cmake or leptonica-config.cmake)
- Trying under Linux Ubuntu 16 with gcc-mingw-w64 : failed to link against tesseract and leptonica libraries under Windows (new Visual project)
I can detail any of theses steps if you need further information.
Is there any way to simply specify the path to Leptonica include/lib with cmake ?
Is there any restriction for the compilation to look only for an include folder and a library ?
Did you planned users to compile with non-default libraries ?
Thank you in advance.
Arnaud LOYER.