Skip to content

Complete CMake Cross-Platform ZBar port

License

Notifications You must be signed in to change notification settings

renshou2003/libzbar

 
 

Repository files navigation

libzbar

Complete CMake Cross-Platform ZBar port
Uses CMake as the build system

I have removed/moved files that don’t directly contribute to the locating and decoding of barcodes/qrcodes. They are located in the directory notused. If you would like their functionality .. then add them to the compilation yourself. 😉

Linux

mkdir build;
cd build;
cmake ..
make -j$(nproc) install

Windows 10+ MSVC

Open VS 20xx Developer Command Prompt

mkdir build;
cd build;
cmake -A x64 \
-DCMAKE_INSTALL_PREFIX=C:/lib/libzbar \
-DCMAKE_BUILD_TYPE=Release ..;

cmake --build . --config Release --target INSTALL

Android

Linux:

./android.sh

Windows 10+ MSVC

Open VS 20xx Developer Command Prompt. For the most part the same arguments can be used to compile against the Android NDK on Linux. You will need to adapt for your environment. Im using the Ninja generator provided with the NDK.

cmake -G Ninja \
-DANDROID_ABI=x86 \
-DCMAKE_INSTALL_PREFIX=C:/lib/libzbar-android \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_NDK=C:\Users\brown\AppData\Local\Android\Sdk\ndk-bundle \
-DCMAKE_TOOLCHAIN_FILE=C:\Users\brown\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=android-26 \
-DBUILD_SHARED_LIBS=ON ..;

cmake --build . --config Release -- -j4
OR
ninja build
ninja install

macOS

mkdir build;
cd build;
cmake ..
make -j$(sysctl -n hw.ncpu) install

iOS

You should have xcode and command line tools installed. Do it the "Apple" way and don't use homebrew. If you use homebrew the results are untested.

mkdir build;
cd build;

cmake -G Xcode \
-DCMAKE_INSTALL_PREFIX=~/lib/libzbar-ios \
-DCMAKE_BUILD_TYPE=Release \
-DIOS_ARCH=arm64 \
-DIPHONEOS_DEPLOYMENT_TARGET=13.2 \
-DCMAKE_TOOLCHAIN_FILE=../platforms/ios/cmake/Toolchains/Toolchain-iPhoneOS_Xcode.cmake ..;

macOS Catalina or later

xcodebuild -configuration Release -scheme install -arch arm64 -sdk iphoneos
Catelina iOS build bug

macOS Mojave or earlier

xcodebuild -list -project libzbar.xcodeproj /* Optional to show info about the build*/
xcodebuild -configuration Release -scheme install

LEGAL:

On Windows, Android, Apple, and iOS this will statically build and link the libiconv library. For non-opensource / proprietary code, by dynamically linking to the final lib (libzbar), you will remain LGPL compliant. This, the original ZBar codebase and libiconv are released under the LGPL license.

You should review the LGPL legal doc to ensure proper use.

Original Sources

zbar.sourceforge.net
libiconv
iOS Toolchain

About

Complete CMake Cross-Platform ZBar port

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 92.9%
  • Objective-C 3.6%
  • C++ 2.9%
  • Other 0.6%