Warning, /frameworks/kfilemetadata/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 find_package(Qt${QT_MAJOR_VERSION} ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test) 0002 0003 find_package(Python3 COMPONENTS Interpreter) 0004 set_package_properties(Python3 PROPERTIES DESCRIPTION "Python Interpreter" 0005 URL "https://www.python.org" TYPE OPTIONAL 0006 PURPOSE "Python interpreter is required for testing external extractors and writers") 0007 0008 remove_definitions(-DQT_NO_CAST_FROM_ASCII) 0009 0010 configure_file(indexerextractortestsconfig.h.in 0011 ${CMAKE_CURRENT_BINARY_DIR}/indexerextractortestsconfig.h @ONLY) 0012 0013 0014 set(KfileMetaDataAutotest_SRCS) 0015 ecm_qt_declare_logging_category(KfileMetaDataAutotest_SRCS 0016 HEADER kfilemetadata_debug.h 0017 IDENTIFIER KFILEMETADATA_LOG 0018 CATEGORY_NAME kf.filemetadata 0019 ) 0020 0021 0022 # 0023 # Test case coverage 0024 # 0025 set(extractorcoverage_SRCS 0026 extractorcoveragetest.cpp 0027 ) 0028 0029 ecm_add_test(${extractorcoverage_SRCS} 0030 TEST_NAME "extractorcoveragetest" 0031 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData 0032 ) 0033 0034 # 0035 # Full text extraction test 0036 # 0037 set(indexerextractor_SRCS 0038 indexerextractortests.cpp 0039 ../src/extractors/plaintextextractor.cpp 0040 ) 0041 0042 set(text_COMPAT_CODEC) 0043 if (TARGET Qt6::Core5Compat) 0044 set(text_COMPAT_CODEC Qt6::Core5Compat) 0045 endif() 0046 ecm_add_test(${indexerextractor_SRCS} 0047 TEST_NAME "indexextractortest" 0048 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData ${text_COMPAT_CODEC} 0049 ) 0050 0051 # 0052 # Office 0053 # 0054 if(KF5Archive_FOUND) 0055 ecm_add_test(odfextractortest.cpp ../src/extractors/odfextractor.cpp 0056 TEST_NAME "odfextractortest" 0057 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Xml KF5::FileMetaData KF5::Archive 0058 ) 0059 endif() 0060 0061 if(KF5Archive_FOUND) 0062 ecm_add_test(office2007extractortest.cpp ../src/extractors/office2007extractor.cpp 0063 TEST_NAME "officeextractortest" 0064 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Xml KF5::FileMetaData KF5::Archive 0065 ) 0066 endif() 0067 0068 # 0069 # Poppler 0070 # 0071 if(Poppler_Qt${QT_MAJOR_VERSION}_FOUND) 0072 ecm_add_test(popplerextractortest.cpp ../src/extractors/popplerextractor.cpp 0073 TEST_NAME "popplerextractortest" 0074 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData Poppler::Qt${QT_MAJOR_VERSION} 0075 ) 0076 endif() 0077 0078 # 0079 # EPub 0080 # 0081 if(EPUB_FOUND) 0082 include_directories(${EPUB_INCLUDE_DIR}) 0083 0084 ecm_add_test( 0085 epubextractortest.cpp 0086 ../src/extractors/epubextractor.cpp 0087 ../src/kfilemetadata_debug.cpp 0088 TEST_NAME "epubextractortest" 0089 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData ${EPUB_LIBRARIES} 0090 ) 0091 endif() 0092 0093 # 0094 # Mobi 0095 # 0096 if (QMobipocket_FOUND) 0097 ecm_add_test(mobiextractortest.cpp ../src/extractors/mobiextractor.cpp 0098 TEST_NAME "mobiextractortest" 0099 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData qmobipocket 0100 ) 0101 endif() 0102 0103 # 0104 # FictionBook2 0105 # 0106 if(KF5Archive_FOUND) 0107 ecm_add_test( 0108 fb2extractortest.cpp 0109 ../src/extractors/fb2extractor.cpp 0110 ../src/kfilemetadata_debug.cpp 0111 TEST_NAME "fb2extractortest" 0112 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::Archive KF5::FileMetaData 0113 ) 0114 endif() 0115 0116 # 0117 # Property Info 0118 # 0119 add_executable(propertyinfotest_bin propertyinfotest.cpp) 0120 target_link_libraries(propertyinfotest_bin 0121 Qt${QT_MAJOR_VERSION}::Test 0122 KF5::FileMetaData 0123 ) 0124 ecm_mark_as_test(propertyinfotest_bin) 0125 ecm_mark_nongui_executable(propertyinfotest_bin) 0126 # Run the benchmark with just 1 iteration, so we known it works 0127 add_test(NAME propertyinfotest_en COMMAND propertyinfotest_bin "-iterations" "1") 0128 add_test(NAME propertyinfotest_localized COMMAND propertyinfotest_bin "--localized" "-iterations" "1") 0129 0130 # 0131 # Exiv2 0132 # 0133 if(LibExiv2_FOUND) 0134 kde_enable_exceptions() 0135 ecm_add_test(exiv2extractortest.cpp ../src/extractors/exiv2extractor.cpp 0136 TEST_NAME "exiv2extractortest" 0137 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData LibExiv2::LibExiv2 0138 ) 0139 if (${LibExiv2_VERSION} VERSION_LESS 0.28.0) 0140 # exiv2 0.27.x still uses std::auto_ptr, which is incompatible with C++17 0141 set_target_properties(kfilemetadata_exiv2extractor PROPERTIES CXX_STANDARD 14) 0142 endif() 0143 target_include_directories(exiv2extractortest PRIVATE ${CMAKE_BINARY_DIR}/src/extractors) 0144 endif() 0145 0146 # 0147 # FFMPEG 0148 # 0149 if(FFMPEG_FOUND) 0150 kde_enable_exceptions() 0151 ecm_add_test( 0152 ffmpegextractortest.cpp 0153 ../src/extractors/ffmpegextractor.cpp 0154 ../src/kfilemetadata_debug.cpp 0155 TEST_NAME "ffmpegextractortest" 0156 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData ${AVCODEC_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVUTIL_LIBRARIES} 0157 ) 0158 target_include_directories(ffmpegextractortest SYSTEM PRIVATE ${AVCODEC_INCLUDE_DIRS} ${AVFORMAT_INCLUDE_DIRS} ${AVUTIL_INCLUDE_DIRS}) 0159 endif() 0160 0161 # 0162 # TagLib 0163 # 0164 if(Taglib_FOUND) 0165 kde_enable_exceptions() 0166 ecm_add_test(taglibextractortest.cpp ../src/extractors/taglibextractor.cpp ${KfileMetaDataAutotest_SRCS} 0167 TEST_NAME "taglibextractortest" 0168 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData Taglib::Taglib 0169 ) 0170 endif() 0171 0172 0173 if(TARGET Python3::Interpreter AND NOT WIN32) 0174 # Test relies on working she-bang, which does non exist on Windows 0175 configure_file(samplefiles/testexternalextractor/main.py samplefiles/testexternalextractor/main.py) 0176 configure_file(samplefiles/testexternalextractor/manifest.json samplefiles/testexternalextractor/manifest.json COPYONLY) 0177 0178 ecm_add_test(externalextractortest.cpp $<$<BOOL:${BUILD_SHARED_LIBS}>:../src/externalextractor.cpp> ${KfileMetaDataAutotest_SRCS} 0179 TEST_NAME "externalextractortest" 0180 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData KF5::I18n 0181 ) 0182 endif() 0183 0184 # 0185 # Collection 0186 # 0187 set(extractorcollection_SRCS 0188 extractorcollectiontest.cpp 0189 ) 0190 0191 ecm_add_test(${extractorcollection_SRCS} 0192 TEST_NAME "extractorcollectiontest" 0193 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData 0194 ) 0195 0196 if(Taglib_FOUND) 0197 set(writercollection_SRCS 0198 writercollectiontest.cpp 0199 ) 0200 0201 ecm_add_test(${writercollection_SRCS} 0202 TEST_NAME "writercollectiontest" 0203 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData 0204 ) 0205 endif() 0206 0207 # 0208 # XML 0209 # 0210 set(xmlextractor_SRCS 0211 xmlextractortest.cpp 0212 ../src/extractors/xmlextractor.cpp 0213 ../src/extractors/dublincoreextractor.cpp 0214 ../src/kfilemetadata_debug.cpp 0215 ) 0216 0217 ecm_add_test(${xmlextractor_SRCS} 0218 TEST_NAME "xmlextractortest" 0219 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Xml KF5::FileMetaData 0220 ) 0221 0222 # 0223 # Postscript DSC 0224 # 0225 set(postscriptdscextractor_SRCS 0226 postscriptdscextractortest.cpp 0227 ../src/extractors/postscriptdscextractor.cpp 0228 ../src/kfilemetadata_debug.cpp 0229 ) 0230 0231 ecm_add_test(${postscriptdscextractor_SRCS} 0232 TEST_NAME "postscriptdscextractortest" 0233 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData 0234 ) 0235 0236 # 0237 # AppImage 0238 # 0239 if(libappimage_FOUND AND KF5Config_FOUND AND Qt${QT_MAJOR_VERSION}Gui_FOUND) 0240 ecm_add_test(appimageextractortest.cpp ../src/extractors/appimageextractor.cpp 0241 TEST_NAME "appimageextractortest" 0242 LINK_LIBRARIES 0243 Qt${QT_MAJOR_VERSION}::Test 0244 KF5::FileMetaData 0245 KF5::ConfigCore 0246 Qt${QT_MAJOR_VERSION}::Xml 0247 Qt${QT_MAJOR_VERSION}::Gui 0248 libappimage 0249 ) 0250 endif() 0251 0252 # 0253 # PNG 0254 # 0255 ecm_add_test(pngextractortest.cpp ../src/extractors/pngextractor.cpp 0256 TEST_NAME "pngextractortest" 0257 LINK_LIBRARIES 0258 Qt${QT_MAJOR_VERSION}::Test 0259 KF5::FileMetaData 0260 Qt${QT_MAJOR_VERSION}::Gui 0261 ) 0262 0263 0264 ################ 0265 # Writer tests # 0266 ################ 0267 0268 # 0269 # UserMetaData 0270 # 0271 if(UNIX) 0272 kde_enable_exceptions() 0273 ecm_add_test(usermetadatawritertest.cpp ../src/usermetadata.cpp 0274 TEST_NAME "usermetadatawritertest" 0275 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData 0276 ) 0277 endif() 0278 0279 # 0280 # TagLib 0281 # 0282 if(Taglib_FOUND) 0283 kde_enable_exceptions() 0284 ecm_add_test(taglibwritertest.cpp ../src/writers/taglibwriter.cpp ${KfileMetaDataAutotest_SRCS} 0285 TEST_NAME "taglibwritertest" 0286 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData Taglib::Taglib 0287 ) 0288 endif() 0289 0290 if(TARGET Python3::Interpreter AND NOT WIN32) 0291 configure_file(samplefiles/testexternalwriter/main.py samplefiles/testexternalwriter/main.py) 0292 configure_file(samplefiles/testexternalwriter/manifest.json samplefiles/testexternalwriter/manifest.json COPYONLY) 0293 0294 ecm_add_test(externalwritertest.cpp $<$<BOOL:${BUILD_SHARED_LIBS}>:../src/externalwriter.cpp> ${KfileMetaDataAutotest_SRCS} 0295 TEST_NAME "externalwritertest" 0296 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::FileMetaData KF5::I18n 0297 ) 0298 endif()