Skip to content

Complete CMake Cross-Platform ZBar port

License

Notifications You must be signed in to change notification settings

concretecode/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 buil;
cmake ..
make install

iOS

You should have xcode and command line tools installed. Do it the "Apple" way and don't use homebrew stuff ... make your life much easier.

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

xcodebuild -list -project libzbar.xcodeproj /* Optional to show info about the build*/
xcodebuild -configuration Release -scheme install
Or
Open project file in xcode to make additional changes

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

Packages

No packages published

Languages

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