Commit 25e14d06 authored by Sandro Knauß's avatar Sandro Knauß

Compile mimetreeparser

parent 018520f6
......@@ -105,6 +105,7 @@ if(EXISTS "${Messagelib_SOURCE_DIR}/.git")
endif()
endif()
add_subdirectory(mimetreeparser)
add_subdirectory(messageviewer)
add_subdirectory(templateparser)
add_subdirectory(messagecomposer)
......
project(MimeTreeParser)
ecm_setup_version(${MESSAGELIB_LIB_VERSION} VARIABLE_PREFIX MIMETREEPARSER
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5MimeTreeParserConfigVersion.cmake"
SOVERSION 5
)
########### Targets ###########
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
#verify
remove_definitions("-DQT_NO_URL_CAST_FROM_STRING")
remove_definitions( -DQT_NO_CAST_FROM_BYTEARRAY )
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5MimeTreeParser")
ecm_configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF5MimeTreeParserConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5MimeTreeParserConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5MimeTreeParserConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5MimeTreeParserConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KF5MimeTreeParserTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5MimeTreeParserTargets.cmake NAMESPACE KF5::)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
)
add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(autotests)
endif()
@PACKAGE_INIT@
find_dependency(KF5PimCommon "@PIMCOMMON_LIB_VERSION@")
find_dependency(KF5MessageCore "@MESSAGELIB_LIB_VERSION@")
find_dependency(KF5Mime "@KMIME_LIB_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/KF5MimeTreeParserTargets.cmake")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
add_definitions( -DMAIL_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data" )
include(${CMAKE_SOURCE_DIR}/cmake/modules/kdepim_add_gpg_crypto_test.cmake)
add_definitions(-DKMAIL_UNITTESTS=YES)
# convenience macro to add qtest unit tests
macro(add_mimetreeparser_unittest _source)
get_filename_component(_name ${_source} NAME_WE)
ecm_add_test(${_source} util.cpp setupenv.cpp testcsshelper.cpp
TEST_NAME ${_name}
NAME_PREFIX "mimetreeparser-"
LINK_LIBRARIES KF5::MimeTreeParser Qt5::Test KF5::IconThemes
)
endmacro ()
macro(add_mimetreeparser_class_unittest _source _additionalSource)
get_filename_component(_name ${_source} NAME_WE)
ecm_add_test(${_source} ${_additionalSource}
TEST_NAME ${_name}
NAME_PREFIX "mimetreeparser-"
LINK_LIBRARIES KF5::MimeTreeParser Qt5::Test
)
endmacro ()
macro(add_mimetreeparser_crypto_unittest _source)
set(_test ${_source} util.cpp)
get_filename_component(_name ${_source} NAME_WE)
add_executable( ${_name} ${_test} setupenv.cpp testcsshelper.cpp )
ecm_mark_as_test(mimetreeparser-${_name})
target_link_libraries( ${_name}
KF5::MimeTreeParser
Qt5::Test
KF5::IconThemes
)
add_gpg_crypto_test(${_name} mimetreeparser-${_name})
endmacro ()
add_mimetreeparser_crypto_unittest(attachmenttest.cpp)
add_mimetreeparser_crypto_unittest(objecttreeparsertest.cpp)
add_mimetreeparser_crypto_unittest(rendertest.cpp)
add_mimetreeparser_crypto_unittest(unencryptedmessagetest.cpp)
add_mimetreeparser_unittest(nodehelpertest.cpp)
add_mimetreeparser_unittest(csshelpertest.cpp)
add_mimetreeparser_class_unittest( cryptohelpertest.cpp "../src/viewer/cryptohelper.cpp")
ecm_add_test(converthtmltoplaintexttest.cpp ../src/viewer/converthtmltoplaintext.cpp
TEST_NAME converthtmltoplaintexttest
NAME_PREFIX "mimetreeparser-"
LINK_LIBRARIES Qt5::Test Grantlee5::TextDocument
)
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_definitions(-DTRANSLATION_DOMAIN=\"libmimetreeparser\")
# target_include_directories does not handle empty include paths
include_directories(${GPGME_INCLUDES})
set(libmimetreeparser_main_SRCS
interfaces/bodypartformatter.cpp
job/kleojobexecutor.cpp
viewer/attachmentstrategy.cpp
viewer/bodypartformatter.cpp
viewer/bodypartformatterbasefactory.cpp
viewer/cryptohelper.cpp
viewer/csshelperbase.cpp
viewer/nodehelper.cpp
viewer/objecttreeparser.cpp
viewer/messagepart.cpp
viewer/partnodebodypart.cpp
viewer/memento/cryptobodypartmemento.cpp
viewer/memento/decryptverifybodypartmemento.cpp
viewer/memento/verifydetachedbodypartmemento.cpp
viewer/memento/verifyopaquebodypartmemento.cpp
)
set(libmimetreeparser_extra_SRCS
#for quotes
utils/iconnamecache.cpp
utils/mimetype.cpp
viewer/converthtmltoplaintext.cpp
#HTML Writer
htmlwriter/filehtmlwriter.cpp
htmlwriter/queuehtmlwriter.cpp
)
ecm_generate_headers(MimeTreeParser_Camelcaseviewer_HEADERS
HEADER_NAMES
AttachmentStrategy
BodyPartFormatterBaseFactory
CSSHelperBase
Enums
MessagePart
NodeHelper
ObjectTreeParser
PartMetaData
PartNodeBodyPart
REQUIRED_HEADERS MimeTreeParser_viewer_HEADERS
PREFIX MimeTreeParser
RELATIVE viewer
)
ecm_generate_headers(MimeTreeParser_Camelcasemain_HEADERS
HEADER_NAMES
ObjectTreeSourceIf
REQUIRED_HEADERS MimeTreeParser_main_HEADERS
PREFIX MimeTreeParser
)
ecm_generate_headers(MimeTreeParser_Camelcaseutils_HEADERS
HEADER_NAMES
IconNameCache
MimeType
REQUIRED_HEADERS MimeTreeParser_utils_HEADERS
PREFIX MimeTreeParser
RELATIVE utils
)
ecm_generate_headers(MimeTreeParser_Camelcaseinterfaces_HEADERS
HEADER_NAMES
BodyPartFormatter
BodyPart
HtmlWriter
REQUIRED_HEADERS MimeTreeParser_interfaces_HEADERS
PREFIX MimeTreeParser
RELATIVE interfaces
)
ecm_generate_headers(MimeTreeParser_Camelcasehtmlwriter_HEADERS
HEADER_NAMES
FileHtmlWriter
REQUIRED_HEADERS MimeTreeParser_htmlwriter_HEADERS
PREFIX MimeTreeParser
RELATIVE htmlwriter
)
install(FILES
${MimeTreeParser_Camelcasehtmlwriter_HEADERS}
${MimeTreeParser_Camelcaseutils_HEADERS}
${MimeTreeParser_Camelcaseinterfaces_HEADERS}
${MimeTreeParser_Camelcaseviewer_HEADERS}
${MimeTreeParser_Camelcasemain_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MimeTreeParser
COMPONENT Devel
)
install(FILES
${MimeTreeParser_htmlwriter_HEADERS}
${MimeTreeParser_utils_HEADERS}
${MimeTreeParser_interfaces_HEADERS}
${MimeTreeParser_viewer_HEADERS}
${MimeTreeParser_main_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_export.h
${CMAKE_CURRENT_BINARY_DIR}/mimetreeparser_debug.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/mimetreeparser
COMPONENT Devel
)
ecm_generate_pri_file(BASE_NAME MimeTreeParser
LIB_NAME KF5MimeTreeParser
DEPS "PimCommon MessageCore Libkleo" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MimeTreeParser
)
install(FILES
${PRI_FILENAME}
DESTINATION ${ECM_MKSPECS_INSTALL_DIR}
)
set(libmimetreeparser_SRCS
${libmimetreeparser_main_SRCS}
${libmimetreeparser_extra_SRCS}
)
ecm_qt_declare_logging_category(libmimetreeparser_SRCS HEADER messageviewer_debug.h IDENTIFIER MESSAGEVIEWER_LOG CATEGORY_NAME log_messageviewer)
ecm_qt_declare_logging_category(libmimetreeparser_SRCS HEADER mimetreeparser_debug.h IDENTIFIER MIMETREEPARSER_LOG CATEGORY_NAME log_mimetreeparser)
add_library(KF5MimeTreeParser
${libmimetreeparser_SRCS}
)
generate_export_header(KF5MimeTreeParser BASE_NAME mimetreeparser)
add_library(KF5::MimeTreeParser ALIAS KF5MimeTreeParser)
target_link_libraries(KF5MimeTreeParser
PUBLIC
KF5::MessageCore #NodeHelper, StringUtils
KF5::PimCommon #AttachmentTemporaryFile handling
KF5::Libkleo
PRIVATE
KF5::Mime
Qt5::WebKitWidgets
KF5::IconThemes
Grantlee5::TextDocument
)
install(TARGETS
KF5MimeTreeParser
EXPORT KF5MimeTreeParserTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
)
set_target_properties(KF5MimeTreeParser PROPERTIES
VERSION ${MIMETREEPARSER_VERSION_STRING}
SOVERSION ${MIMETREEPARSER_SOVERSION}
EXPORT_NAME MimeTreeParser
)
target_include_directories(KF5MimeTreeParser INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/MimeTreeParser/;${KDE_INSTALL_INCLUDEDIR_KF5}/mimetreeparser>")
target_include_directories(KF5MimeTreeParser PUBLIC "$<BUILD_INTERFACE:${MimeTreeParser_SOURCE_DIR}/src;${MimeTreeParser_BINARY_DIR}/src;>")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment