我认为这是可能的,但我无法将以下库构建为 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 位:
- 下载并安装 Git、CMake 并将它们放入 PATH 中。
- 从 https://cppan.org/ 下载最新的 CPPAN (C++ Archive Network https://cppan.org/client/ ) 客户端。 CPPAN是一个源码包分发系统。也在 PATH 中添加 CPPAN 客户端。 (需要VS2015 redist。)
- 如果您有发布存档,请将其解压到 tesseract 目录。如果您使用的是 master 分支运行
- git 克隆 https://github.com/tesseract-ocr/tesseract超正方体
- 运行
- cd 超正方体
- cppan
- mkdir 构建 && cd 构建
- cmake ..-DSTATIC=1
在您的 Visual Studio 版本中构建解决方案 ( tesseract.sln
)。
但我省略了 –DSTATIC=1
进行分享。
我向解决方案添加了新配置 x64
然后我删除了硬编码的 /machine:X86
来自tesseract
和tesseractmain
链接器部分中的其他选项..但通过 cppan-dummy
构建的库项目仍然是32位。
想法?
问候 布鲁斯
最佳答案
经过大量挖掘和学习 MSVC 构建系统后,如果您想要 64 位共享 .dll 和 .lib 导入库,请执行以下操作:
转到:https://github.com/peirick/VS2015_Tesseract
克隆存储库。
将 build_tesseract.bat 更改为 64 位调试,不要忘记更改 call "%programfiles% (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"amd64。运行build_tesseract.bat。
- 在libtesseract项目的Preprocessors定义中指定TESS_EXPORTS,并将其从.lib更改为.dll
这对于知情者来说可能是非常明显的,困难的部分是计算 TESS_EXPORTS 位,据我所知,仅在代码中提到,并且还使用上面的存储库,因为它具有所有依赖项。支持 peirick 设置存储库并将其全部排序。
关于c++ - Windows 64位共享dll Tesseract?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40540881/