EasyOCR-cpp icon indicating copy to clipboard operation
EasyOCR-cpp copied to clipboard

Adding SWIG support for C#

Open tranlm opened this issue 1 year ago • 0 comments

Hi all,

Great job on this project. I'm trying to update the cmakelist.txt file to create C# bindings using SWIG (appended code pasted below). However, everytime I try to build the project, I get the following error:

C:\GitHub\EasyOCR-cpp\build>cmake --build . --config Release
MSBuild version 17.10.4+10fbfbf2e for .NET Framework

  1>Checking Build System
  Swig compile src/TorchModel.i for csharp
..\include\CRAFT.h(29): warning 503: Can't wrap 'operator ()' unless renamed to a valid identifier. [C:\GitHub\EasyOCR-
cpp\build\TorchModel.vcxproj]
..\include\CRAFT.h(37): warning 503: Can't wrap 'operator ()' unless renamed to a valid identifier. [C:\GitHub\EasyOCR-
cpp\build\TorchModel.vcxproj]
  Building Custom Rule C:/GitHub/EasyOCR-cpp/CMakeLists.txt
  TorchModelCSHARP_wrap.cxx
C:\GitHub\EasyOCR-cpp\build\CMakeFiles\TorchModel.dir\TorchModelCSHARP_wrap.cxx(625,17): error C2512: 'c10::Device': no
 appropriate default constructor available [C:\GitHub\EasyOCR-cpp\build\TorchModel.vcxproj]
C:\GitHub\EasyOCR-cpp\build\CMakeFiles\TorchModel.dir\TorchModelCSHARP_wrap.cxx(642,17): error C2512: 'c10::Device': no
 appropriate default constructor available [C:\GitHub\EasyOCR-cpp\build\TorchModel.vcxproj]

I've tried to update the code to exclude c10::Device from the SWIG Wrapping, but have been unsuccessful. Was wondering if you could add the support for this.

Thanks!

tranlm avatar Jul 23 '24 19:07 tranlm