11cmake_minimum_required (VERSION 3.20 )
22
3- project (QmlMobileScanner VERSION 0.3 LANGUAGES C CXX )
3+ project (QmlMobileScanner VERSION 0.4 LANGUAGES C CXX )
44
55set (CMAKE_CXX_STANDARD 20)
66set (CMAKE_CXX_STANDARD_REQUIRED ON )
77set (CMAKE_AUTOMOC ON )
88set (CMAKE_AUTORCC ON )
99set (CMAKE_INCLUDE_CURRENT_DIR ON )
1010
11- string (TIMESTAMP CURRENT_TIMESTAMP "%s" UTC )
1211set (APP_NAME ${CMAKE_PROJECT_NAME } )
1312set (APP_VERSION ${CMAKE_PROJECT_VERSION} )
14- set (APP_VERSION_CODE ${TIMESTAMP} )
13+
14+ option (USE_QZXING "Build with QZXing support (decoder&encoder)" OFF )
15+ option (USE_ZXINGCPP "Build with zxing-cpp support (decoder&encoder)" ON )
16+ option (USE_ZINT "Build with zint support (encoder)" OFF )
1517
1618################################################################################
1719
@@ -51,7 +53,7 @@ set(SOURCES
5153 thirdparty/IconLibrary/IconLibrary_material.qrc
5254)
5355
54- if (IOS OR ANDROID )
56+ if (IOS OR ANDROID )
5557 # Mobile
5658 set (QAPPLICATION_CLASS QGuiApplication)
5759else ()
@@ -128,14 +130,12 @@ target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
128130 Qt6::QuickControls2
129131)
130132
131- if (NOT IOS AND NOT ANDROID )
133+ if (NOT IOS AND NOT ANDROID )
132134 # for proper systray and menubar support
133135 find_package (Qt6 REQUIRED COMPONENTS Widgets )
134136 target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE Qt6::Widgets )
135137endif ()
136138
137- add_definitions (-DENABLE_ZXING )
138-
139139if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
140140 #
141141endif ()
@@ -160,30 +160,44 @@ target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE MobileSharing)
160160add_subdirectory (thirdparty/ComponentLibrary )
161161target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE ComponentLibraryplugin )
162162
163- # QZxing-cpp
164- #set(qzxing true)
165- #add_definitions(-Dqzxing)
166- #add_subdirectory(thirdparty/QZXing)
167- #target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE QZXing)
163+ if (USE_ZXINGCPP)
164+ # build zxing-cpp
165+ add_subdirectory (thirdparty/zxing-cpp )
166+ target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE ZXing )
167+
168+ # build zxing-cpp Qt wrapper
169+ add_subdirectory (thirdparty/zxing-cpp/wrappers/qt )
170+ target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE ZXingQt )
171+
172+ set (zxingcpp true )
173+ add_definitions (-Dzxingcpp )
174+ elseif (USE_QZXING)
175+ # build QZxing
176+ add_subdirectory (thirdparty/QZXing )
177+ target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE QZXing )
168178
169- # zxing-cpp
170- add_subdirectory (thirdparty/zxing-cpp )
171- target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE ZXing )
179+ set (qzxing true )
180+ add_definitions (-Dqzxing )
181+ else ()
182+ endif ()
172183
173- # zxing-cpp Qt wrapper
174- set (zxingcpp true )
175- add_definitions (-Dzxingcpp )
176- add_subdirectory (thirdparty/zxing-cpp/wrappers/qt/ )
177- target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE ZXingQt )
184+ if (USE_ZINT)
185+ # build zint
186+ add_subdirectory (thirdparty/zint-qml )
187+ target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE zint )
178188
179- #CONFIG += zint
180- #add_subdirectory(thirdparty/zint)
181- #target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE zint)
189+ # build ZintQml
190+ add_subdirectory (thirdparty/zint-qml/wrappers/qml )
191+ target_link_libraries (${CMAKE_PROJECT_NAME } PRIVATE ZintQml )
192+
193+ set (zint true )
194+ add_definitions (-Dzint )
195+ endif ()
182196
183197################################################################################
184198
185199## Android
186- if (CMAKE_SYSTEM_NAME STREQUAL "Android" )
200+ if (CMAKE_SYSTEM_NAME STREQUAL "Android" )
187201 set_target_properties (${CMAKE_PROJECT_NAME } PROPERTIES
188202 #QT_ANDROID_ABIS "armeabi-v7a;arm64-v8a;x86;x86_64"
189203 #QT_ANDROID_BUILD_ALL_ABIS ON
@@ -194,7 +208,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
194208endif ()
195209
196210## macOS
197- if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
211+ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
198212 #set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
199213 set (CMAKE_OSX_DEPLOYMENT_TARGET "11.0" )
200214
@@ -212,7 +226,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
212226endif ()
213227
214228## iOS
215- if (CMAKE_SYSTEM_NAME STREQUAL "iOS" )
229+ if (CMAKE_SYSTEM_NAME STREQUAL "iOS" )
216230 #set(app_icon_ios "${CMAKE_SOURCE_DIR}/assets/ios/Assets.xcassets")
217231 #set_source_files_properties(${app_icon_ios} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
218232
@@ -234,7 +248,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
234248endif ()
235249
236250## Windows
237- if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
251+ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
238252 #set(app_icon_windows "${CMAKE_SOURCE_DIR}/assets/windows/${CMAKE_PROJECT_NAME}.rc")
239253
240254 set_target_properties (${CMAKE_PROJECT_NAME } PROPERTIES
@@ -243,7 +257,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
243257endif ()
244258
245259## Release build? Set "no debug" macros
246- if (CMAKE_BUILD_TYPE STREQUAL Release)
260+ if (CMAKE_BUILD_TYPE STREQUAL Release)
247261 target_compile_definitions (${CMAKE_PROJECT_NAME } PRIVATE
248262 NDEBUG
249263 QT_NO_DEBUG
0 commit comments