Zxingとは
バーコードまたは2Dバーコードをスキャンし、エンコードされたデータを取得できるようにします。
らしい
基本的はAndroidで使えるJavaのライブラリらしいがC++などほかの言語でも使用できるっぽいので
今回はC++版を使用してUE5.2で使えるかやってみようと思う。
(Apache License 2.0)
Zxing Cpp
Zxingのc++版はZxingnとは別に開発が進んでいるっぽいので、そっちを使用する。
https://github.com/zxing-cpp/zxing-cpp
実際に使ってみる
- まずはCmakeを使ってライブラリをビルドする
- 最新のVIsualStudioであれば最初からCMake入っているはずなのでVSでやってみる
(C++17以上のコンパイラが必要なので VS2019以上を使用する)
- 最新のVIsualStudioであれば最初からCMake入っているはずなのでVSでやってみる
VisyualStudioをとりあえず起動するとこのような画面(バージョンによって異なるが)で
「ローカルフォルダーを開く」を選択する

Zxingのフォルダを開く

するとVisualStudioで開いて出力ウィンドウでいろいろ動く

ソリューションエクスプローラーからCMakeSettings.jsonを開くとおそらくこのような感じの画面が表示されると思います。

この画面の
「構成の種類」をDebug→Releaseに変更
「Cmake変数とキャシュ」(下の方にある)の「Build_SHARED_LIBS」にチェックを入れる
この2つを忘れずに必ず設定してください。
(この設定がないとUE側で動かすときにエラーになります)


設定が終わったら上の方の「スタートアップアイテムの選択」から

ZxingReader.exe(インストール) or ZxingWriter.exe(インストール)を選択してクリックして実行します。

するとビルドがはしってコマンドの画面が表示されますが今回は何もしないので消してOKです。
Zxingのフォルダ何にoutフォルダがあると思いますのでその中の
install→x64-Debug→binにdll(Zxing.dll)が
install→x64-Debug→lib にライブラリ(Zxing.lib)が
install→x64-Debug→includeにヘッダーファイルが出力されていると思います。
この2つがUE5側にプラグインとして読み込むものとなります。

Zxing側の設定はこれで終わりです。
UE側の設定は次の記事で・・・・・・
コメント
I like the valuable info you provide in your articles.
I’ll bookmark your blog and check again here regularly. I am quite sure I’ll
learn plenty of new stuff right here! Good luck for the next!
Ahaa, its pleasant discussion regarding this piece of writing here at
this website, I have read all that, so now
me also commenting here.
Hey people!!!!!
Good mood and good luck to everyone!!!!!