Skip to content

yushulx/cmake-cpp-barcode-qrcode

Repository files navigation

Building C/C++ Barcode Reader with CMake

SDK Version

v9.6.40

SDK Activation

Apply for a 30-day free trial license.

Supported Platforms

  • Windows x64
  • Linux x64/ARM64
  • macOS x64
  • Raspberry Pi ARMv7

Setting License

Set the license key in BarcodeReader.cxx:

DBR_InitLicense(license, errorMsgBuffer, 512);

Windows

  1. Create a build folder:

    mkdir build
    cd build
    
  2. Configure and build the project:

    // x86
    cmake -DCMAKE_GENERATOR_PLATFORM=x86 ..
    
    // x64
    cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..
    
    cmake --build . --config release
    cmake --install .

    For MinGW:

    cmake -G "MinGW Makefiles" ..
  3. Run the app:

    .\Release\BarcodeReader.exe [image-file] [optional: license-file] [optional: template-file]
    

Linux and Raspberry Pi OS

  1. Install CMake:
    sudo apt-get install cmake
  2. Create a build folder:
    mkdir build
    cd build
    
  3. Configure and build the project:
    cmake ..
    # cmake -DARM32_BUILD=TRUE ..
    cmake --build . --config release 
    cmake --install .
  4. Run the app:
    ./BarcodeReader [image-file] [optional: license-file] [optional: template-file]
    

macOS

  1. Install CMake:

    brew install cmake
  2. Create a build folder:

    mkdir build
    cd build
    
  3. Configure and build the project:

    cmake ..
    cmake --build . --config release 
    cmake --install .
  4. Run the app:

    ./BarcodeReader [image-file] [optional: license-file] [optional: template-file]
    

Screenshot

Raspberry Pi Barcode Reader

Reference

Blog