diff --git a/.travis.yml b/.travis.yml
index 40c0aee7..c2fc422e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
#Author: KangLin(kl222@126.com)
#sudo: required
-dist: xenial
+dist: bionic
services:
- xvfb
@@ -9,9 +9,9 @@ services:
language: cpp
cache:
- - apt: true
+ - apt
- directories:
- - Tools
+ - Package
compiler:
- g++
@@ -24,17 +24,15 @@ addons:
env:
jobs:
- - BUILD_TARGERT="linux" QT_VERSION_DIR=5.13 QT_VERSION=5.13.0
- # - BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.13 QT_VERSION=5.13.0
- - BUILD_TARGERT="linux" QT_VERSION_DIR=5.12 QT_VERSION=5.12.4
- # - BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.12 QT_VERSION=5.12.4
- - BUILD_TARGERT="linux" QT_VERSION_DIR=5.9 QT_VERSION=5.9.8
- # - BUILD_TARGERT="android_armv7" QT_VERSION_DIR=5.9 QT_VERSION=5.9.8
+ - BUILD_TARGERT="unix" DOWNLOAD_QT=APT
+ - BUILD_TARGERT="unix" QT_VERSION_DIR=512 QT_VERSION=5.12.6 DOWNLOAD_QT=FALSE
+ - BUILD_TARGERT="unix" QT_VERSION_DIR=511 QT_VERSION=5.11.3 DOWNLOAD_QT=FALSE
before_install:
- echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}"
- export DISPLAY=:99.0
- sudo apt-get install -y libgl1-mesa-glx libgl1-mesa-dev
+ - cmake --version
install:
- bash ${TRAVIS_BUILD_DIR}/ci/build-install-tools.sh #> /dev/null
@@ -43,7 +41,15 @@ before_script:
- source ${TRAVIS_BUILD_DIR}/ci/build_env.sh
script:
- - mkdir ${TRAVIS_BUILD_DIR}/build
- - cd ${TRAVIS_BUILD_DIR}/build
- - ${QT_ROOT}/bin/qmake -o Makefile CONFIG+=Release ${TRAVIS_BUILD_DIR}/src/QZXing.pro
- - make -f Makefile
+ # Test qmake
+ - mkdir ${TRAVIS_BUILD_DIR}/build_qamke
+ - cd ${TRAVIS_BUILD_DIR}/build_qamke
+ - ${QT_ROOT}/bin/qmake CONFIG+=Release PRFIEX=`pwd`/install ${TRAVIS_BUILD_DIR}/src
+ - make install
+
+ # Test cmake
+ - mkdir ${TRAVIS_BUILD_DIR}/build_camke
+ - cd ${TRAVIS_BUILD_DIR}/build_camke
+ - cmake -DQt5_DIR=${QT_ROOT}/lib/cmake/Qt5 -DCMAKE_INSTALL_PREFIX=`pwd`/install ${TRAVIS_BUILD_DIR}/src
+ - cmake --build . --config Release
+ - cmake --build . --config Release --target install
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..f1965286
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,70 @@
+# Author: Kang Lin (kl222@126.com)
+
+cmake_minimum_required(VERSION 2.8.12)
+
+if(POLICY CMP0100)
+ cmake_policy(SET CMP0100 NEW)
+endif()
+
+if(POLICY CMP0077)
+ cmake_policy(SET CMP0077 NEW)
+endif()
+
+project(QZXing)
+
+# TODO: Modify the version to the correct version
+SET(BUILD_VERSION "2.3")
+# Find Git Version Patch
+IF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+ if(NOT GIT)
+ SET(GIT $ENV{GIT})
+ endif()
+ if(NOT GIT)
+ FIND_PROGRAM(GIT NAMES git git.exe git.cmd)
+ endif()
+ IF(GIT)
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT} describe --tags
+ OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT GIT_VERSION)
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT} rev-parse --short HEAD
+ OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif()
+ SET(BUILD_VERSION ${GIT_VERSION})
+ ENDIF()
+ENDIF()
+message("BUILD_VERSION:${BUILD_VERSION}")
+set(VERSION ${BUILD_VERSION})
+
+# Open qt compile tools
+SET(CMAKE_AUTOUIC ON)
+SET(CMAKE_AUTOMOC ON)
+SET(CMAKE_AUTORCC ON)
+SET(CMAKE_INCLUDE_CURRENT_DIR ON)
+SET(CMAKE_VERBOSE_MAKEFILE ON)
+
+include(CMakePackageConfigHelpers)
+include(GNUInstallDirs)
+include(GenerateExportHeader)
+
+# Record the files that will need to be deleted
+CONFIGURE_FILE(
+ "${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+ "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+# Create delete target
+ADD_CUSTOM_TARGET(uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
+
+SET(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libs")
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
+endif()
+
+add_subdirectory(src)
diff --git a/README.md b/README.md
index 38bc3b83..e45b9e8a 100644
--- a/README.md
+++ b/README.md
@@ -46,18 +46,71 @@ Supports barcode decoding for the following types:
The project can be used in two ways:
## Embed the source code.
+- qmake project
+
Copy source code folder of QZXing to the root of your project. Add the following line to your .pro file. For more information see [here](https://github.com/ftylitak/qzxing/wiki/Using-the-QZXing-through-the-source-code).
```qmake
include(QZXing/QZXing.pri)
```
+
+- cmake project
+
+Download source code of QZXing to QZXing_DIR. Add the following line to your CMakeLists.txt file.
+
+```cmake
+add_subdirectory(${QZXing_DIR}/src ${CMAKE_BINARY_DIR}/QZXing)
+
+target_link_libraries(${PROJECT_NAME} PUBLIC QZXing)
+```
+
## Compile the project as an external library
-Open QZXing project (QZXing.pro) and compile. If it is needed to compile as static library, uncomment the following line in the .pro file.
+- Qtcreator
+ + qmake project
+
+ Open QZXing project (QZXing.pro) and compile. If it is needed to compile as static library, uncomment the following line in the .pro file.
```qmake
CONFIG += staticlib
```
+
+ + cmake project
+
+ Open CMakeLists and compile. If it is needed to compile as static library, add the folloing parameter.
+
+```bash
+-DBUILD_SHARED_LIBS=OFF
+```
+
+- Comand line
+ + qmake
+
+```bash
+cd ${QZXing_DIR}
+mkdir build
+cd build
+qmake ../src # Configure
+make # Compile
+make install # Install
+```
+
+ + cmake
+
+```bash
+cd ${QZXing_DIR}
+mkdir build
+cd build
+# Configure
+cmake ..
+# Compile
+cmake --build .
+# Install
+cmake --build . --target install # Install develop library
+# or
+cmake --build . --target install-runtime # Install runtime library
+```
+
## Control dependencies
Project file config tags are now introduced to be able to control the dependencies of the library accoring to the needs.
@@ -72,20 +125,35 @@ Warning! The initial default configuration till 20/03/2017 was including qzxing_
### QZXing (core + QML)
-If an application is going to use QML functionality, it is now possible to add the dependency to it. This can be done by adding the folloing line to the .pro file of its project:
+If an application is going to use QML functionality, it is now possible to add the dependency to it.
+- qmake. This can be done by adding the folloing line to the .pro file of its project:
```qmake
CONFIG += qzxing_qml
```
+- cmake. It can be used by adding the folloing line to parameter of cmake:
+
+```cmake
+-DQZXING_QML=ON
+```
+
### QZXing + QZXingFilter
QZXing includes QZXingFilter, a QAbstractVideoFilter implementation to provide a mean of providing live feed to the decoding library. It automatically includes QML implementation as well.
-This option requires "multimedia" Qt module this is why it is considered as a separate configuration. It can be used by adding the folloing line to the .pro file of a project:
+This option requires "multimedia" Qt module this is why it is considered as a separate configuration.
+- qmake. It can be used by adding the folloing line to the .pro file of a project:
```qmake
CONFIG += qzxing_multimedia
```
+
+- cmake. It can be used by adding the folloing line to parameter of cmake:
+
+```cmake
+-DQZXING_MULTIMEDIA=ON
+```
+
# How to use
diff --git a/appveyor.yml b/appveyor.yml
index cc4cfa8a..e06f1884 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,30 +1,24 @@
-#original author: KangLin(kl222@126.com)
+#original author: Kang Lin(kl222@126.com)
version: '3.0.a.5.{build}'
configuration:
- - release
- - debug
+ - Release
+ - Debug
environment:
matrix:
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ GENERATORS: "Visual Studio 14 2015"
+ QT_ROOT: C:/Qt/5.6/msvc2015
+
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ GENERATORS: "Visual Studio 14 2015 Win64"
+ QT_ROOT: C:/Qt/5.9/msvc2015_64
+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
+ GENERATORS: "Visual Studio 15 2017 Win64"
QT_ROOT: C:/Qt/5.12/msvc2017_64
-# - QT_ROOT: C:/Qt/5.12/msvc2015
-# - QT_ROOT: C:/Qt/5.12/mingw53_32
-
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- QT_ROOT: C:/Qt/5.9/msvc2017_64
-# - QT_ROOT: C:/Qt/5.9/msvc2015_64
-# - QT_ROOT: C:/Qt/5.9/msvc2015
-# - QT_ROOT: C:/Qt/5.9/msvc2013_64
-# - QT_ROOT: C:/Qt/5.9/mingw53_32
-
- - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- QT_ROOT: C:/Qt/5.6/msvc2015_64
-# - QT_ROOT: C:/Qt/5.6/msvc2015
-# - QT_ROOT: C:/Qt/5.6/msvc2013_64
-# - QT_ROOT: C:/Qt/5.6/msvc2013
init:
@@ -75,17 +69,25 @@ install:
- cl
build_script:
- - mkdir "%APPVEYOR_BUILD_FOLDER%/build"
- - cd "%APPVEYOR_BUILD_FOLDER%/build"
- - call "%QT_ROOT%/bin/qmake.exe" CONFIG+=%Configuration% PREFIX="%APPVEYOR_BUILD_FOLDER%/install" "%APPVEYOR_BUILD_FOLDER%/src/QZXing.pro"
+ # Test qmake
+ - mkdir "%APPVEYOR_BUILD_FOLDER%/build_qmake"
+ - cd "%APPVEYOR_BUILD_FOLDER%/build_qmake"
+ - call "%QT_ROOT%/bin/qmake.exe" CONFIG+=%Configuration% PREFIX="%APPVEYOR_BUILD_FOLDER%/install_qmake" "%APPVEYOR_BUILD_FOLDER%/src"
- call %MAKE%
- - call %MAKE% install
+ - call %MAKE% install
+
+ # Test cmake
+ - mkdir "%APPVEYOR_BUILD_FOLDER%/build_cmake"
+ - cd "%APPVEYOR_BUILD_FOLDER%/build_cmake"
+ - cmake.exe -G"%GENERATORS%" -DCMAKE_INSTALL_PREFIX="%APPVEYOR_BUILD_FOLDER%/install_cmake" -DQt5_DIR="%QT_ROOT%/lib/cmake/Qt5" "%APPVEYOR_BUILD_FOLDER%/src"
+ - cmake --build . --config %Configuration%
+ - cmake --build . --config %Configuration% --target install
test_script:
artifacts:
- - path: install
- name: QZXing_$(QMAKE_XSPEC)$(TOOLCHAIN_VERSION)_$(CONFIGURATION)_$(BUILD_VERSION)
+ - path: install_qmake
+ name: QZXing_$(QMAKE_XSPEC)$(TOOLCHAIN_VERSION)_$(CONFIGURATION)_Qt$(QT_VERSION)_$(BUILD_VERSION)
type: zip
# whitelist branches to avoid testing feature branches twice (as branch and as pull request)
diff --git a/ci/build-install-tools.sh b/ci/build-install-tools.sh
index 4f5f7927..2411359a 100644
--- a/ci/build-install-tools.sh
+++ b/ci/build-install-tools.sh
@@ -1,74 +1,190 @@
#!/bin/bash
-#Author: KangLin(kl222@126.com)
+#Author: Kang Lin(kl222@126.com)
set -e
-
SOURCE_DIR="`pwd`"
echo $SOURCE_DIR
TOOLS_DIR=${SOURCE_DIR}/Tools
-echo ${TOOLS_DIR}
+PACKAGE_DIR=${SOURCE_DIR}/Package
+ThirdLibs_DIR=${TOOLS_DIR}/ThirdLibs
-if [ ! -f "${TOOLS_DIR}" ]; then
- mkdir -p ${TOOLS_DIR}
+if [ ! -d "${TOOLS_DIR}" ]; then
+ mkdir ${TOOLS_DIR}
+fi
+if [ ! -d "$PACKAGE_DIR" ]; then
+ mkdir -p $PACKAGE_DIR
fi
function function_common()
{
cd ${TOOLS_DIR}
-
- # Qt download and install:https://github.com/benlau/qtci
- if [ -n "${QT_VERSION}" ]; then
+
+ # See: https://github.com/benlau/qtci
+ cd ${TOOLS_DIR}
+ if [ "$DOWNLOAD_QT" = "TRUE" ]; then
QT_DIR=`pwd`/Qt/${QT_VERSION}
+ cd ${PACKAGE_DIR}
if [ ! -d "${QT_DIR}" ]; then
- wget -c --no-check-certificate -nv http://download.qt.io/official_releases/qt/${QT_VERSION_DIR}/${QT_VERSION}/qt-opensource-linux-x64-${QT_VERSION}.run
- bash ${SOURCE_DIR}/ci/qt-installer.sh qt-opensource-linux-x64-${QT_VERSION}.run ${QT_DIR}
- rm qt-opensource-linux-x64-${QT_VERSION}.run
+ if [ "${QT_VERSION}" = "5.6.3" ]; then
+ if [ ! -f qt-opensource-linux-x64-android-${QT_VERSION}.run ]; then
+ wget -c --no-check-certificate -nv http://download.qt.io/official_releases/qt/${QT_VERSION_DIR}/${QT_VERSION}/qt-opensource-linux-x64-android-${QT_VERSION}.run
+ fi
+ bash ${SOURCE_DIR}/ci/qt-installer.sh qt-opensource-linux-x64-android-${QT_VERSION}.run ${QT_DIR}
+ #rm qt-opensource-linux-x64-android-${QT_VERSION}.run
+ else
+ if [ ! -f qt-opensource-linux-x64-${QT_VERSION}.run ]; then
+ wget -c --no-check-certificate -nv http://download.qt.io/official_releases/qt/${QT_VERSION_DIR}/${QT_VERSION}/qt-opensource-linux-x64-${QT_VERSION}.run
+ fi
+ bash ${SOURCE_DIR}/ci/qt-installer.sh qt-opensource-linux-x64-${QT_VERSION}.run ${QT_DIR}
+ #rm qt-opensource-linux-x64-${QT_VERSION}.run
+ fi
fi
fi
+
+ cd ${SOURCE_DIR}
}
-function function_android()
+function install_android()
{
+ if [ -n "$1" ]; then
+ NDK="ndk-bundle"
+ fi
cd ${TOOLS_DIR}
+ if [ ! -d "`pwd`/android-sdk" ]; then
+ cd ${PACKAGE_DIR}
+ ANDROID_STUDIO_VERSION=191.5900203
+ if [ ! -f android-studio-ide-${ANDROID_STUDIO_VERSION}-linux.tar.gz ]; then
+ wget -c -nv https://dl.google.com/dl/android/studio/ide-zips/3.5.1.0/android-studio-ide-${ANDROID_STUDIO_VERSION}-linux.tar.gz
+ fi
+ tar xzf android-studio-ide-${ANDROID_STUDIO_VERSION}-linux.tar.gz -C ${TOOLS_DIR}
+ cd ${TOOLS_DIR}
+ export JAVA_HOME=`pwd`/android-studio/jre
+ export PATH=${JAVA_HOME}/bin:$PATH
+ cd ${PACKAGE_DIR}
+ SDK_PACKAGE=sdk-tools-linux-4333796.zip
+ if [ ! -f ${SDK_PACKAGE} ]; then
+ wget -c -nv https://dl.google.com/android/repository/${SDK_PACKAGE}
+ fi
+ cd ${TOOLS_DIR}
+ mkdir android-sdk
+ cd android-sdk
+ unzip -q ${PACKAGE_DIR}/${SDK_PACKAGE} -d `pwd`
+
+ echo "Install sdk and ndk ......"
+ if [ -n "${ANDROID_API}" ]; then
+ PLATFORMS="platforms;${ANDROID_API}"
+ else
+ PLATFORMS="platforms"
+ fi
+ if [ -z "${BUILD_TOOS_VERSION}" ]; then
+ BUILD_TOOS_VERSION="28.0.3"
+ fi
+ (sleep 5 ; num=0 ; while [ $num -le 5 ] ; do sleep 1 ; num=$(($num+1)) ; printf 'y\r\n' ; done ) \
+ | ./tools/bin/sdkmanager "platform-tools" "build-tools;${BUILD_TOOS_VERSION}" "${PLATFORMS}" ${NDK}
+ if [ -n "${NDK}" ]; then
+ if [ ! -d ${TOOLS_DIR}/android-ndk ]; then
+ ln -s ${TOOLS_DIR}/android-sdk/ndk-bundle ${TOOLS_DIR}/android-ndk
+ fi
+ fi
+ fi
+}
- #Download android ndk
- if [ ! -d "`pwd`/android-ndk" ]; then
- wget -c -nv http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin
- chmod u+x android-ndk-r10e-linux-x86_64.bin
- ./android-ndk-r10e-linux-x86_64.bin > /dev/null
- mv android-ndk-r10e android-ndk
- rm android-ndk-r10e-linux-x86_64.bin
+function install_android_sdk_and_ndk()
+{
+ install_android
+ NDK_PACKAGE=android-ndk-r21-linux-x86_64.zip
+ cd ${PACKAGE_DIR}
+ if [ ! -f ${NDK_PACKAGE} ]; then
+ wget -c -nv https://dl.google.com/android/repository/${NDK_PACKAGE}
fi
+ unzip -q ${NDK_PACKAGE} -d ${TOOLS_DIR}
+ cd ${TOOLS_DIR}
+ mv android-ndk-r21 android-ndk
+}
+function function_android()
+{
cd ${TOOLS_DIR}
- #Download android sdk
- if [ ! -d "`pwd`/android-sdk" ]; then
- wget -c -nv https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
- tar xf android-sdk_r24.4.1-linux.tgz
- mv android-sdk-linux android-sdk
- rm android-sdk_r24.4.1-linux.tgz
- (sleep 5 ; while true ; do sleep 1 ; printf 'y\r\n' ; done ) \
- | android-sdk/tools/android update sdk -u -t tool,android-18,android-24,extra,platform,platform-tools,build-tools-25
- fi
+ sudo apt-get update -y -qq
+ #sudo apt-get install -qq -y openjdk-11-jdk
+ # install oracle jdk
+ #sudo add-apt-repository ppa:linuxuprising/java -y
+ #sudo apt update
+ #(sleep 5 ; while true ; do sleep 1 ; printf '\r\n' ; done ) | sudo apt install oracle-java11-installer -qq -y
+
+ #sudo apt install oracle-java11-set-default -qq -y
+ #sudo apt-get install ant -qq -y
+ sudo apt-get install libicu-dev -qq -y
+ sudo apt-get install -qq -y libxkbcommon-x11-dev libglu1-mesa-dev
+ install_android_sdk_and_ndk
function_common
+
cd ${SOURCE_DIR}
}
-function function_linux()
+function function_unix()
{
+ if [ "$DOWNLOAD_QT" != "TRUE" -a "$DOWNLOAD_QT" != "APT" ]; then
+ #See: https://launchpad.net/~beineri
+ sudo add-apt-repository ppa:beineri/opt-qt-${QT_VERSION}-`lsb_release -c|awk '{print $2}'` -y
+ fi
+
+ sudo apt-get update -y -qq
+ sudo apt-get install debhelper fakeroot -y -qq
+ sudo apt-get install -y -qq libglu1-mesa-dev \
+ libxkbcommon-x11-dev \
+ libpulse-mainloop-glib0 \
+ libgstreamer1.0-dev \
+ libgstreamer-plugins-base1.0-dev \
+ gstreamer1.0-pulseaudio \
+ libmysql-cil-dev libmysql-cil-dev libmysql-ocaml-dev \
+ libmysql++-dev libmysqld-dev libmysqlcppconn-dev \
+ libmysqlclient-dev \
+ libodbc1
+
+ if [ "$DOWNLOAD_QT" = "APT" ]; then
+ sudo apt-get install -y -qq qttools5-dev qttools5-dev-tools \
+ qtbase5-dev qtbase5-dev-tools \
+ qtmultimedia5-dev \
+ qtquickcontrols2-5-dev \
+ qtdeclarative5-dev \
+ libqt5svg5-dev
+ sudo ln -s /usr/lib/`uname -m`-linux-gnu/cmake /usr/lib/`uname -m`-linux-gnu/qt5/cmake
+ elif [ "$DOWNLOAD_QT" != "TRUE" ]; then
+ sudo apt-get install -y -qq qt${QT_VERSION_DIR}base \
+ qt${QT_VERSION_DIR}tools \
+ qt${QT_VERSION_DIR}multimedia \
+ qt${QT_VERSION_DIR}svg \
+ qt${QT_VERSION_DIR}quickcontrols2 \
+ qt${QT_VERSION_DIR}declarative
+ fi
function_common
cd ${SOURCE_DIR}
}
+function function_mingw()
+{
+ cd ${SOURCE_DIR}
+ if [ "true" == "$RABBITIM_BUILD_THIRDLIBRARY" ]; then
+ export RABBITIM_BUILD_CROSS_HOST=i686-w64-mingw32 #i586-mingw32msvc
+ fi
+
+ function_common
+ cd ${SOURCE_DIR}
+}
+
case ${BUILD_TARGERT} in
- android*)
+ android)
function_android
;;
- linux)
- function_linux
+ unix)
+ function_unix
+ ;;
+ windows_mingw)
+ function_mingw
;;
*)
echo "There aren't ${BUILD_TARGERT}"
diff --git a/ci/build_env.sh b/ci/build_env.sh
index 8434b38d..d641ed6f 100644
--- a/ci/build_env.sh
+++ b/ci/build_env.sh
@@ -1,4 +1,4 @@
-#Author: KangLin(kl222@126.com)
+#Author: Kang Lin(kl222@126.com)
SOURCE_DIR="`pwd`"
echo $SOURCE_DIR
@@ -7,11 +7,20 @@ TOOLS_DIR=${SOURCE_DIR}/Tools
cd ${TOOLS_DIR}
case "${BUILD_TARGERT}" in
- linux)
- QT_DIR=`pwd`/Qt/${QT_VERSION}
- export QT_ROOT=${QT_DIR}/${QT_VERSION}/gcc_64
+ unix)
+ if [ "$DOWNLOAD_QT" = "APT" ]; then
+ export QT_ROOT=/usr/lib/`uname -m`-linux-gnu/qt5
+ elif [ "$DOWNLOAD_QT" = "TRUE" ]; then
+ QT_DIR=${TOOLS_DIR}/Qt/${QT_VERSION}
+ export QT_ROOT=${QT_DIR}/${QT_VERSION}/gcc_64
+ else
+ #source /opt/qt${QT_VERSION_DIR}/bin/qt${QT_VERSION_DIR}-env.sh
+ export QT_ROOT=/opt/qt${QT_VERSION_DIR}
+ fi
+ export PATH=$QT_ROOT/bin:$PATH
+ export LD_LIBRARY_PATH=$QT_ROOT/lib/i386-linux-gnu:$QT_ROOT/lib:$LD_LIBRARY_PATH
;;
- android*)
+ android)
export ANDROID_NDK_ROOT=`pwd`/android-ndk
export ANDROID_NDK=$ANDROID_NDK_ROOT
diff --git a/ci/qt-installer.sh b/ci/qt-installer.sh
index 6eb39ca8..4e09bcd9 100644
--- a/ci/qt-installer.sh
+++ b/ci/qt-installer.sh
@@ -1,8 +1,11 @@
#!/bin/bash
+#Author: Kang Lin(kl222@126.com)
+
#http://stackoverflow.com/questions/25105269/silent-install-qt-run-installer-on-ubuntu-server
#http://doc.qt.io/qtinstallerframework/noninteractive.html
#参考:https://github.com/benlau/qtci
+# https://github.com/rabits/dockerfiles
# https://github.com/mjscosta/qt-silent-installer
set -e #quit on error
@@ -13,23 +16,47 @@ then
exit -1
fi
+function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
+function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; }
+function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
+function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
+
export PATH=$PATH:$PWD
export WORKDIR=$PWD
INSTALLER=$1
OUTPUT=$2
SCRIPT="$(mktemp /tmp/tmp.XXXXXXXXX)"
-case $BUILD_TARGERT in
- android_arm*)
- SELECTEDPACKAGES=android_armv7
+
+case $BUILD_ARCH in
+ unix)
+ SELECTEDPACKAGES=gcc_64
;;
- android_x86)
- SELECTEDPACKAGES=android_x86
+ arm*|x86*)
+ if version_ge $QT_VERSION_DIR 5.14 ; then
+ SELECTEDPACKAGES=android
+ else
+ case $BUILD_ARCH in
+ arm)
+ SELECTEDPACKAGES=android_armv7
+ ;;
+ arm64)
+ SELECTEDPACKAGES=android_arm64_v8a
+ ;;
+ x86)
+ SELECTEDPACKAGES=android_x86
+ ;;
+ x86_64)
+ SELECTEDPACKAGES=android_x86_64
+ ;;
+ *)
+ echo "Aach[$BUILD_ARCH] don't suppoert"
+ ;;
+ esac
+ fi
;;
- linux)
- SELECTEDPACKAGES=gcc_64
+ *)
+ echo "Aach[$BUILD_ARCH] don't suppoert"
;;
- *)
- echo "Aach[$RABBIT_ARCH] don't suppoert"
esac
cat < $SCRIPT
@@ -47,10 +74,19 @@ function log() {
}
Controller.prototype.WelcomePageCallback = function() {
- gui.clickButton(buttons.NextButton, 5000);
+ gui.clickButton(buttons.NextButton, 3000);
}
Controller.prototype.CredentialsPageCallback = function() {
+ var login = installer.environmentVariable("QT_USER");
+ var password = installer.environmentVariable("QT_PASSWORD");
+ if( login === "" || password === "" ) {
+ console.log("No credentials provided - could stuck here forever");
+ gui.clickButton(buttons.CommitButton);
+ }
+ var widget = gui.currentPageWidget();
+ widget.loginWidget.EmailLineEdit.setText(login);
+ widget.loginWidget.PasswordLineEdit.setText(password);
gui.clickButton(buttons.CommitButton);
}
@@ -128,6 +164,7 @@ Controller.prototype.FinishedPageCallback = function() {
EOF
chmod u+x $1
-
+#显示log
$1 -v --script $SCRIPT
-
+#不显示log
+#$1 --script $SCRIPT
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 00000000..c185f9b5
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,23 @@
+
+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+STRING(REGEX REPLACE "\n" ";" files "${files}")
+FOREACH(file ${files})
+ MESSAGE(STATUS "Uninstalling \"${file}\"")
+ IF(EXISTS "${file}")
+ EXEC_PROGRAM(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ IF("${rm_retval}" STREQUAL 0)
+ ELSE("${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
+ ENDIF("${rm_retval}" STREQUAL 0)
+ ELSE(EXISTS "${file}")
+ MESSAGE(STATUS "File \"${file}\" does not exist.")
+ ENDIF(EXISTS "${file}")
+ENDFOREACH(file)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9ead55ed..9e429553 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,87 +1,231 @@
-cmake_minimum_required(VERSION 3.2)
+# Author: Kang Lin (kl222@126.com)
+
+cmake_minimum_required(VERSION 2.8.12)
+
+if(POLICY CMP0100)
+ cmake_policy(SET CMP0100 NEW)
+endif()
+
+if(POLICY CMP0077)
+ cmake_policy(SET CMP0077 NEW)
+endif()
+
project(QZXing)
-find_package(Qt5 COMPONENTS Core REQUIRED)
-find_package(Qt5 COMPONENTS Gui REQUIRED)
-find_package(Qt5 COMPONENTS Multimedia )
-find_package(Qt5 REQUIRED Svg Quick QuickControls2)
+# TODO: Modify the version to the correct version
+SET(BUILD_VERSION "2.3")
+# Find Git Version Patch
+IF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+ if(NOT GIT)
+ SET(GIT $ENV{GIT})
+ endif()
+ if(NOT GIT)
+ FIND_PROGRAM(GIT NAMES git git.exe git.cmd)
+ endif()
+ IF(GIT)
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT} describe --tags
+ OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT GIT_VERSION)
+ EXECUTE_PROCESS(
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${GIT} rev-parse --short HEAD
+ OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif()
+ SET(BUILD_VERSION ${GIT_VERSION})
+ ENDIF()
+ENDIF()
+message("BUILD_VERSION:${BUILD_VERSION}")
+set(VERSION ${BUILD_VERSION})
+
+# Open qt compile tools
+SET(CMAKE_AUTOUIC ON)
+SET(CMAKE_AUTOMOC ON)
+SET(CMAKE_AUTORCC ON)
+SET(CMAKE_INCLUDE_CURRENT_DIR ON)
+SET(CMAKE_VERBOSE_MAKEFILE ON)
+
+include(CMakePackageConfigHelpers)
+include(GNUInstallDirs)
+include(GenerateExportHeader)
+include(CMakeDependentOption)
SET(BIGINT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zxing/bigint)
SET(WIN32_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zxing/win32/zxing)
SET(ZXING_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zxing/zxing)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_WARN_ON)
+set(INSTALL_HEADER_FILES
+ QZXing.h
+ QZXing_global.h
+ )
-set(SOURCES
+set(HEADER_FILES
+ CameraImageWrapper.h
+ ImageHandler.h
+ ${INSTALL_HEADER_FILES}
+ )
+set(SOURCE_FILES
CameraImageWrapper.cpp
- CameraImageWrapper.h
ImageHandler.cpp
- ImageHandler.h
QZXing.cpp
- QZXing.h
- QZXing_global.h
)
-if(QZXING_MULTIMEDIA)
-
- LIST(APPEND SOURCES QZXingFilter.cpp QZXingFilter.h)
- add_definitions(-DQZXING_MULTIMEDIA)
+add_library(${PROJECT_NAME} ${SOURCE_FILES} ${HEADER_FILES})
+set_target_properties(${PROJECT_NAME} PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+ ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
+ PUBLIC_HEADER "${INSTALL_HEADER_FILES}" # Install head files
+ VERSION ${BUILD_VERSION})
+target_compile_definitions(${PROJECT_NAME} PRIVATE
+ QZXING_LIBRARY ZXING_ICONV_CONST)
- SET(QZXING_USE_QML ON)
+# Need qt components
+SET(QT_COMPONENTS Core Gui)
+option(QZXING_MULTIMEDIA "Use multimedia" ON)
+if(QZXING_MULTIMEDIA)
+ target_sources(${PROJECT_NAME} PRIVATE QZXingFilter.cpp QZXingFilter.h)
+ target_compile_definitions(${PROJECT_NAME} PRIVATE QZXING_MULTIMEDIA)
+ LIST(APPEND QT_COMPONENTS Multimedia)
endif(QZXING_MULTIMEDIA)
-if(QZXING_USE_QML)
- LIST(APPEND SOURCES QZXingImageProvider.cpp QZXingImageProvider.h)
- add_definitions(-DQZXING_QML)
-endif(QZXING_USE_QML)
-
-add_library(qzxing "" ${SOURCES})
-
+cmake_dependent_option(QZXING_QML "Use qml" ON
+ QZXING_MULTIMEDIA OFF)
+if(QZXING_QML)
+ target_sources(${PROJECT_NAME} PRIVATE QZXingImageProvider.cpp QZXingImageProvider.h)
+ LIST(APPEND EXPORT_DEFINES QZXING_QML)
+ LIST(APPEND QT_COMPONENTS Quick)
+endif(QZXING_QML)
+
+find_package(Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
+message("Qt5_VERSION:${Qt5_VERSION}")
+if(Qt5_VERSION VERSION_LESS "5.0.0")
+ message(FATAL_ERROR "Current qt version:${Qt5_VERSION}, Qt must greater then 5.0.0")
+endif()
+FOREACH(_COMPONENT ${QT_COMPONENTS})
+ LIST(APPEND QT_LIBRARIES ${Qt5${_COMPONENT}_LIBRARIES})
+ENDFOREACH()
+get_filename_component(QT_INSTALL_DIR "${Qt5_DIR}/../../.." ABSOLUTE)
+
+target_link_libraries(${PROJECT_NAME} PRIVATE ${QT_LIBRARIES})
+
+cmake_dependent_option(QZXING_ENABLE_ENCODER "Enable encoder" ON
+ QZXING_MULTIMEDIA OFF)
+if(QZXING_ENABLE_ENCODER)
+ LIST(APPEND EXPORT_DEFINES ENABLE_ENCODER_GENERIC)
+endif()
+
+if(MSVC)
+ target_compile_options(${PROJECT_NAME} PRIVATE /MP)
+endif()
+
+# iconv
if(WIN32)
- add_subdirectory(zxing/win32)
- if(MSVC)
- add_definitions(-D__STDC_LIMIT_MACROS)
- endif(MSVC)
-
- add_definitions(-DNO_ICONV)
-endif(WIN32)
-
-if(VS_WINRT_COMPONENT)
- add_definitions(-DNO_ICONV)
-endif(VS_WINRT_COMPONENT)
+ SET(QZXING_ENABLE_ICONV ON)
+else()
+ SET(QZXING_ENABLE_ICONV OFF)
+endif()
+option(QZXING_ENABLE_ICONV "Enable iconv" ${QZXING_ENABLE_ICONV})
+if(QZXING_ENABLE_ICONV)
+ if(WIN32)
+ add_subdirectory(zxing/win32)
+ if(MSVC)
+ target_compile_definitions(${PROJECT_NAME} PRIVATE -D__STDC_LIMIT_MACROS)
+ endif(MSVC)
+ endif(WIN32)
+else()
+ target_compile_definitions(${PROJECT_NAME} PRIVATE NO_ICONV)
+endif()
add_subdirectory(zxing/bigint)
add_subdirectory(zxing/zxing)
-target_link_libraries(qzxing Qt5::Core Qt5::Gui)
-
-if(QZXING_MULTIMEDIA)
- target_link_libraries(qzxing Qt5::Multimedia)
-endif(QZXING_MULTIMEDIA)
-
-if(QZXING_USE_QML)
- target_link_libraries(qzxing
- Qt5::Svg
- Qt5::Quick
- Qt5::QuickControls2)
-endif(QZXING_USE_QML)
-
-# Change Global Definitions depending on how you want to use the library
-target_compile_definitions(qzxing PUBLIC DISABLE_LIBRARY_FEATURES)
-
# Target includes
-target_include_directories(qzxing
- PRIVATE
+target_include_directories(${PROJECT_NAME}
+ PRIVATE
.
zxing
zxing/win32/zxing
zxing/zxing
zxing/bigint
- PUBLIC
- $
+ $
+)
+
+# Export defines by configure_file
+target_compile_definitions(${PROJECT_NAME} PUBLIC ${EXPORT_DEFINES})
+
+# Install
+
+# Install runtime target
+add_custom_target(install-runtime
+ COMMAND
+ "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=Runtime
+ -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake"
)
+if(ANDROID)
+ # Install target
+ INSTALL(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}Config
+ RUNTIME DESTINATION "libs/${ANDROID_ABI}"
+ COMPONENT Runtime
+ LIBRARY DESTINATION "libs/${ANDROID_ABI}"
+ COMPONENT Runtime
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ )
+else()
+ # Install target
+ if(WIN32)
+ INSTALL(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}Config
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ COMPONENT Runtime
+ LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ COMPONENT Runtime
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ )
+ else()
+ INSTALL(TARGETS ${PROJECT_NAME}
+ EXPORT ${PROJECT_NAME}Config
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ COMPONENT Runtime
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ COMPONENT Runtime
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ )
+ endif()
+endif()
+
+export(TARGETS ${PROJECT_NAME}
+ APPEND FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+)
+# Install cmake configure files
+install(EXPORT ${PROJECT_NAME}Config
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
+ )
+write_basic_package_version_file(
+ "${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+ VERSION ${BUILD_VERSION}
+ COMPATIBILITY AnyNewerVersion)
+install(FILES "${CMAKE_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
+
+# Install pkg-config configure file
+foreach(ed ${EXPORT_DEFINES})
+ set(PC_EXPORT_DEFINES "${PC_EXPORT_DEFINES} -D${ed}")
+endforeach()
+configure_file(QZXing.pc.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
+install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
diff --git a/src/QZXing-components.pri b/src/QZXing-components.pri
index 77641156..f4f8cd33 100644
--- a/src/QZXing-components.pri
+++ b/src/QZXing-components.pri
@@ -14,11 +14,10 @@
# limitations under the License.
#
-CONFIG += qt warn_on
+CONFIG += qt warn_on
-DEFINES += QZXING_LIBRARY \
- ZXING_ICONV_CONST \
- DISABLE_LIBRARY_FEATURES
+DEFINES += ZXING_ICONV_CONST \
+ DISABLE_LIBRARY_FEATURES
INCLUDEPATH += $$PWD \
$$PWD/zxing
@@ -391,7 +390,8 @@ enable_generic_qrcode {
}
enable_encoder_generic {
- DEFINES += ENABLE_ENCODER_GENERIC
+ DEFINES *= ENABLE_ENCODER_GENERIC
+ PC_EXPORT_DEFINES *= -DENABLE_ENCODER_GENERIC
HEADERS += \
$$PWD/zxing/zxing/EncodeHint.h \
@@ -410,7 +410,7 @@ qzxing_multimedia {
CONFIG += qzxing_qml
DEFINES += QZXING_MULTIMEDIA
- PRL_EXPORT_DEFINES += QZXING_MULTIMEDIA
+ PRL_EXPORT_DEFINES += QZXING_MULTIMEDIA
HEADERS += \
$$PWD/QZXingFilter.h
@@ -424,7 +424,8 @@ qzxing_qml {
greaterThan(QT_MAJOR_VERSION, 4): QT += quick
DEFINES += QZXING_QML
- PRL_EXPORT_DEFINES += QZXING_QML
+ PRL_EXPORT_DEFINES += QZXING_QML
+ PC_EXPORT_DEFINES *= -DQZXING_QML
HEADERS += \
$$PWD/QZXingImageProvider.h
@@ -457,22 +458,26 @@ symbian {
DEFINES += NOFMAXL
- # Installation
- headers.files = $$PWD/QZXing.h $$PWD/QZXing_global.h
- headers.path = $$PREFIX/include
- target.path = $$PREFIX/lib
- INSTALLS += headers target
+ # Installation
+ headers.files = $$PWD/QZXing.h $$PWD/QZXing_global.h
+ headers.path = $$PREFIX/include
+ target.path = $$PREFIX/lib
+ INSTALLS *= headers target
- # pkg-config support
- CONFIG += create_pc create_prl no_install_prl
- QMAKE_PKGCONFIG_DESTDIR = pkgconfig
- QMAKE_PKGCONFIG_LIBDIR = ${prefix}/lib
- QMAKE_PKGCONFIG_INCDIR = ${prefix}/include
+ # pkg-config support
+ CONFIG *= create_pc
+ QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+ QMAKE_PKGCONFIG_LIBDIR = ${prefix}/lib
+ QMAKE_PKGCONFIG_INCDIR = ${prefix}/include
+ QMAKE_PKGCONFIG_CFLAGS = $$PC_EXPORT_DEFINES
- unix:QMAKE_CLEAN += -r pkgconfig lib$${TARGET}.prl
+ # create prl
+ CONFIG *= create_prl
+
+ unix: QMAKE_CLEAN += -r pkgconfig lib$${TARGET}.prl
}
-win32-msvc*{
+win32-msvc* {
DEFINES += __STDC_LIMIT_MACROS
@@ -484,7 +489,7 @@ win32-msvc*{
SOURCES += $$PWD/zxing/win32/zxing/win_iconv.c
}
-win32-g++{
+win32-g++ {
INCLUDEPATH += $$PWD/zxing/win32/zxing
@@ -493,9 +498,11 @@ win32-g++{
SOURCES += $$PWD/zxing/win32/zxing/win_iconv.c
}
-!win32{
- DEFINES += NO_ICONV
-}
-winrt {
- DEFINES += NO_ICONV
+!enable_iconv {
+ !win32{
+ DEFINES += NO_ICONV
+ }
+ winrt {
+ DEFINES += NO_ICONV
+ }
}
diff --git a/src/QZXing.h b/src/QZXing.h
index 5fa8366a..5010d21a 100644
--- a/src/QZXing.h
+++ b/src/QZXing.h
@@ -52,7 +52,7 @@ struct QZXingEncoderConfig;
*/
class
#ifndef DISABLE_LIBRARY_FEATURES
- QZXINGSHARED_EXPORT
+ QZXINGSHARED_EXPORT
#endif
QZXing : public QObject {
diff --git a/src/QZXing.pc.in b/src/QZXing.pc.in
new file mode 100644
index 00000000..0d9f9089
--- /dev/null
+++ b/src/QZXing.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: @PROJECT_NAME@
+Description: @PROJECT_NAME@ Library
+Version: @BUILD_VERSION@
+Libs: -L${libdir} -l@PROJECT_NAME@
+Cflags: @PC_EXPORT_DEFINES@ -I${includedir}
diff --git a/src/QZXing.pro b/src/QZXing.pro
index b080ef90..0998294b 100644
--- a/src/QZXing.pro
+++ b/src/QZXing.pro
@@ -24,12 +24,15 @@ CONFIG += \
#staticlib
#qzxing_qml
#qzxing_multimedia
+ #enable_iconv
VERSION = 2.3
TARGET = QZXing
TEMPLATE = lib
-DEFINES -= DISABLE_LIBRARY_FEATURES
+DEFINES *= QZXING_LIBRARY
include(QZXing-components.pri)
+
+DEFINES -= DISABLE_LIBRARY_FEATURES
diff --git a/src/zxing/bigint/CMakeLists.txt b/src/zxing/bigint/CMakeLists.txt
index b67ffa96..16a239fe 100644
--- a/src/zxing/bigint/CMakeLists.txt
+++ b/src/zxing/bigint/CMakeLists.txt
@@ -13,4 +13,4 @@ SET(SOURCES
${BIGINT_DIR}/NumberlikeArray.hh
)
-target_sources(qzxing PRIVATE ${SOURCES})
+target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})
diff --git a/src/zxing/win32/CMakeLists.txt b/src/zxing/win32/CMakeLists.txt
index fc69c38a..47dc21dd 100644
--- a/src/zxing/win32/CMakeLists.txt
+++ b/src/zxing/win32/CMakeLists.txt
@@ -1,11 +1,11 @@
SET(SOURCES
- ${WIN32_DIR}/zxing/iconv.h
- ${WIN32_DIR}/zxing/win_iconv.c
+ ${WIN32_DIR}/iconv.h
+ ${WIN32_DIR}/win_iconv.c
)
if(MSVC)
- LIST(APPEND SOURCES ${WIN32_DIR}/zxing/msvc/stdint.h)
+ LIST(APPEND SOURCES ${WIN32_DIR}/msvc/stdint.h)
endif(MSVC)
-target_sources(qzxing PRIVATE ${SOURCES})
+target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})
diff --git a/src/zxing/zxing/CMakeLists.txt b/src/zxing/zxing/CMakeLists.txt
index 9548cd79..38f09cd1 100644
--- a/src/zxing/zxing/CMakeLists.txt
+++ b/src/zxing/zxing/CMakeLists.txt
@@ -46,6 +46,7 @@ SET(SOURCES
)
+target_compile_definitions(${PROJECT_NAME} PRIVATE ENABLE_DECODER_AZTEC)
SET(AZTEC_DIR
${ZXING_DIR}/aztec/AztecDetectorResult.cpp
@@ -118,6 +119,7 @@ SET(COMMON_DIR
)
+target_compile_definitions(${PROJECT_NAME} PRIVATE ENABLE_DECODER_DATA_MATRIX)
SET(DATAMATRIX_DIR
${ZXING_DIR}/datamatrix/DataMatrixReader.cpp
@@ -162,6 +164,7 @@ SET(MULTI_DIR
)
+target_compile_definitions(${PROJECT_NAME} PRIVATE ENABLE_DECODER_1D_BARCODES)
SET(ONED_DIR
${ZXING_DIR}/oned/UPCEReader.h
@@ -263,6 +266,7 @@ SET(ONED_DIR
)
+target_compile_definitions(${PROJECT_NAME} PRIVATE ENABLE_DECODER_PDF17)
SET(PDF417_DIR
${ZXING_DIR}/pdf417/PDF417Reader.cpp
@@ -289,6 +293,8 @@ SET(PDF417_DIR
)
+target_compile_definitions(${PROJECT_NAME} PRIVATE
+ ENABLE_DECODER_QR_CODE ENABLE_ENCODER_QR_CODE)
SET(QRCODE_DIR
${ZXING_DIR}/qrcode/ErrorCorrectionLevel.h
@@ -340,7 +346,7 @@ SET(QRCODE_DIR
)
-target_sources(qzxing PRIVATE
+target_sources(${PROJECT_NAME} PRIVATE
${SOURCES}
${AZTEC_DIR}
${COMMON_DIR}