ZXing 2.3

ZXing 2.3

测试已测试
语言语言 C++C++
许可证 Apache 2
发布最新发布2014年12月

Romain Péchayre 维护。



ZXing 2.3

  • ZXing 团队(http://code.google.com/p/zxing/people/list)

ZXing C++ 版本

这是将 ZXing 手动移植到 C++ 的版本。它已在 Linux、Mac OS X 和 Windows 上进行了测试。

使用 SCons 构建

SCons 是一个用 Python 编写的构建工具。您需要安装 Python,但是 scons 的安装不是必需的:包含运行时 SCons 的副本(称为 scons-local)。要使用包含的副本,请在以下说明中将 替换为 python scons/scons.py

仅构建库

  1. 安装 libiconv(可选;许多操作系统自带)
  2. cdcpp 文件夹
  3. 运行 scons lib

构建命令行实用程序

  1. 运行 scons zxing
  2. 运行 build/zxing 以获取命令行参考

构建单元测试(可选)

  1. 安装 CppUnit(在 Ubuntu 上为 libcppunit-dev
  2. 运行 scons tests
  3. 运行 build/testrunner

清洁

  1. 运行 scons -c all

使用 CMake 构建

CMake 是一个工具,可以生成本机 makefile 和工作区。它与许多 IDE(包括 Qt Creator 和Visual Studio)很好地集成。

用于 Qt Creator 的使用方法

  1. CMakeLists.txt 作为新项目打开
  2. 指定命令行参数(见下文)并按 完成

用于 Makefile、Visual Studio 等。的使用方法(查看 cmake --help 以获取生成器的完整列表)

  1. cdcpp/build
  2. Unix:运行 cmake -G "Unix Makefiles" ..
  3. Windows:运行 cmake -G "Visual Studio 10" ..

您可以通过指定以下内容在构建模式之间切换

  • -DCMAKE_BUILD_TYPE=Debug
  • -DCMAKE_BUILD_TYPE=Release

开发技巧

为了分析代码(用于代码优化的非常有用)

  1. 安装 Valgrind
  2. 运行 valgrind --tool=callgrind build/zxing - path/to/test/data/*.jpg > report.html
  3. 使用 KCachegrind 分析输出

为了运行黑盒测试并检查更改

  1. 构建 zxing-img,例如,scons zxing
  2. 运行测试: bash blackboxtest.sh 2>&1 | tee bb.results
  3. 将它们与已知结果进行比较: diff bb.results blackboxtest.results