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