2018-11-23 06:47:02 +08:00
|
|
|
void build(Solution &s)
|
|
|
|
{
|
|
|
|
auto &tess = s.addProject("google.tesseract", "master");
|
|
|
|
tess += Git("https://github.com/tesseract-ocr/tesseract", "", "{v}");
|
|
|
|
|
|
|
|
auto &libtesseract = tess.addTarget<LibraryTarget>("libtesseract");
|
|
|
|
{
|
|
|
|
libtesseract.setChecks("libtesseract");
|
|
|
|
|
|
|
|
libtesseract.ExportAllSymbols = true;
|
|
|
|
libtesseract.PackageDefinitions = true;
|
|
|
|
libtesseract +=
|
|
|
|
"src/api/.*\\.cpp"_rr,
|
|
|
|
"src/api/.*\\.h"_rr,
|
|
|
|
"src/api/tess_version.h.in",
|
|
|
|
"src/arch/.*\\.cpp"_rr,
|
|
|
|
"src/arch/.*\\.h"_rr,
|
|
|
|
"src/ccmain/.*\\.cpp"_rr,
|
|
|
|
"src/ccmain/.*\\.h"_rr,
|
|
|
|
"src/ccstruct/.*\\.cpp"_rr,
|
|
|
|
"src/ccstruct/.*\\.h"_rr,
|
|
|
|
"src/ccutil/.*\\.cpp"_rr,
|
|
|
|
"src/ccutil/.*\\.h"_rr,
|
|
|
|
"src/classify/.*\\.cpp"_rr,
|
|
|
|
"src/classify/.*\\.h"_rr,
|
|
|
|
"src/cutil/.*\\.cpp"_rr,
|
|
|
|
"src/cutil/.*\\.h"_rr,
|
|
|
|
"src/dict/.*\\.cpp"_rr,
|
|
|
|
"src/dict/.*\\.h"_rr,
|
|
|
|
"src/lstm/.*\\.cpp"_rr,
|
|
|
|
"src/lstm/.*\\.h"_rr,
|
|
|
|
"src/opencl/.*\\.cpp"_rr,
|
|
|
|
"src/opencl/.*\\.h"_rr,
|
|
|
|
"src/textord/.*\\.cpp"_rr,
|
|
|
|
"src/textord/.*\\.h"_rr,
|
|
|
|
"src/viewer/.*\\.cpp"_rr,
|
|
|
|
"src/viewer/.*\\.h"_rr,
|
|
|
|
"src/wordrec/.*\\.cpp"_rr,
|
|
|
|
"src/wordrec/.*\\.h"_rr;
|
|
|
|
|
2019-10-11 05:46:23 +08:00
|
|
|
libtesseract += "src/training/.*\\.h"_rr;
|
|
|
|
|
2018-11-23 06:47:02 +08:00
|
|
|
libtesseract -=
|
|
|
|
"src/api/tesseractmain.cpp",
|
|
|
|
"src/viewer/svpaint.cpp";
|
|
|
|
|
|
|
|
libtesseract.Public +=
|
|
|
|
"src/opencl"_id,
|
|
|
|
"src/ccmain"_id,
|
|
|
|
"src/api"_id,
|
|
|
|
"src/dict"_id,
|
|
|
|
"src/viewer"_id,
|
|
|
|
"src/wordrec"_id,
|
|
|
|
"src/ccstruct"_id,
|
|
|
|
"src/cutil"_id,
|
|
|
|
"src/textord"_id,
|
|
|
|
"src/ccutil"_id,
|
|
|
|
"src/lstm"_id,
|
|
|
|
"src/classify"_id,
|
2019-08-13 01:05:33 +08:00
|
|
|
"src/arch"_id,
|
|
|
|
"src/training"_id;
|
2018-11-23 06:47:02 +08:00
|
|
|
|
2019-05-13 06:54:23 +08:00
|
|
|
if (libtesseract.getCompilerType() == CompilerType::MSVC ||
|
|
|
|
libtesseract.getCompilerType() == CompilerType::ClangCl)
|
2019-01-16 00:12:46 +08:00
|
|
|
{
|
2019-04-08 03:59:38 +08:00
|
|
|
libtesseract += "__SSE4_1__"_def;
|
|
|
|
libtesseract.CompileOptions.push_back("-arch:AVX2");
|
2019-07-14 01:03:53 +08:00
|
|
|
|
|
|
|
libtesseract -=
|
|
|
|
"src/arch/dotproductfma.cpp";
|
2019-01-16 00:12:46 +08:00
|
|
|
}
|
|
|
|
|
2018-11-23 06:47:02 +08:00
|
|
|
libtesseract.Public += "HAVE_CONFIG_H"_d;
|
|
|
|
libtesseract.Public += "_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1"_d;
|
2019-03-11 05:03:45 +08:00
|
|
|
libtesseract.Public += "HAVE_LIBARCHIVE"_d;
|
2018-11-23 06:47:02 +08:00
|
|
|
libtesseract.Interface += sw::Shared, "TESS_IMPORTS"_d;
|
|
|
|
libtesseract.Private += sw::Shared, "TESS_EXPORTS"_d;
|
|
|
|
|
2019-09-26 05:34:36 +08:00
|
|
|
libtesseract.Public += "org.sw.demo.danbloomberg.leptonica"_dep;
|
2019-03-11 05:03:45 +08:00
|
|
|
libtesseract.Public += "org.sw.demo.libarchive.libarchive"_dep;
|
2018-11-23 06:47:02 +08:00
|
|
|
|
2019-08-10 20:46:59 +08:00
|
|
|
if (libtesseract.getBuildSettings().TargetOS.Type == OSType::Windows)
|
2019-04-02 03:38:01 +08:00
|
|
|
{
|
2019-09-26 05:22:07 +08:00
|
|
|
libtesseract.Public += "ws2_32.lib"_slib;
|
2019-04-02 03:38:01 +08:00
|
|
|
libtesseract.Protected += "NOMINMAX"_def;
|
|
|
|
}
|
2018-11-23 06:47:02 +08:00
|
|
|
|
|
|
|
libtesseract.Variables["TESSERACT_MAJOR_VERSION"] = libtesseract.Variables["PACKAGE_MAJOR_VERSION"];
|
|
|
|
libtesseract.Variables["TESSERACT_MINOR_VERSION"] = libtesseract.Variables["PACKAGE_MINOR_VERSION"];
|
|
|
|
libtesseract.Variables["TESSERACT_MICRO_VERSION"] = libtesseract.Variables["PACKAGE_PATCH_VERSION"];
|
|
|
|
libtesseract.Variables["TESSERACT_VERSION_STR"] = "master";
|
|
|
|
libtesseract.configureFile("src/api/tess_version.h.in", "tess_version.h");
|
2019-07-28 23:20:43 +08:00
|
|
|
|
|
|
|
// install
|
|
|
|
if (!libtesseract.DryRun)
|
|
|
|
{
|
|
|
|
const Files files
|
|
|
|
{
|
|
|
|
// from api/makefile.am
|
|
|
|
"src/api/apitypes.h",
|
|
|
|
"src/api/baseapi.h",
|
|
|
|
"src/api/capi.h",
|
|
|
|
"src/api/renderer.h",
|
|
|
|
"tess_version.h",
|
|
|
|
|
|
|
|
//from ccmain/makefile.am
|
|
|
|
"src/ccmain/thresholder.h",
|
|
|
|
"src/ccmain/ltrresultiterator.h",
|
|
|
|
"src/ccmain/pageiterator.h",
|
|
|
|
"src/ccmain/resultiterator.h",
|
|
|
|
"src/ccmain/osdetect.h",
|
|
|
|
|
|
|
|
//from ccstruct/makefile.am
|
|
|
|
"src/ccstruct/publictypes.h",
|
|
|
|
|
|
|
|
//from ccutil/makefile.am
|
|
|
|
"src/ccutil/genericvector.h",
|
|
|
|
"src/ccutil/helpers.h",
|
|
|
|
"src/ccutil/ocrclass.h",
|
|
|
|
"src/ccutil/platform.h",
|
|
|
|
"src/ccutil/serialis.h",
|
|
|
|
"src/ccutil/strngs.h",
|
|
|
|
"src/ccutil/unichar.h",
|
|
|
|
};
|
|
|
|
|
|
|
|
auto d = libtesseract.BinaryDir / "tesseract";
|
|
|
|
fs::create_directories(d);
|
|
|
|
for (auto f : files)
|
|
|
|
{
|
|
|
|
libtesseract.check_absolute(f);
|
2019-09-26 05:22:07 +08:00
|
|
|
fs::copy_file(f, d / f.filename(), fs::copy_options::update_existing);
|
2019-07-28 23:20:43 +08:00
|
|
|
}
|
|
|
|
}
|
2018-11-23 06:47:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
auto &tesseract = tess.addExecutable("tesseract");
|
|
|
|
tesseract += "src/api/tesseractmain.cpp";
|
2019-05-17 02:47:42 +08:00
|
|
|
tesseract += libtesseract;
|
|
|
|
|
|
|
|
//
|
|
|
|
auto &tessopt = tess.addStaticLibrary("tessopt");
|
|
|
|
tessopt += "src/training/tessopt.*"_rr;
|
|
|
|
tessopt.Public += libtesseract;
|
|
|
|
|
|
|
|
//
|
|
|
|
auto &common_training = tess.addStaticLibrary("common_training");
|
|
|
|
common_training +=
|
|
|
|
"src/training/commandlineflags.cpp",
|
|
|
|
"src/training/commandlineflags.h",
|
|
|
|
"src/training/commontraining.cpp",
|
2019-08-13 01:05:33 +08:00
|
|
|
"src/training/commontraining.h",
|
|
|
|
"src/training/ctc.cpp",
|
|
|
|
"src/training/ctc.h",
|
|
|
|
"src/training/errorcounter.cpp",
|
|
|
|
"src/training/errorcounter.h",
|
|
|
|
"src/training/intfeaturedist.cpp",
|
|
|
|
"src/training/intfeaturedist.h",
|
|
|
|
"src/training/intfeaturemap.cpp",
|
|
|
|
"src/training/intfeaturemap.h",
|
|
|
|
"src/training/mastertrainer.cpp",
|
|
|
|
"src/training/mastertrainer.h",
|
|
|
|
"src/training/networkbuilder.cpp",
|
|
|
|
"src/training/networkbuilder.h",
|
|
|
|
"src/training/sampleiterator.cpp",
|
|
|
|
"src/training/sampleiterator.h",
|
|
|
|
"src/training/trainingsampleset.cpp",
|
|
|
|
"src/training/trainingsampleset.h";
|
2019-05-17 02:47:42 +08:00
|
|
|
common_training.Public += tessopt;
|
|
|
|
|
|
|
|
//
|
|
|
|
auto &unicharset_training = tess.addStaticLibrary("unicharset_training");
|
|
|
|
unicharset_training +=
|
2019-08-07 16:24:57 +08:00
|
|
|
"src/training/fileio.*"_rr,
|
2019-05-17 02:47:42 +08:00
|
|
|
"src/training/icuerrorcode.*"_rr,
|
|
|
|
"src/training/icuerrorcode.h",
|
|
|
|
"src/training/lang_model_helpers.*"_rr,
|
|
|
|
"src/training/lstmtester.*"_rr,
|
|
|
|
"src/training/normstrngs.*"_rr,
|
|
|
|
"src/training/unicharset_training_utils.*"_rr,
|
|
|
|
"src/training/validat.*"_rr;
|
2018-11-23 06:47:02 +08:00
|
|
|
unicharset_training.Public += common_training;
|
2019-05-17 02:47:42 +08:00
|
|
|
unicharset_training.Public += "org.sw.demo.unicode.icu.i18n"_dep;
|
|
|
|
|
2018-11-23 06:47:02 +08:00
|
|
|
//
|
|
|
|
#define ADD_EXE(n, ...) \
|
|
|
|
auto &n = tess.addExecutable(#n); \
|
|
|
|
n += "src/training/" #n ".*"_rr; \
|
2019-01-16 00:12:46 +08:00
|
|
|
n.Public += __VA_ARGS__; \
|
|
|
|
n
|
2018-11-23 06:47:02 +08:00
|
|
|
|
|
|
|
ADD_EXE(ambiguous_words, libtesseract);
|
|
|
|
ADD_EXE(classifier_tester, common_training);
|
|
|
|
ADD_EXE(combine_lang_model, unicharset_training);
|
|
|
|
ADD_EXE(combine_tessdata, libtesseract);
|
|
|
|
ADD_EXE(cntraining, common_training);
|
|
|
|
ADD_EXE(dawg2wordlist, libtesseract);
|
2019-01-16 00:12:46 +08:00
|
|
|
ADD_EXE(mftraining, common_training) += "src/training/mergenf.*"_rr;
|
2018-11-23 06:47:02 +08:00
|
|
|
ADD_EXE(shapeclustering, common_training);
|
|
|
|
ADD_EXE(unicharset_extractor, unicharset_training);
|
|
|
|
ADD_EXE(wordlist2dawg, libtesseract);
|
|
|
|
ADD_EXE(lstmeval, unicharset_training);
|
|
|
|
ADD_EXE(lstmtraining, unicharset_training);
|
|
|
|
ADD_EXE(set_unicharset_properties, unicharset_training);
|
|
|
|
|
2019-05-17 02:47:42 +08:00
|
|
|
ADD_EXE(text2image, unicharset_training);
|
|
|
|
text2image +=
|
|
|
|
"src/training/boxchar.cpp",
|
|
|
|
"src/training/boxchar.h",
|
|
|
|
"src/training/degradeimage.cpp",
|
|
|
|
"src/training/degradeimage.h",
|
|
|
|
"src/training/icuerrorcode.h",
|
|
|
|
"src/training/ligature_table.cpp",
|
|
|
|
"src/training/ligature_table.h",
|
|
|
|
"src/training/normstrngs.cpp",
|
|
|
|
"src/training/normstrngs.h",
|
|
|
|
"src/training/pango_font_info.cpp",
|
|
|
|
"src/training/pango_font_info.h",
|
|
|
|
"src/training/stringrenderer.cpp",
|
|
|
|
"src/training/stringrenderer.h",
|
|
|
|
"src/training/text2image.cpp",
|
|
|
|
"src/training/tlog.cpp",
|
|
|
|
"src/training/tlog.h",
|
2018-11-23 06:47:02 +08:00
|
|
|
"src/training/util.h";
|
2019-08-06 20:04:26 +08:00
|
|
|
text2image.Public += "org.sw.demo.gnome.pango.pangocairo"_dep;
|
2018-11-23 06:47:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void check(Checker &c)
|
|
|
|
{
|
|
|
|
auto &s = c.addSet("libtesseract");
|
|
|
|
s.checkFunctionExists("getline");
|
|
|
|
s.checkIncludeExists("dlfcn.h");
|
|
|
|
s.checkIncludeExists("inttypes.h");
|
|
|
|
s.checkIncludeExists("limits.h");
|
|
|
|
s.checkIncludeExists("malloc.h");
|
|
|
|
s.checkIncludeExists("memory.h");
|
|
|
|
s.checkIncludeExists("stdbool.h");
|
|
|
|
s.checkIncludeExists("stdint.h");
|
|
|
|
s.checkIncludeExists("stdlib.h");
|
|
|
|
s.checkIncludeExists("string.h");
|
|
|
|
s.checkIncludeExists("sys/ipc.h");
|
|
|
|
s.checkIncludeExists("sys/shm.h");
|
|
|
|
s.checkIncludeExists("sys/stat.h");
|
|
|
|
s.checkIncludeExists("sys/types.h");
|
|
|
|
s.checkIncludeExists("sys/wait.h");
|
|
|
|
s.checkIncludeExists("tiffio.h");
|
|
|
|
s.checkIncludeExists("unistd.h");
|
|
|
|
s.checkTypeSize("long long int");
|
|
|
|
s.checkTypeSize("mbstate_t");
|
|
|
|
s.checkTypeSize("off_t");
|
|
|
|
s.checkTypeSize("size_t");
|
|
|
|
s.checkTypeSize("void *");
|
|
|
|
s.checkTypeSize("wchar_t");
|
|
|
|
s.checkTypeSize("_Bool");
|
|
|
|
{
|
|
|
|
auto &c = s.checkSymbolExists("snprintf");
|
|
|
|
c.Parameters.Includes.push_back("stdio.h");
|
|
|
|
}
|
|
|
|
}
|