CMakeLists.txt 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. zxing_add_package(GTest googletest https://github.com/google/googletest.git v1.15.2)
  2. if (GTest_POPULATED)
  3. # don't install gtest stuff on "make install"
  4. set (INSTALL_GTEST OFF CACHE BOOL "" FORCE)
  5. endif()
  6. if (MSVC)
  7. # default to UTF-8
  8. add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
  9. endif()
  10. add_executable (UnitTest
  11. BarcodeFormatTest.cpp
  12. BitArrayUtility.cpp
  13. BitArrayUtility.h
  14. BitHacksTest.cpp
  15. CharacterSetECITest.cpp
  16. ErrorTest.cpp
  17. GTINTest.cpp
  18. PseudoRandom.h
  19. SanitizerSupport.cpp
  20. TextUtfEncodingTest.cpp
  21. ZXAlgorithmsTest.cpp
  22. )
  23. if (ZXING_READERS)
  24. target_sources (UnitTest PRIVATE
  25. GS1Test.cpp
  26. PatternTest.cpp
  27. TextDecoderTest.cpp
  28. ThresholdBinarizerTest.cpp
  29. aztec/AZDecoderTest.cpp
  30. aztec/AZDetectorTest.cpp
  31. datamatrix/DMDecodedBitStreamParserTest.cpp
  32. maxicode/MCDecoderTest.cpp
  33. oned/ODCode128ReaderTest.cpp
  34. oned/ODCode39ExtendedModeTest.cpp
  35. oned/ODCode39ReaderTest.cpp
  36. oned/ODCode93ReaderTest.cpp
  37. oned/ODDataBarExpandedBitDecoderTest.cpp
  38. oned/ODDataBarReaderTest.cpp
  39. pdf417/PDF417DecoderTest.cpp
  40. pdf417/PDF417ErrorCorrectionTest.cpp
  41. pdf417/PDF417ScanningDecoderTest.cpp
  42. qrcode/MQRDecoderTest.cpp
  43. qrcode/QRBitMatrixParserTest.cpp
  44. qrcode/QRDataMaskTest.cpp
  45. qrcode/QRDecodedBitStreamParserTest.cpp
  46. qrcode/QRErrorCorrectionLevelTest.cpp
  47. qrcode/QRFormatInformationTest.cpp
  48. qrcode/QRModeTest.cpp
  49. qrcode/QRVersionTest.cpp
  50. qrcode/RMQRDecoderTest.cpp
  51. )
  52. endif()
  53. if (ZXING_WRITERS MATCHES "ON|OLD|BOTH")
  54. target_sources (UnitTest PRIVATE
  55. aztec/AZEncoderTest.cpp
  56. datamatrix/DMHighLevelEncodeTest.cpp
  57. datamatrix/DMPlacementTest.cpp
  58. datamatrix/DMSymbolInfoTest.cpp
  59. datamatrix/DMWriterTest.cpp
  60. oned/ODCode39WriterTest.cpp
  61. oned/ODCode93WriterTest.cpp
  62. oned/ODEAN13WriterTest.cpp
  63. oned/ODEAN8WriterTest.cpp
  64. oned/ODITFWriterTest.cpp
  65. oned/ODUPCAWriterTest.cpp
  66. oned/ODUPCEWriterTest.cpp
  67. pdf417/PDF417HighLevelEncoderTest.cpp
  68. pdf417/PDF417WriterTest.cpp
  69. qrcode/QRWriterTest.cpp
  70. )
  71. endif()
  72. if (ZXING_READERS AND ZXING_WRITERS MATCHES "ON|OLD|BOTH")
  73. target_sources (UnitTest PRIVATE
  74. ContentTest.cpp
  75. ReedSolomonTest.cpp
  76. TextEncoderTest.cpp
  77. aztec/AZEncodeDecodeTest.cpp
  78. aztec/AZHighLevelEncoderTest.cpp
  79. datamatrix/DMEncodeDecodeTest.cpp
  80. oned/ODCodaBarWriterTest.cpp
  81. oned/ODCode128WriterTest.cpp
  82. qrcode/QREncoderTest.cpp
  83. )
  84. endif()
  85. target_include_directories (UnitTest PRIVATE .)
  86. target_link_libraries (UnitTest ZXing::ZXing GTest::gtest_main GTest::gmock)
  87. #target_precompile_headers(UnitTest PRIVATE ${CMAKE_SOURCE_DIR}/core/src/ReadBarcode.h)
  88. add_test(NAME UnitTest COMMAND UnitTest)