Building C/C++ Barcode Reader with CMake
SDK Version
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
-
Create a build folder:
mkdir build cd build
-
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" ..
-
Run the app:
.\Release\BarcodeReader.exe [image-file] [optional: license-file] [optional: template-file]
Linux and Raspberry Pi OS
- Install CMake:
sudo apt-get install cmake
- Create a build folder:
mkdir build cd build
- Configure and build the project:
cmake .. # cmake -DARM32_BUILD=TRUE .. cmake --build . --config release cmake --install .
- Run the app:
./BarcodeReader [image-file] [optional: license-file] [optional: template-file]
macOS
-
Install CMake:
brew install cmake
-
Create a build folder:
mkdir build cd build
-
Configure and build the project:
cmake .. cmake --build . --config release cmake --install .
-
Run the app:
./BarcodeReader [image-file] [optional: license-file] [optional: template-file]
Screenshot
Reference
- https://cmake.org/cmake/help/latest/guide/tutorial/index.html
- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/Useful-Variables
- https://stackoverflow.com/questions/10671916/how-to-copy-dll-files-into-the-same-folder-as-the-executable-using-cmake
- https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling