diff --git a/init.sh b/init.sh index b70221e..631eb80 100644 --- a/init.sh +++ b/init.sh @@ -25,11 +25,6 @@ mkdir -p "$zxingPath" # copy zxing cp -R "zxing-cpp-$zxing_version/core/" "$zxingPath" -# remove unneeded zxing files -rm -R "$zxingPath/CMakeLists.txt" -rm -R "$zxingPath/ZXingConfig.cmake.in" -rm -R "$zxingPath/ZXVersion.h.in" - # print success message for zxing echo "ZXing $zxing_version has been successfully installed" diff --git a/ios/Classes/src/CMakeLists.txt b/ios/Classes/src/CMakeLists.txt index 0768195..e23fd6f 100644 --- a/ios/Classes/src/CMakeLists.txt +++ b/ios/Classes/src/CMakeLists.txt @@ -2,435 +2,16 @@ cmake_minimum_required(VERSION 3.10) project(flutter_zxing LANGUAGES C CXX) -set(CPP_PATH ${CMAKE_SOURCE_DIR}) -set(ZXING_PATH ${CPP_PATH}/zxing/src) - add_library( flutter_zxing SHARED - ${CPP_PATH}/common.cpp - ${CPP_PATH}/native_zxing.cpp -) - - -# ZXing library - -include_directories(${ZXING_PATH}) - -if (NOT DEFINED BUILD_WRITERS) - set (BUILD_WRITERS ON) -endif() - -if (NOT DEFINED BUILD_READERS) - set (BUILD_READERS ON) -endif() - - -set (COMMON_FILES - ${ZXING_PATH}/BarcodeFormat.h - ${ZXING_PATH}/BarcodeFormat.cpp - ${ZXING_PATH}/BitArray.h - ${ZXING_PATH}/BitArray.cpp - ${ZXING_PATH}/BitHacks.h - ${ZXING_PATH}/BitMatrix.h - ${ZXING_PATH}/BitMatrix.cpp - ${ZXING_PATH}/BitMatrixCursor.h - ${ZXING_PATH}/BitMatrixIO.h - ${ZXING_PATH}/BitMatrixIO.cpp - ${ZXING_PATH}/ByteArray.h - ${ZXING_PATH}/ByteMatrix.h - ${ZXING_PATH}/CharacterSet.h - ${ZXING_PATH}/CharacterSet.cpp - ${ZXING_PATH}/CharacterSetECI.h - ${ZXING_PATH}/ConcentricFinder.h - ${ZXING_PATH}/ConcentricFinder.cpp - ${ZXING_PATH}/CustomData.h - ${ZXING_PATH}/ECI.h - ${ZXING_PATH}/ECI.cpp - ${ZXING_PATH}/Flags.h - ${ZXING_PATH}/Generator.h - ${ZXING_PATH}/GenericGF.h - ${ZXING_PATH}/GenericGF.cpp - ${ZXING_PATH}/GenericGFPoly.h - ${ZXING_PATH}/GenericGFPoly.cpp - ${ZXING_PATH}/GTIN.h - ${ZXING_PATH}/GTIN.cpp - ${ZXING_PATH}/LogMatrix.h - ${ZXING_PATH}/Matrix.h - ${ZXING_PATH}/Pattern.h - ${ZXING_PATH}/Point.h - ${ZXING_PATH}/Quadrilateral.h - ${ZXING_PATH}/RegressionLine.h - ${ZXING_PATH}/Scope.h - ${ZXING_PATH}/TextUtfEncoding.h - ${ZXING_PATH}/TextUtfEncoding.cpp - ${ZXING_PATH}/TritMatrix.h - ${ZXING_PATH}/ZXAlgorithms.h - ${ZXING_PATH}/ZXBigInteger.h - ${ZXING_PATH}/ZXBigInteger.cpp - ${ZXING_PATH}/ZXConfig.h - ${ZXING_PATH}/ZXNullable.h - ${ZXING_PATH}/ZXTestSupport.h -) -if (BUILD_READERS) - set (COMMON_FILES ${COMMON_FILES} - ${ZXING_PATH}/BinaryBitmap.h - ${ZXING_PATH}/BinaryBitmap.cpp - ${ZXING_PATH}/BitSource.h - ${ZXING_PATH}/BitSource.cpp - ${ZXING_PATH}/Content.h - ${ZXING_PATH}/Content.cpp - ${ZXING_PATH}/DecodeHints.h - ${ZXING_PATH}/DecodeHints.cpp - ${ZXING_PATH}/DecodeStatus.h - ${ZXING_PATH}/DecodeStatus.cpp - ${ZXING_PATH}/DecoderResult.h - ${ZXING_PATH}/DetectorResult.h - ${ZXING_PATH}/Error.h - ${ZXING_PATH}/GlobalHistogramBinarizer.h - ${ZXING_PATH}/GlobalHistogramBinarizer.cpp - ${ZXING_PATH}/GridSampler.h - ${ZXING_PATH}/GridSampler.cpp - ${ZXING_PATH}/GS1.h - ${ZXING_PATH}/GS1.cpp - ${ZXING_PATH}/HybridBinarizer.h - ${ZXING_PATH}/HybridBinarizer.cpp - ${ZXING_PATH}/ImageView.h - ${ZXING_PATH}/MultiFormatReader.h - ${ZXING_PATH}/MultiFormatReader.cpp - ${ZXING_PATH}/PerspectiveTransform.h - ${ZXING_PATH}/PerspectiveTransform.cpp - ${ZXING_PATH}/Reader.h - ${ZXING_PATH}/ReadBarcode.h - ${ZXING_PATH}/ReadBarcode.cpp - ${ZXING_PATH}/ReedSolomonDecoder.h - ${ZXING_PATH}/ReedSolomonDecoder.cpp - ${ZXING_PATH}/Result.h - ${ZXING_PATH}/Result.cpp - ${ZXING_PATH}/ResultPoint.h - ${ZXING_PATH}/ResultPoint.cpp - ${ZXING_PATH}/TextDecoder.h - ${ZXING_PATH}/TextDecoder.cpp - ${ZXING_PATH}/ThresholdBinarizer.h - ${ZXING_PATH}/WhiteRectDetector.h - ${ZXING_PATH}/WhiteRectDetector.cpp - ) -endif() -if (BUILD_WRITERS) - set (COMMON_FILES ${COMMON_FILES} - ${ZXING_PATH}/ByteMatrix.h - ${ZXING_PATH}/ReedSolomonEncoder.h - ${ZXING_PATH}/ReedSolomonEncoder.cpp - ${ZXING_PATH}/TextEncoder.h - ${ZXING_PATH}/TextEncoder.cpp - ${ZXING_PATH}/MultiFormatWriter.h - ${ZXING_PATH}/MultiFormatWriter.cpp - ) -endif() - -# define subset of public headers that get distributed with the binaries -set (PUBLIC_HEADERS - ${ZXING_PATH}/BarcodeFormat.h - ${ZXING_PATH}/BitHacks.h - ${ZXING_PATH}/ByteArray.h - ${ZXING_PATH}/CharacterSet.h - ${ZXING_PATH}/CharacterSetECI.h # deprecated - ${ZXING_PATH}/Flags.h - ${ZXING_PATH}/GTIN.h - ${ZXING_PATH}/TextUtfEncoding.h - ${ZXING_PATH}/ZXAlgorithms.h - ${ZXING_PATH}/ZXConfig.h -) -if (BUILD_READERS) - set (PUBLIC_HEADERS ${PUBLIC_HEADERS} - ${ZXING_PATH}/Content.h - ${ZXING_PATH}/DecodeHints.h - ${ZXING_PATH}/DecodeStatus.h - ${ZXING_PATH}/Error.h - ${ZXING_PATH}/ImageView.h - ${ZXING_PATH}/Point.h - ${ZXING_PATH}/Quadrilateral.h - ${ZXING_PATH}/ReadBarcode.h - ${ZXING_PATH}/Result.h - ${ZXING_PATH}/StructuredAppend.h - ) -endif() -if (BUILD_WRITERS) - set (PUBLIC_HEADERS ${PUBLIC_HEADERS} - ${ZXING_PATH}/BitMatrix.h - ${ZXING_PATH}/BitMatrixIO.h - ${ZXING_PATH}/Matrix.h - ${ZXING_PATH}/MultiFormatWriter.h - ) -endif() -# end of public header set - -set (AZTEC_FILES -) -if (BUILD_READERS) - set (AZTEC_FILES ${AZTEC_FILES} - ${ZXING_PATH}/aztec/AZDecoder.h - ${ZXING_PATH}/aztec/AZDecoder.cpp - ${ZXING_PATH}/aztec/AZDetector.h - ${ZXING_PATH}/aztec/AZDetector.cpp - ${ZXING_PATH}/aztec/AZDetectorResult.h - ${ZXING_PATH}/aztec/AZReader.h - ${ZXING_PATH}/aztec/AZReader.cpp - ) -endif() -if (BUILD_WRITERS) - set (AZTEC_FILES ${AZTEC_FILES} - ${ZXING_PATH}/aztec/AZEncodingState.h - ${ZXING_PATH}/aztec/AZEncoder.h - ${ZXING_PATH}/aztec/AZEncoder.cpp - ${ZXING_PATH}/aztec/AZHighLevelEncoder.h - ${ZXING_PATH}/aztec/AZHighLevelEncoder.cpp - ${ZXING_PATH}/aztec/AZToken.h - ${ZXING_PATH}/aztec/AZToken.cpp - ${ZXING_PATH}/aztec/AZWriter.h - ${ZXING_PATH}/aztec/AZWriter.cpp - ) -endif() - - -set (DATAMATRIX_FILES - ${ZXING_PATH}/datamatrix/DMBitLayout.h - ${ZXING_PATH}/datamatrix/DMBitLayout.cpp - ${ZXING_PATH}/datamatrix/DMVersion.h - ${ZXING_PATH}/datamatrix/DMVersion.cpp -) -if (BUILD_READERS) - set (DATAMATRIX_FILES ${DATAMATRIX_FILES} - ${ZXING_PATH}/datamatrix/DMDataBlock.h - ${ZXING_PATH}/datamatrix/DMDataBlock.cpp - ${ZXING_PATH}/datamatrix/DMDecoder.h - ${ZXING_PATH}/datamatrix/DMDecoder.cpp - ${ZXING_PATH}/datamatrix/DMDetector.h - ${ZXING_PATH}/datamatrix/DMDetector.cpp - ${ZXING_PATH}/datamatrix/DMReader.h - ${ZXING_PATH}/datamatrix/DMReader.cpp - ) -endif() -if (BUILD_WRITERS) - set (DATAMATRIX_FILES ${DATAMATRIX_FILES} - ${ZXING_PATH}/datamatrix/DMECEncoder.h - ${ZXING_PATH}/datamatrix/DMECEncoder.cpp - ${ZXING_PATH}/datamatrix/DMEncoderContext.h - ${ZXING_PATH}/datamatrix/DMHighLevelEncoder.h - ${ZXING_PATH}/datamatrix/DMHighLevelEncoder.cpp - ${ZXING_PATH}/datamatrix/DMSymbolInfo.h - ${ZXING_PATH}/datamatrix/DMSymbolInfo.cpp - ${ZXING_PATH}/datamatrix/DMSymbolShape.h - ${ZXING_PATH}/datamatrix/DMWriter.h - ${ZXING_PATH}/datamatrix/DMWriter.cpp - ) -endif() - - -set (MAXICODE_FILES -) -if (BUILD_READERS) - set (MAXICODE_FILES ${MAXICODE_FILES} - ${ZXING_PATH}/maxicode/MCBitMatrixParser.h - ${ZXING_PATH}/maxicode/MCBitMatrixParser.cpp - ${ZXING_PATH}/maxicode/MCDecoder.h - ${ZXING_PATH}/maxicode/MCDecoder.cpp - ${ZXING_PATH}/maxicode/MCReader.h - ${ZXING_PATH}/maxicode/MCReader.cpp - ) -endif() - - -set (ONED_FILES - ${ZXING_PATH}/oned/ODUPCEANCommon.h - ${ZXING_PATH}/oned/ODUPCEANCommon.cpp - ${ZXING_PATH}/oned/ODCode128Patterns.h - ${ZXING_PATH}/oned/ODCode128Patterns.cpp -) -if (BUILD_READERS) - set (ONED_FILES ${ONED_FILES} - ${ZXING_PATH}/oned/ODCodabarReader.h - ${ZXING_PATH}/oned/ODCodabarReader.cpp - ${ZXING_PATH}/oned/ODCode39Reader.h - ${ZXING_PATH}/oned/ODCode39Reader.cpp - ${ZXING_PATH}/oned/ODCode93Reader.h - ${ZXING_PATH}/oned/ODCode93Reader.cpp - ${ZXING_PATH}/oned/ODCode128Reader.h - ${ZXING_PATH}/oned/ODCode128Reader.cpp - ${ZXING_PATH}/oned/ODDataBarCommon.h - ${ZXING_PATH}/oned/ODDataBarCommon.cpp - ${ZXING_PATH}/oned/ODDataBarReader.h - ${ZXING_PATH}/oned/ODDataBarReader.cpp - ${ZXING_PATH}/oned/ODDataBarExpandedBitDecoder.h - ${ZXING_PATH}/oned/ODDataBarExpandedBitDecoder.cpp - ${ZXING_PATH}/oned/ODDataBarExpandedReader.h - ${ZXING_PATH}/oned/ODDataBarExpandedReader.cpp - ${ZXING_PATH}/oned/ODITFReader.h - ${ZXING_PATH}/oned/ODITFReader.cpp - ${ZXING_PATH}/oned/ODMultiUPCEANReader.h - ${ZXING_PATH}/oned/ODMultiUPCEANReader.cpp - ${ZXING_PATH}/oned/ODReader.h - ${ZXING_PATH}/oned/ODReader.cpp - ${ZXING_PATH}/oned/ODRowReader.h - ${ZXING_PATH}/oned/ODRowReader.cpp - ) -endif() -if (BUILD_WRITERS) - set (ONED_FILES ${ONED_FILES} - ${ZXING_PATH}/oned/ODCodabarWriter.h - ${ZXING_PATH}/oned/ODCodabarWriter.cpp - ${ZXING_PATH}/oned/ODCode39Writer.h - ${ZXING_PATH}/oned/ODCode39Writer.cpp - ${ZXING_PATH}/oned/ODCode93Writer.h - ${ZXING_PATH}/oned/ODCode93Writer.cpp - ${ZXING_PATH}/oned/ODCode128Writer.h - ${ZXING_PATH}/oned/ODCode128Writer.cpp - ${ZXING_PATH}/oned/ODEAN8Writer.h - ${ZXING_PATH}/oned/ODEAN8Writer.cpp - ${ZXING_PATH}/oned/ODEAN13Writer.h - ${ZXING_PATH}/oned/ODEAN13Writer.cpp - ${ZXING_PATH}/oned/ODITFWriter.h - ${ZXING_PATH}/oned/ODITFWriter.cpp - ${ZXING_PATH}/oned/ODUPCEWriter.h - ${ZXING_PATH}/oned/ODUPCEWriter.cpp - ${ZXING_PATH}/oned/ODUPCAWriter.h - ${ZXING_PATH}/oned/ODUPCAWriter.cpp - ${ZXING_PATH}/oned/ODWriterHelper.h - ${ZXING_PATH}/oned/ODWriterHelper.cpp - ) -endif() - - -set (PDF417_FILES -) -if (BUILD_READERS) - set (PDF417_FILES ${PDF417_FILES} - ${ZXING_PATH}/pdf417/PDFBarcodeMetadata.h - ${ZXING_PATH}/pdf417/PDFBarcodeValue.h - ${ZXING_PATH}/pdf417/PDFBarcodeValue.cpp - ${ZXING_PATH}/pdf417/PDFBoundingBox.h - ${ZXING_PATH}/pdf417/PDFBoundingBox.cpp - ${ZXING_PATH}/pdf417/PDFCodeword.h - ${ZXING_PATH}/pdf417/PDFCodewordDecoder.h - ${ZXING_PATH}/pdf417/PDFCodewordDecoder.cpp - ${ZXING_PATH}/pdf417/PDFDecodedBitStreamParser.h - ${ZXING_PATH}/pdf417/PDFDecodedBitStreamParser.cpp - ${ZXING_PATH}/pdf417/PDFDecoderResultExtra.h - ${ZXING_PATH}/pdf417/PDFDetectionResult.h - ${ZXING_PATH}/pdf417/PDFDetectionResult.cpp - ${ZXING_PATH}/pdf417/PDFDetectionResultColumn.h - ${ZXING_PATH}/pdf417/PDFDetectionResultColumn.cpp - ${ZXING_PATH}/pdf417/PDFDetector.h - ${ZXING_PATH}/pdf417/PDFDetector.cpp - ${ZXING_PATH}/pdf417/PDFModulusGF.h - ${ZXING_PATH}/pdf417/PDFModulusGF.cpp - ${ZXING_PATH}/pdf417/PDFModulusPoly.h - ${ZXING_PATH}/pdf417/PDFModulusPoly.cpp - ${ZXING_PATH}/pdf417/PDFReader.h - ${ZXING_PATH}/pdf417/PDFReader.cpp - ${ZXING_PATH}/pdf417/PDFScanningDecoder.h - ${ZXING_PATH}/pdf417/PDFScanningDecoder.cpp - ) -endif() -if (BUILD_WRITERS) - set (PDF417_FILES ${PDF417_FILES} - ${ZXING_PATH}/pdf417/PDFCompaction.h - ${ZXING_PATH}/pdf417/PDFEncoder.h - ${ZXING_PATH}/pdf417/PDFEncoder.cpp - ${ZXING_PATH}/pdf417/PDFHighLevelEncoder.h - ${ZXING_PATH}/pdf417/PDFHighLevelEncoder.cpp - ${ZXING_PATH}/pdf417/PDFWriter.h - ${ZXING_PATH}/pdf417/PDFWriter.cpp - ) -endif() - - -set (QRCODE_FILES - ${ZXING_PATH}/qrcode/QRCodecMode.h - ${ZXING_PATH}/qrcode/QRCodecMode.cpp - ${ZXING_PATH}/qrcode/QRErrorCorrectionLevel.h - ${ZXING_PATH}/qrcode/QRErrorCorrectionLevel.cpp - ${ZXING_PATH}/qrcode/QRVersion.h - ${ZXING_PATH}/qrcode/QRVersion.cpp -) -if (BUILD_READERS) - set (QRCODE_FILES ${QRCODE_FILES} - ${ZXING_PATH}/qrcode/QRBitMatrixParser.h - ${ZXING_PATH}/qrcode/QRBitMatrixParser.cpp - ${ZXING_PATH}/qrcode/QRDataBlock.h - ${ZXING_PATH}/qrcode/QRDataBlock.cpp - ${ZXING_PATH}/qrcode/QRDataMask.h - ${ZXING_PATH}/qrcode/QRDecoder.h - ${ZXING_PATH}/qrcode/QRDecoder.cpp - ${ZXING_PATH}/qrcode/QRDetector.h - ${ZXING_PATH}/qrcode/QRDetector.cpp - ${ZXING_PATH}/qrcode/QRECB.h - ${ZXING_PATH}/qrcode/QRFormatInformation.h - ${ZXING_PATH}/qrcode/QRFormatInformation.cpp - ${ZXING_PATH}/qrcode/QRReader.h - ${ZXING_PATH}/qrcode/QRReader.cpp - ) -endif() -if (BUILD_WRITERS) - set (QRCODE_FILES ${QRCODE_FILES} - ${ZXING_PATH}/qrcode/QREncoder.h - ${ZXING_PATH}/qrcode/QREncoder.cpp - ${ZXING_PATH}/qrcode/QREncodeResult.h - ${ZXING_PATH}/qrcode/QRMaskUtil.h - ${ZXING_PATH}/qrcode/QRMaskUtil.cpp - ${ZXING_PATH}/qrcode/QRMatrixUtil.h - ${ZXING_PATH}/qrcode/QRMatrixUtil.cpp - ${ZXING_PATH}/qrcode/QRWriter.h - ${ZXING_PATH}/qrcode/QRWriter.cpp - ) -endif() - - -set (TEXT_CODEC_FILES - ${ZXING_PATH}/textcodec/Big5MapTable.h - ${ZXING_PATH}/textcodec/Big5MapTable.cpp - ${ZXING_PATH}/textcodec/KRHangulMapping.h - ${ZXING_PATH}/textcodec/KRHangulMapping.cpp -) -if (BUILD_READERS) - set (TEXT_CODEC_FILES ${TEXT_CODEC_FILES} - ${ZXING_PATH}/textcodec/Big5TextDecoder.h - ${ZXING_PATH}/textcodec/Big5TextDecoder.cpp - ${ZXING_PATH}/textcodec/GBTextDecoder.h - ${ZXING_PATH}/textcodec/GBTextDecoder.cpp - ${ZXING_PATH}/textcodec/JPTextDecoder.h - ${ZXING_PATH}/textcodec/JPTextDecoder.cpp - ${ZXING_PATH}/textcodec/KRTextDecoder.h - ${ZXING_PATH}/textcodec/KRTextDecoder.cpp - ) -endif() -if (BUILD_WRITERS) - set (TEXT_CODEC_FILES ${TEXT_CODEC_FILES} - ${ZXING_PATH}/textcodec/Big5TextEncoder.h - ${ZXING_PATH}/textcodec/Big5TextEncoder.cpp - ${ZXING_PATH}/textcodec/GBTextEncoder.h - ${ZXING_PATH}/textcodec/GBTextEncoder.cpp - ${ZXING_PATH}/textcodec/JPTextEncoder.h - ${ZXING_PATH}/textcodec/JPTextEncoder.cpp - ${ZXING_PATH}/textcodec/KRTextEncoder.h - ${ZXING_PATH}/textcodec/KRTextEncoder.cpp - ) -endif() - -add_library (ZXing - ${COMMON_FILES} - ${AZTEC_FILES} - ${DATAMATRIX_FILES} - ${MAXICODE_FILES} - ${ONED_FILES} - ${ONED_RSS_FILES} - ${PDF417_FILES} - ${QRCODE_FILES} - ${TEXT_CODEC_FILES} + common.cpp + native_zxing.cpp ) -# End of ZXing +set (BUILD_WRITERS ON) +add_subdirectory(ZXing) find_library(log-lib log) target_link_libraries(flutter_zxing ZXing ${log-lib}) \ No newline at end of file diff --git a/ios/Classes/src/zxing/CMakeLists.txt b/ios/Classes/src/zxing/CMakeLists.txt new file mode 100644 index 0000000..7382bca --- /dev/null +++ b/ios/Classes/src/zxing/CMakeLists.txt @@ -0,0 +1,520 @@ +cmake_minimum_required (VERSION 3.10) + +if (NOT DEFINED BUILD_WRITERS) + set (BUILD_WRITERS OFF) +endif() + +if (NOT DEFINED BUILD_READERS) + set (BUILD_READERS ON) +endif() + +set (ZXING_CORE_DEFINES) +if (WINRT) + set (ZXING_CORE_DEFINES ${ZXING_CORE_DEFINES} + -DWINRT + ) +endif() + +set (ZXING_CORE_LOCAL_DEFINES + $<$:-DZXING_BUILD_READERS> + $<$:-DZXING_BUILD_WRITERS> + $<$:-DZXING_BUILD_FOR_TEST> + -DZX_USE_UTF8 # silence deprecation warning in Result.h +) +if (MSVC) + set (ZXING_CORE_LOCAL_DEFINES ${ZXING_CORE_LOCAL_DEFINES} + -D_SCL_SECURE_NO_WARNINGS + -D_CRT_SECURE_NO_WARNINGS + -D_CRT_NONSTDC_NO_WARNINGS + -DNOMINMAX + ) +else() + set (ZXING_CORE_LOCAL_DEFINES ${ZXING_CORE_LOCAL_DEFINES} + -Wall -Wextra -Wno-missing-braces -Werror=undef -Werror=return-type) +endif() + + +################# Source files + +set (COMMON_FILES + src/BarcodeFormat.h + src/BarcodeFormat.cpp + src/BitArray.h + src/BitArray.cpp + src/BitHacks.h + src/BitMatrix.h + src/BitMatrix.cpp + src/BitMatrixCursor.h + src/BitMatrixIO.h + src/BitMatrixIO.cpp + src/ByteArray.h + src/ByteMatrix.h + src/CharacterSet.h + src/CharacterSet.cpp + src/CharacterSetECI.h + src/ConcentricFinder.h + src/ConcentricFinder.cpp + src/CustomData.h + src/ECI.h + src/ECI.cpp + src/Flags.h + src/Generator.h + src/GenericGF.h + src/GenericGF.cpp + src/GenericGFPoly.h + src/GenericGFPoly.cpp + src/GTIN.h + src/GTIN.cpp + src/LogMatrix.h + src/Matrix.h + src/Pattern.h + src/Point.h + src/Quadrilateral.h + src/RegressionLine.h + src/Scope.h + src/TextUtfEncoding.h + src/TextUtfEncoding.cpp + src/TritMatrix.h + src/ZXAlgorithms.h + src/ZXBigInteger.h + src/ZXBigInteger.cpp + src/ZXConfig.h + src/ZXNullable.h + src/ZXTestSupport.h +) +if (BUILD_READERS) + set (COMMON_FILES ${COMMON_FILES} + src/BinaryBitmap.h + src/BinaryBitmap.cpp + src/BitSource.h + src/BitSource.cpp + src/Content.h + src/Content.cpp + src/DecodeHints.h + src/DecodeHints.cpp + src/DecodeStatus.h + src/DecodeStatus.cpp + src/DecoderResult.h + src/DetectorResult.h + src/Error.h + src/GlobalHistogramBinarizer.h + src/GlobalHistogramBinarizer.cpp + src/GridSampler.h + src/GridSampler.cpp + src/GS1.h + src/GS1.cpp + src/HybridBinarizer.h + src/HybridBinarizer.cpp + src/ImageView.h + src/MultiFormatReader.h + src/MultiFormatReader.cpp + src/PerspectiveTransform.h + src/PerspectiveTransform.cpp + src/Reader.h + src/ReadBarcode.h + src/ReadBarcode.cpp + src/ReedSolomonDecoder.h + src/ReedSolomonDecoder.cpp + src/Result.h + src/Result.cpp + src/ResultPoint.h + src/ResultPoint.cpp + src/TextDecoder.h + src/TextDecoder.cpp + src/ThresholdBinarizer.h + src/WhiteRectDetector.h + src/WhiteRectDetector.cpp + ) +endif() +if (BUILD_WRITERS) + set (COMMON_FILES ${COMMON_FILES} + src/ByteMatrix.h + src/ReedSolomonEncoder.h + src/ReedSolomonEncoder.cpp + src/TextEncoder.h + src/TextEncoder.cpp + src/MultiFormatWriter.h + src/MultiFormatWriter.cpp + ) +endif() + +# define subset of public headers that get distributed with the binaries +set (PUBLIC_HEADERS + src/BarcodeFormat.h + src/BitHacks.h + src/ByteArray.h + src/CharacterSet.h + src/CharacterSetECI.h # deprecated + src/Flags.h + src/GTIN.h + src/TextUtfEncoding.h + src/ZXAlgorithms.h + src/ZXConfig.h +) +if (BUILD_READERS) + set (PUBLIC_HEADERS ${PUBLIC_HEADERS} + src/Content.h + src/DecodeHints.h + src/DecodeStatus.h + src/Error.h + src/ImageView.h + src/Point.h + src/Quadrilateral.h + src/ReadBarcode.h + src/Result.h + src/StructuredAppend.h + ) +endif() +if (BUILD_WRITERS) + set (PUBLIC_HEADERS ${PUBLIC_HEADERS} + src/BitMatrix.h + src/BitMatrixIO.h + src/Matrix.h + src/MultiFormatWriter.h + ) +endif() +# end of public header set + +set (AZTEC_FILES +) +if (BUILD_READERS) + set (AZTEC_FILES ${AZTEC_FILES} + src/aztec/AZDecoder.h + src/aztec/AZDecoder.cpp + src/aztec/AZDetector.h + src/aztec/AZDetector.cpp + src/aztec/AZDetectorResult.h + src/aztec/AZReader.h + src/aztec/AZReader.cpp + ) +endif() +if (BUILD_WRITERS) + set (AZTEC_FILES ${AZTEC_FILES} + src/aztec/AZEncodingState.h + src/aztec/AZEncoder.h + src/aztec/AZEncoder.cpp + src/aztec/AZHighLevelEncoder.h + src/aztec/AZHighLevelEncoder.cpp + src/aztec/AZToken.h + src/aztec/AZToken.cpp + src/aztec/AZWriter.h + src/aztec/AZWriter.cpp + ) +endif() + + +set (DATAMATRIX_FILES + src/datamatrix/DMBitLayout.h + src/datamatrix/DMBitLayout.cpp + src/datamatrix/DMVersion.h + src/datamatrix/DMVersion.cpp +) +if (BUILD_READERS) + set (DATAMATRIX_FILES ${DATAMATRIX_FILES} + src/datamatrix/DMDataBlock.h + src/datamatrix/DMDataBlock.cpp + src/datamatrix/DMDecoder.h + src/datamatrix/DMDecoder.cpp + src/datamatrix/DMDetector.h + src/datamatrix/DMDetector.cpp + src/datamatrix/DMReader.h + src/datamatrix/DMReader.cpp + ) +endif() +if (BUILD_WRITERS) + set (DATAMATRIX_FILES ${DATAMATRIX_FILES} + src/datamatrix/DMECEncoder.h + src/datamatrix/DMECEncoder.cpp + src/datamatrix/DMEncoderContext.h + src/datamatrix/DMHighLevelEncoder.h + src/datamatrix/DMHighLevelEncoder.cpp + src/datamatrix/DMSymbolInfo.h + src/datamatrix/DMSymbolInfo.cpp + src/datamatrix/DMSymbolShape.h + src/datamatrix/DMWriter.h + src/datamatrix/DMWriter.cpp + ) +endif() + + +set (MAXICODE_FILES +) +if (BUILD_READERS) + set (MAXICODE_FILES ${MAXICODE_FILES} + src/maxicode/MCBitMatrixParser.h + src/maxicode/MCBitMatrixParser.cpp + src/maxicode/MCDecoder.h + src/maxicode/MCDecoder.cpp + src/maxicode/MCReader.h + src/maxicode/MCReader.cpp + ) +endif() + + +set (ONED_FILES + src/oned/ODUPCEANCommon.h + src/oned/ODUPCEANCommon.cpp + src/oned/ODCode128Patterns.h + src/oned/ODCode128Patterns.cpp +) +if (BUILD_READERS) + set (ONED_FILES ${ONED_FILES} + src/oned/ODCodabarReader.h + src/oned/ODCodabarReader.cpp + src/oned/ODCode39Reader.h + src/oned/ODCode39Reader.cpp + src/oned/ODCode93Reader.h + src/oned/ODCode93Reader.cpp + src/oned/ODCode128Reader.h + src/oned/ODCode128Reader.cpp + src/oned/ODDataBarCommon.h + src/oned/ODDataBarCommon.cpp + src/oned/ODDataBarReader.h + src/oned/ODDataBarReader.cpp + src/oned/ODDataBarExpandedBitDecoder.h + src/oned/ODDataBarExpandedBitDecoder.cpp + src/oned/ODDataBarExpandedReader.h + src/oned/ODDataBarExpandedReader.cpp + src/oned/ODITFReader.h + src/oned/ODITFReader.cpp + src/oned/ODMultiUPCEANReader.h + src/oned/ODMultiUPCEANReader.cpp + src/oned/ODReader.h + src/oned/ODReader.cpp + src/oned/ODRowReader.h + src/oned/ODRowReader.cpp + ) +endif() +if (BUILD_WRITERS) + set (ONED_FILES ${ONED_FILES} + src/oned/ODCodabarWriter.h + src/oned/ODCodabarWriter.cpp + src/oned/ODCode39Writer.h + src/oned/ODCode39Writer.cpp + src/oned/ODCode93Writer.h + src/oned/ODCode93Writer.cpp + src/oned/ODCode128Writer.h + src/oned/ODCode128Writer.cpp + src/oned/ODEAN8Writer.h + src/oned/ODEAN8Writer.cpp + src/oned/ODEAN13Writer.h + src/oned/ODEAN13Writer.cpp + src/oned/ODITFWriter.h + src/oned/ODITFWriter.cpp + src/oned/ODUPCEWriter.h + src/oned/ODUPCEWriter.cpp + src/oned/ODUPCAWriter.h + src/oned/ODUPCAWriter.cpp + src/oned/ODWriterHelper.h + src/oned/ODWriterHelper.cpp + ) +endif() + + +set (PDF417_FILES +) +if (BUILD_READERS) + set (PDF417_FILES ${PDF417_FILES} + src/pdf417/PDFBarcodeMetadata.h + src/pdf417/PDFBarcodeValue.h + src/pdf417/PDFBarcodeValue.cpp + src/pdf417/PDFBoundingBox.h + src/pdf417/PDFBoundingBox.cpp + src/pdf417/PDFCodeword.h + src/pdf417/PDFCodewordDecoder.h + src/pdf417/PDFCodewordDecoder.cpp + src/pdf417/PDFDecodedBitStreamParser.h + src/pdf417/PDFDecodedBitStreamParser.cpp + src/pdf417/PDFDecoderResultExtra.h + src/pdf417/PDFDetectionResult.h + src/pdf417/PDFDetectionResult.cpp + src/pdf417/PDFDetectionResultColumn.h + src/pdf417/PDFDetectionResultColumn.cpp + src/pdf417/PDFDetector.h + src/pdf417/PDFDetector.cpp + src/pdf417/PDFModulusGF.h + src/pdf417/PDFModulusGF.cpp + src/pdf417/PDFModulusPoly.h + src/pdf417/PDFModulusPoly.cpp + src/pdf417/PDFReader.h + src/pdf417/PDFReader.cpp + src/pdf417/PDFScanningDecoder.h + src/pdf417/PDFScanningDecoder.cpp + ) +endif() +if (BUILD_WRITERS) + set (PDF417_FILES ${PDF417_FILES} + src/pdf417/PDFCompaction.h + src/pdf417/PDFEncoder.h + src/pdf417/PDFEncoder.cpp + src/pdf417/PDFHighLevelEncoder.h + src/pdf417/PDFHighLevelEncoder.cpp + src/pdf417/PDFWriter.h + src/pdf417/PDFWriter.cpp + ) +endif() + + +set (QRCODE_FILES + src/qrcode/QRCodecMode.h + src/qrcode/QRCodecMode.cpp + src/qrcode/QRErrorCorrectionLevel.h + src/qrcode/QRErrorCorrectionLevel.cpp + src/qrcode/QRVersion.h + src/qrcode/QRVersion.cpp +) +if (BUILD_READERS) + set (QRCODE_FILES ${QRCODE_FILES} + src/qrcode/QRBitMatrixParser.h + src/qrcode/QRBitMatrixParser.cpp + src/qrcode/QRDataBlock.h + src/qrcode/QRDataBlock.cpp + src/qrcode/QRDataMask.h + src/qrcode/QRDecoder.h + src/qrcode/QRDecoder.cpp + src/qrcode/QRDetector.h + src/qrcode/QRDetector.cpp + src/qrcode/QRECB.h + src/qrcode/QRFormatInformation.h + src/qrcode/QRFormatInformation.cpp + src/qrcode/QRReader.h + src/qrcode/QRReader.cpp + ) +endif() +if (BUILD_WRITERS) + set (QRCODE_FILES ${QRCODE_FILES} + src/qrcode/QREncoder.h + src/qrcode/QREncoder.cpp + src/qrcode/QREncodeResult.h + src/qrcode/QRMaskUtil.h + src/qrcode/QRMaskUtil.cpp + src/qrcode/QRMatrixUtil.h + src/qrcode/QRMatrixUtil.cpp + src/qrcode/QRWriter.h + src/qrcode/QRWriter.cpp + ) +endif() + + +set (TEXT_CODEC_FILES + src/textcodec/Big5MapTable.h + src/textcodec/Big5MapTable.cpp + src/textcodec/KRHangulMapping.h + src/textcodec/KRHangulMapping.cpp +) +if (BUILD_READERS) + set (TEXT_CODEC_FILES ${TEXT_CODEC_FILES} + src/textcodec/Big5TextDecoder.h + src/textcodec/Big5TextDecoder.cpp + src/textcodec/GBTextDecoder.h + src/textcodec/GBTextDecoder.cpp + src/textcodec/JPTextDecoder.h + src/textcodec/JPTextDecoder.cpp + src/textcodec/KRTextDecoder.h + src/textcodec/KRTextDecoder.cpp + ) +endif() +if (BUILD_WRITERS) + set (TEXT_CODEC_FILES ${TEXT_CODEC_FILES} + src/textcodec/Big5TextEncoder.h + src/textcodec/Big5TextEncoder.cpp + src/textcodec/GBTextEncoder.h + src/textcodec/GBTextEncoder.cpp + src/textcodec/JPTextEncoder.h + src/textcodec/JPTextEncoder.cpp + src/textcodec/KRTextEncoder.h + src/textcodec/KRTextEncoder.cpp + ) +endif() + +source_group (Sources FILES ${COMMON_FILES}) +source_group (Sources\\aztec FILES ${AZTEC_FILES}) +source_group (Sources\\datamatrix FILES ${DATAMATRIX_FILES}) +source_group (Sources\\maxicode FILES ${MAXICODE_FILES}) +source_group (Sources\\oned FILES ${ONED_FILES}) +source_group (Sources\\pdf417 FILES ${PDF417_FILES}) +source_group (Sources\\qrcode FILES ${QRCODE_FILES}) +source_group (Sources\\textcodec FILES ${TEXT_CODEC_FILES}) + +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +set(THREADS_PREFER_PTHREAD_FLAG TRUE) +find_package(Threads REQUIRED) + +add_library (ZXing + ${COMMON_FILES} + ${AZTEC_FILES} + ${DATAMATRIX_FILES} + ${MAXICODE_FILES} + ${ONED_FILES} + ${PDF417_FILES} + ${QRCODE_FILES} + ${TEXT_CODEC_FILES} +) + +target_include_directories (ZXing + PUBLIC "$" + INTERFACE "$" +) + +target_compile_options (ZXing + PUBLIC ${ZXING_CORE_DEFINES} + PRIVATE ${ZXING_CORE_LOCAL_DEFINES} +) + +include (CheckCXXCompilerFlag) + +CHECK_CXX_COMPILER_FLAG ("-ffloat-store" COMPILER_NEEDS_FLOAT_STORE) +if (COMPILER_NEEDS_FLOAT_STORE) + target_compile_options(ZXing PRIVATE + -ffloat-store # same floating point precision in all optimization levels + ) +endif() + +# the lib needs a c++-17 compiler but can be used with a c++-11 compiler (see examples) +target_compile_features(ZXing PRIVATE cxx_std_17 INTERFACE cxx_std_11) + +target_link_libraries (ZXing PRIVATE Threads::Threads) + +add_library(ZXing::ZXing ALIAS ZXing) +# add the old alias as well, to keep old clients compiling +# note: this only affects client code that includes ZXing via sub_directory. +# for clients using the exported target, see ZXingConfig.cmake.in +add_library(ZXing::Core ALIAS ZXing) + +set_target_properties(ZXing PROPERTIES EXPORT_NAME ZXing) +# force position independent code to be able to link it as static lib into a DLL (e.g. the python module) +set_target_properties(ZXing PROPERTIES POSITION_INDEPENDENT_CODE ON) +if (PROJECT_VERSION) + set_target_properties(ZXing PROPERTIES VERSION ${PROJECT_VERSION}) + set_target_properties(ZXing PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}) +endif() + +set_target_properties(ZXing PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") + +include (GNUInstallDirs) + +install ( + TARGETS ZXing EXPORT ZXingTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +# INCLUDES DESTINATION include + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ZXing" +) + +configure_file (ZXVersion.h.in ZXVersion.h) + +install ( + FILES "${CMAKE_CURRENT_BINARY_DIR}/ZXVersion.h" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ZXing" +) + +if(MSVC) + set_target_properties(ZXing PROPERTIES + COMPILE_PDB_NAME ZXing + COMPILE_PDB_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ZXing.pdb + DESTINATION ${CMAKE_INSTALL_LIBDIR} + CONFIGURATIONS Debug RelWithDebInfo + OPTIONAL) +endif() diff --git a/ios/Classes/src/zxing/ZXVersion.h.in b/ios/Classes/src/zxing/ZXVersion.h.in new file mode 100644 index 0000000..78fde41 --- /dev/null +++ b/ios/Classes/src/zxing/ZXVersion.h.in @@ -0,0 +1,11 @@ +/* +* Copyright 2019 Nu-book Inc. +*/ +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +// Version numbering +#define ZXING_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ +#define ZXING_VERSION_MINOR @PROJECT_VERSION_MINOR@ +#define ZXING_VERSION_PATCH @PROJECT_VERSION_PATCH@ diff --git a/ios/Classes/src/zxing/ZXingConfig.cmake.in b/ios/Classes/src/zxing/ZXingConfig.cmake.in new file mode 100644 index 0000000..290af18 --- /dev/null +++ b/ios/Classes/src/zxing/ZXingConfig.cmake.in @@ -0,0 +1,9 @@ +@PACKAGE_INIT@ +include("${CMAKE_CURRENT_LIST_DIR}/ZXingTargets.cmake") + +# this does not work: add_library(ZXing::Core ALIAS ZXing::ZXing) +# this is a workaround available since 3.11 : +if(NOT(CMAKE_VERSION VERSION_LESS 3.11)) + add_library(ZXing::Core INTERFACE IMPORTED) + target_link_libraries(ZXing::Core INTERFACE ZXing::ZXing) +endif() diff --git a/zxscanner/android/fastlane/Fastfile b/zxscanner/android/fastlane/Fastfile index c60c52d..1729a6b 100644 --- a/zxscanner/android/fastlane/Fastfile +++ b/zxscanner/android/fastlane/Fastfile @@ -38,15 +38,15 @@ platform :android do desc "Build debug and test APK for screenshots" lane :screenshots do - # build_android_app( - # task: 'assemble', - # build_type: 'Debug' - # ) - # build_android_app( - # task: 'assemble', - # build_type: 'AndroidTest' - # ) - # screengrab() + build_android_app( + task: 'assemble', + build_type: 'Debug' + ) + build_android_app( + task: 'assemble', + build_type: 'AndroidTest' + ) + screengrab() frameit end end