c++ - Windows 64位共享dll Tesseract?

标签 c++ visual-studio-2015 cmake 64-bit tesseract

我认为这是可能的,但我无法将以下库构建为 64 位,因为它们是作为项目的一部分构建的,但不承担项目的位数(它们是使用 cppan/构建的) cmake):

C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.leptonica-master.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' 4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.gif-5.1.4.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' 4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.jpeg-9.2.0.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' 4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.openjpeg.openjp2-2.1.2.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' 4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.png-1.6.23.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' 4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.tiff-4.0.6.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' 4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.zlib-1.2.8.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' 4>C:\Users\Bruce.cppan\storage\lib\amd64-msvc-19.0-32\Debug\pvt.cppan.demo.webp-0.5.1.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'

构建为 64 位:

  1. 下载并安装 Git、CMake 并将它们放入 PATH 中。
  2. https://cppan.org/ 下载最新的 CPPAN (C++ Archive Network https://cppan.org/client/ ) 客户端。 CPPAN是一个源码包分发系统。也在 PATH 中添加 CPPAN 客户端。 (需要VS2015 redist。)
  3. 如果您有发布存档,请将其解压到 tesseract 目录。如果您使用的是 master 分支运行
  4. git 克隆 https://github.com/tesseract-ocr/tesseract超正方体
  5. 运行
  6. cd 超正方体
  7. cppan
  8. mkdir 构建 && cd 构建
  9. cmake ..-DSTATIC=1

在您的 Visual Studio 版本中构建解决方案 ( tesseract.sln )。 但我省略了 –DSTATIC=1进行分享。

我向解决方案添加了新配置 x64然后我删除了硬编码的 /machine:X86来自tesseracttesseractmain链接器部分中的其他选项..但通过 cppan-dummy 构建的库项目仍然是32位。

想法?

问候 布鲁斯

最佳答案

经过大量挖掘和学习 MSVC 构建系统后,如果您想要 64 位共享 .dll 和 .lib 导入库,请执行以下操作:

转到:https://github.com/peirick/VS2015_Tesseract

  1. 克隆存储库。

  2. 将 build_tesseract.bat 更改为 64 位调试,不要忘记更改 call "%programfiles% (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"amd64。运行build_tesseract.bat。

  3. 在libtesseract项目的Preprocessors定义中指定TESS_EXPORTS,并将其从.lib更改为.dll

这对于知情者来说可能是非常明显的,困难的部分是计算 TESS_EXPORTS 位,据我所知,仅在代码中提到,并且还使用上面的存储库,因为它具有所有依赖项。支持 peirick 设置存储库并将其全部排序。

关于c++ - Windows 64位共享dll Tesseract?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40540881/

相关文章:

jquery - Cordova for Visual Studio 2015 预览版 : not able to request content from a remote host

c# - 在 Xamarin Forms 中检测 Windows Phone 8.1 与 Windows Phone 上的 UWPapp

c++ - OpenCV:对 `cv::namedWindow(cv::String const&, int)' 的 undefined reference

c++ - 有条件地将文件添加到 C++ 项目中的库

cmake - 如何检查CMake中是否存在宏

c++ - 哪些规则控制在类型之间使用多个用户定义的转换?

c++ - 我可以确定参数是否是字符串文字吗?

c++ - 简单的 lambda 表达式 C++03 不带 boost 等

c++ - 使用 shared_ptr 时如何检测循环

visual-studio - 代码定义窗口在 VS2015 中不起作用