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. 😉
mkdir build;
cd build;
cmake ..
make -j$(nproc) install
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.sh
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
mkdir build;
cd build;
cmake ..
make -j$(sysctl -n hw.ncpu) install
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 ..;
xcodebuild -configuration Release -scheme install -arch arm64 -sdk iphoneos
Catelina iOS build bug
xcodebuild -list -project libzbar.xcodeproj /* Optional to show info about the build*/
xcodebuild -configuration Release -scheme install
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.