[evolution-data-server/wip/cmake] Build libcamel and its providers



commit 9035aec27fa3944792505c471e579395e66e8c3b
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 21 19:08:24 2016 +0200

    Build libcamel and its providers

 CMakeLists.txt                          |   40 +++-
 camel/CMakeLists.txt                    |  431 +++++++++++++++++++++++++++++++
 camel/camel.pc.in                       |   11 +-
 camel/providers/CMakeLists.txt          |    9 +
 camel/providers/imapx/CMakeLists.txt    |   86 ++++++
 camel/providers/imapx/test-imapx.c      |   60 -----
 camel/providers/local/CMakeLists.txt    |   77 ++++++
 camel/providers/nntp/CMakeLists.txt     |   50 ++++
 camel/providers/nntp/test-newsrc.c      |   26 --
 camel/providers/pop3/CMakeLists.txt     |   46 ++++
 camel/providers/sendmail/CMakeLists.txt |   42 +++
 camel/providers/smtp/CMakeLists.txt     |   40 +++
 cmake/modules/CodeCoverageGCOV.cmake    |    6 +-
 cmake/modules/GLibTools.cmake           |  104 ++++++++
 cmake/modules/PkgConfigEx.cmake         |   12 +
 cmake/modules/SetupBuildFlags.cmake     |   14 +-
 enumtypes.c.template                    |   37 ---
 enumtypes.h.template                    |   24 --
 18 files changed, 951 insertions(+), 164 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35b66cb..fa4efe3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,6 +127,7 @@ add_printable_variable_path(INCLUDE_INSTALL_DIR "Install directory for header fi
 add_printable_variable_path(LIB_INSTALL_DIR "Install directory for library files, defaults to 
CMAKE_INSTALL_PREFIX/lib{LIB_SUFFIX}" "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
 add_printable_variable_path(LIBEXEC_INSTALL_DIR "Install directory for library executable files, defaults to 
CMAKE_INSTALL_PREFIX/libexec" "${CMAKE_INSTALL_PREFIX}/libexec")
 add_printable_variable_path(SHARE_INSTALL_PREFIX "Install directory for shared files, defaults to 
CMAKE_INSTALL_PREFIX/share" "${CMAKE_INSTALL_PREFIX}/share")
+add_printable_variable_path(LOCALE_INSTALL_PREFIX "Install directory for locale files, defaults to 
SHARE_INSTALL_PREFIX/locale" "${SHARE_INSTALL_PREFIX}/locale")
 add_printable_variable_path(SYSCONF_INSTALL_DIR "Install directory for system configuration files, defaults 
to CMAKE_INSTALL_PREFIX/etc" "${CMAKE_INSTALL_PREFIX}/etc")
 
 # ******************************
@@ -202,6 +203,7 @@ unset(optupper)
 
 include(CodeCoverageGCOV)
 include(DistTarget)
+include(GLibTools)
 include(PkgConfigEx)
 include(SetupBuildFlags)
 include(UninstallTarget)
@@ -227,7 +229,7 @@ CHECK_FUNCTION_EXISTS(nl_langinfo HAVE_NL_LANGINFO)
 CHECK_FUNCTION_EXISTS(fsync HAVE_FSYNC)
 
 # ******************************
-# gperf executable
+# required executables
 # ******************************
 
 find_program(GPERF gperf)
@@ -235,9 +237,15 @@ if(NOT GPERF)
        message(FATAL_ERROR "You need gperf to build ${PROJECT_NAME}")
 endif(NOT GPERF)
 
+find_program(PERL perl)
+if(NOT PERL)
+       message(FATAL_ERROR "You need perl to build ${PROJECT_NAME}")
+endif(NOT PERL)
+
 # ******************************
 # deflateInit is a #define, use deflateEnd instead
 # ******************************
+
 CHECK_LIBRARY_EXISTS(z deflateEnd "" deflateEnd_exists)
 
 if(NOT HAVE_ZLIB_H)
@@ -765,7 +773,10 @@ set(CALENDAR_CFLAGS "${CALENDAR_CFLAGS} ${LIBICAL_EXTRA_CFLAGS}")
 
 pkg_check_modules(CAMEL gio-2.0 gmodule-2.0 ${mozilla_nss} ${mozilla_nspr} 
sqlite3>=${sqlite_minimum_version})
 set(CAMEL_CFLAGS "${CAMEL_CFLAGS} ${KRB5_CFLAGS} ${MANUAL_NSS_CFLAGS} ${MANUAL_NSPR_CFLAGS} ${ICU_CFLAGS}")
-set(CAMEL_LDFLAGS "${CAMEL_LDFLAGS} -lz ${KRB5_LDFLAGS} ${MANUAL_NSS_LIBS} ${MANUAL_NSPR_LIBS} ${ICU_LIBS}")
+set(CAMEL_LDFLAGS "${CAMEL_LDFLAGS} -lz ${KRB5_LDFLAGS} ${MANUAL_NSS_LIBS} ${MANUAL_NSPR_LIBS} 
${ICU_LDFLAGS}")
+
+string(STRIP "${CAMEL_CFLAGS}" CAMEL_CFLAGS)
+string(STRIP "${CAMEL_LDFLAGS}" CAMEL_LDFLAGS)
 
 # ******************************
 # libical tweaks
@@ -803,9 +814,34 @@ CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
 unset(CMAKE_REQUIRED_FLAGS)
 unset(CMAKE_REQUIRED_LIBRARIES)
 
+# ******************************
+# Vala binding
+# ******************************
+
+add_printable_option(ENABLE_VALA_BINDINGS "Build the experimental Vala bindings" OFF)
+
+if(ENABLE_VALA_BINDINGS)
+       if(NOT ENABLE_INTROSPECTION)
+               message(FATAL_ERROR "Vala bindings require introspection generation to be enabled, use 
-DENABLE_INTROSPECTION=ON to enable it, or disable Vala bindings with -DENABLE_VALA_BINDINGS=OFF")
+       endif(NOT ENABLE_INTROSPECTION)
+
+       find_program(VALAC valac)
+       if(NOT VALAC)
+               message(FATAL_ERROR "The valac not found. Install it or disable Vala bindings with 
-DENABLE_VALA_BINDINGS=OFF")
+       endif(NOT VALAC)
+
+       find_program(VAPIGEN vapigen)
+       if(NOT VAPIGEN)
+               message(FATAL_ERROR "The vapigen not found. Install it or disable Vala bindings with 
-DENABLE_VALA_BINDINGS=OFF")
+       endif(NOT VAPIGEN)
+
+endif(ENABLE_VALA_BINDINGS)
+
 # Generate the config.h file
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
 
 add_definitions(-DHAVE_CONFIG_H=1)
 
 print_build_options()
+
+add_subdirectory(camel)
diff --git a/camel/CMakeLists.txt b/camel/CMakeLists.txt
new file mode 100644
index 0000000..b5633d3
--- /dev/null
+++ b/camel/CMakeLists.txt
@@ -0,0 +1,431 @@
+glib_mkenums(camel-enumtypes camel-enums.h CAMEL_ENUMTYPES_H)
+
+add_custom_command(
+       OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/camel-mime-tables.c
+       COMMAND ${PERL} ${CMAKE_CURRENT_SOURCE_DIR}/gentables.pl 
${CMAKE_CURRENT_BINARY_DIR}/camel-mime-tables.c
+       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gentables.pl
+)
+
+set(SOURCES
+       camel.c
+       camel-address.c
+       camel-async-closure.c
+       camel-block-file.c
+       camel-certdb.c
+       camel-charset-map.c
+       camel-cipher-context.c
+       camel-data-cache.c
+       camel-data-wrapper.c
+       camel-db.c
+       camel-debug.c
+       camel-enumtypes.c
+       camel-file-utils.c
+       camel-filter-driver.c
+       camel-filter-input-stream.c
+       camel-filter-output-stream.c
+       camel-filter-search.c
+       camel-folder-search.c
+       camel-folder-summary.c
+       camel-folder-thread.c
+       camel-folder.c
+       camel-gpg-context.c
+       camel-html-parser.c
+       camel-iconv.c
+       camel-index.c
+       camel-internet-address.c
+       camel-junk-filter.c
+       camel-local-settings.c
+       camel-lock.c
+       camel-medium.c
+       camel-memchunk.c
+       camel-mempool.c
+       camel-mime-filter-basic.c
+       camel-mime-filter-bestenc.c
+       camel-mime-filter-canon.c
+       camel-mime-filter-charset.c
+       camel-mime-filter-crlf.c
+       camel-mime-filter-enriched.c
+       camel-mime-filter-from.c
+       camel-mime-filter-gzip.c
+       camel-mime-filter-html.c
+       camel-mime-filter-index.c
+       camel-mime-filter-linewrap.c
+       camel-mime-filter-pgp.c
+       camel-mime-filter-progress.c
+       camel-mime-filter-tohtml.c
+       camel-mime-filter-windows.c
+       camel-mime-filter-yenc.c
+       camel-mime-filter.c
+       camel-mime-message.c
+       camel-mime-parser.c
+       camel-mime-part-utils.c
+       camel-mime-part.c
+       camel-mime-tables.c
+       camel-mime-utils.c
+       camel-msgport.c
+       camel-multipart-encrypted.c
+       camel-multipart-signed.c
+       camel-multipart.c
+       camel-net-utils.c
+       camel-network-service.c
+       camel-network-settings.c
+       camel-nntp-address.c
+       camel-null-output-stream.c
+       camel-object-bag.c
+       camel-object.c
+       camel-offline-folder.c
+       camel-offline-settings.c
+       camel-offline-store.c
+       camel-operation.c
+       camel-partition-table.c
+       camel-provider.c
+       camel-sasl-anonymous.c
+       camel-sasl-cram-md5.c
+       camel-sasl-digest-md5.c
+       camel-sasl-gssapi.c
+       camel-sasl-login.c
+       camel-sasl-ntlm.c
+       camel-sasl-plain.c
+       camel-sasl-popb4smtp.c
+       camel-sasl.c
+       camel-search-private.c
+       camel-search-sql-sexp.c
+       camel-service.c
+       camel-session.c
+       camel-settings.c
+       camel-sexp.c
+       camel-smime-context.c
+       camel-store-settings.c
+       camel-store-summary.c
+       camel-store.c
+       camel-stream-buffer.c
+       camel-stream-filter.c
+       camel-stream-fs.c
+       camel-stream-mem.c
+       camel-stream-null.c
+       camel-stream.c
+       camel-string-utils.c
+       camel-subscribable.c
+       camel-text-index.c
+       camel-transport.c
+       camel-trie.c
+       camel-uid-cache.c
+       camel-url-scanner.c
+       camel-url.c
+       camel-utf8.c
+       camel-vee-data-cache.c
+       camel-vee-folder.c
+       camel-vee-store.c
+       camel-vee-summary.c
+       camel-vtrash-folder.c
+)
+
+if(WIN32)
+       list(APPEND SOURCES
+               camel-win32.c
+       )
+else(WIN32)
+       list(APPEND SOURCES
+               camel-lock-client.c
+               camel-movemail.c
+               camel-stream-process.c
+       )
+endif(WIN32)
+
+set(HEADERS
+       camel.h
+       camel-address.h
+       camel-async-closure.h
+       camel-block-file.h
+       camel-certdb.h
+       camel-charset-map.h
+       camel-cipher-context.h
+       camel-data-cache.h
+       camel-data-wrapper.h
+       camel-db.h
+       camel-debug.h
+       camel-enums.h
+       camel-file-utils.h
+       camel-filter-driver.h
+       camel-filter-input-stream.h
+       camel-filter-output-stream.h
+       camel-filter-search.h
+       camel-folder-search.h
+       camel-folder-summary.h
+       camel-folder-thread.h
+       camel-folder.h
+       camel-gpg-context.h
+       camel-html-parser.h
+       camel-iconv.h
+       camel-index.h
+       camel-internet-address.h
+       camel-junk-filter.h
+       camel-local-settings.h
+       camel-lock-client.h
+       camel-lock-helper.h
+       camel-lock.h
+       camel-medium.h
+       camel-memchunk.h
+       camel-mempool.h
+       camel-mime-filter-basic.h
+       camel-mime-filter-bestenc.h
+       camel-mime-filter-canon.h
+       camel-mime-filter-charset.h
+       camel-mime-filter-crlf.h
+       camel-mime-filter-enriched.h
+       camel-mime-filter-from.h
+       camel-mime-filter-gzip.h
+       camel-mime-filter-html.h
+       camel-mime-filter-index.h
+       camel-mime-filter-linewrap.h
+       camel-mime-filter-pgp.h
+       camel-mime-filter-progress.h
+       camel-mime-filter-tohtml.h
+       camel-mime-filter-windows.h
+       camel-mime-filter-yenc.h
+       camel-mime-filter.h
+       camel-mime-message.h
+       camel-mime-parser.h
+       camel-mime-part-utils.h
+       camel-mime-part.h
+       camel-mime-utils.h
+       camel-movemail.h
+       camel-msgport.h
+       camel-multipart-encrypted.h
+       camel-multipart-signed.h
+       camel-multipart.h
+       camel-net-utils.h
+       camel-network-service.h
+       camel-network-settings.h
+       camel-nntp-address.h
+       camel-null-output-stream.h
+       camel-object-bag.h
+       camel-object.h
+       camel-offline-folder.h
+       camel-offline-settings.h
+       camel-offline-store.h
+       camel-operation.h
+       camel-partition-table.h
+       camel-provider.h
+       camel-sasl-anonymous.h
+       camel-sasl-cram-md5.h
+       camel-sasl-digest-md5.h
+       camel-sasl-gssapi.h
+       camel-sasl-login.h
+       camel-sasl-ntlm.h
+       camel-sasl-plain.h
+       camel-sasl-popb4smtp.h
+       camel-sasl.h
+       camel-search-private.h
+       camel-search-sql-sexp.h
+       camel-service.h
+       camel-session.h
+       camel-settings.h
+       camel-sexp.h
+       camel-smime-context.h
+       camel-store-settings.h
+       camel-store-summary.h
+       camel-store.h
+       camel-stream-buffer.h
+       camel-stream-filter.h
+       camel-stream-fs.h
+       camel-stream-mem.h
+       camel-stream-null.h
+       camel-stream-process.h
+       camel-stream.h
+       camel-string-utils.h
+       camel-subscribable.h
+       camel-text-index.h
+       camel-transport.h
+       camel-trie.h
+       camel-uid-cache.h
+       camel-url-scanner.h
+       camel-url.h
+       camel-utf8.h
+       camel-vee-data-cache.h
+       camel-vee-folder.h
+       camel-vee-store.h
+       camel-vee-summary.h
+       camel-vtrash-folder.h
+       ${CMAKE_CURRENT_BINARY_DIR}/camel-enumtypes.h
+)
+
+add_library(camel SHARED
+       ${SOURCES}
+       ${HEADERS}
+)
+
+set_target_properties(camel PROPERTIES
+       VERSION "${LIBCAMEL_CURRENT}.${LIBCAMEL_REVISION}.${LIBCAMEL_AGE}"
+       SOVERSION ${LIBCAMEL_CURRENT}
+       OUTPUT_NAME camel-${API_VERSION}
+)
+
+target_compile_definitions(camel PRIVATE
+       -DG_LOG_DOMAIN=\"camel\"
+       -DCAMEL_LIBEXECDIR=\"${LIBEXEC_INSTALL_DIR}\"
+       -DCAMEL_PROVIDERDIR=\"${camel_providerdir}\"
+       -DE_DATA_SERVER_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"
+       -DLOCALEDIR=\"${LOCALE_INSTALL_PREFIX}\"
+       -DCAMEL_COMPILATION
+)
+
+target_compile_options(camel PUBLIC
+       ${CAMEL_CFLAGS}
+       ${SOCKET_CFLAGS}
+       ${ICONV_CFLAGS}
+       ${REGEX_CFLAGS}
+       ${LIBDWFL_CFLAGS}
+)
+
+target_include_directories(camel PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_CURRENT_SOURCE_DIR}
+       ${CAMEL_INCLUDE_DIRS}
+       ${SOCKET_INCLUDE_DIRS}
+       ${ICONV_INCLUDE_DIRS}
+       ${REGEX_INCLUDE_DIRS}
+)
+
+target_link_libraries(camel
+       ${CAMEL_LDFLAGS}
+       ${SOCKET_LDFLAGS}
+       ${ICONV_LDFLAGS}
+       ${REGEX_LDFLAGS}
+       ${LIBDWFL_LDFLAGS}
+)
+
+install(TARGETS camel
+       DESTINATION ${LIB_INSTALL_DIR}
+)
+
+install(FILES ${HEADERS}
+       DESTINATION ${privincludedir}/camel
+)
+
+add_pkgconfig_file(camel.pc.in camel-${API_VERSION}.pc)
+
+if(NOT WIN32)
+       add_executable(camel-lock-helper
+               camel-lock.c
+               camel-lock.h
+               camel-lock-helper.c
+               camel-lock-helper.h
+       )
+
+       set_target_properties(camel-lock-helper PROPERTIES
+               OUTPUT_NAME camel-lock-helper-${API_VERSION}
+       )
+
+       target_compile_definitions(camel-lock-helper PRIVATE
+               -DG_LOG_DOMAIN=\"camel-lock-helper\"
+               -DCAMEL_LIBEXECDIR=\"${LIBEXEC_INSTALL_DIR}\"
+               -DCAMEL_PROVIDERDIR=\"${camel_providerdir}\"
+               -DE_DATA_SERVER_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"
+               -DLOCALEDIR=\"${LOCALE_INSTALL_PREFIX}\"
+               -DCAMEL_COMPILATION
+       )
+
+       target_compile_options(camel-lock-helper PUBLIC
+               ${GNOME_PLATFORM_CFLAGS}
+       )
+
+       target_include_directories(camel-lock-helper PUBLIC
+               ${CMAKE_BINARY_DIR}
+               ${CMAKE_CURRENT_BINARY_DIR}
+               ${CMAKE_SOURCE_DIR}
+               ${CMAKE_CURRENT_SOURCE_DIR}
+               ${GNOME_PLATFORM_INCLUDE_DIRS}
+       )
+
+       target_link_libraries(camel-lock-helper
+               ${GNOME_PLATFORM_LDFLAGS}
+       )
+
+       install(TARGETS camel-lock-helper
+               DESTINATION ${LIBEXEC_INSTALL_DIR}
+       )
+endif(NOT WIN32)
+
+add_executable(camel-index-control
+       camel-index-control.c
+)
+
+add_dependencies(camel-index-control camel)
+
+set_target_properties(camel-index-control PROPERTIES
+       OUTPUT_NAME camel-index-control-${API_VERSION}
+)
+
+target_compile_definitions(camel-index-control PRIVATE
+       -DG_LOG_DOMAIN=\"camel-index-control-${API_VERSION}\"
+       -DCAMEL_LIBEXECDIR=\"${LIBEXEC_INSTALL_DIR}\"
+       -DCAMEL_PROVIDERDIR=\"${camel_providerdir}\"
+       -DE_DATA_SERVER_PREFIX=\"${CMAKE_INSTALL_PREFIX}\"
+       -DLOCALEDIR=\"${LOCALE_INSTALL_PREFIX}\"
+       -DCAMEL_COMPILATION
+)
+
+target_compile_options(camel-index-control PUBLIC
+       ${CAMEL_CFLAGS}
+       ${SOCKET_CFLAGS}
+       ${ICONV_CFLAGS}
+       ${REGEX_CFLAGS}
+       ${LIBDWFL_CFLAGS}
+)
+
+target_include_directories(camel-index-control PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_CURRENT_SOURCE_DIR}
+       ${CAMEL_INCLUDE_DIRS}
+       ${SOCKET_INCLUDE_DIRS}
+       ${ICONV_INCLUDE_DIRS}
+       ${REGEX_INCLUDE_DIRS}
+)
+
+target_link_libraries(camel-index-control
+       camel
+       ${CAMEL_LDFLAGS}
+       ${SOCKET_LDFLAGS}
+       ${ICONV_LDFLAGS}
+       ${REGEX_LDFLAGS}
+       ${LIBDWFL_LDFLAGS}
+)
+
+install(TARGETS camel-index-control
+       DESTINATION ${LIBEXEC_INSTALL_DIR}
+)
+
+add_executable(camel-gpg-photo-saver
+       camel-gpg-photo-saver.c
+)
+
+target_compile_definitions(camel-gpg-photo-saver PRIVATE
+       -DG_LOG_DOMAIN=\"camel-gpg-photo-saver\"
+)
+
+target_compile_options(camel-gpg-photo-saver PUBLIC
+       ${GNOME_PLATFORM_CFLAGS}
+)
+
+target_include_directories(camel-gpg-photo-saver PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_CURRENT_SOURCE_DIR}
+       ${GNOME_PLATFORM_INCLUDE_DIRS}
+)
+
+target_link_libraries(camel-gpg-photo-saver
+       ${GNOME_PLATFORM_LDFLAGS}
+)
+
+install(TARGETS camel-gpg-photo-saver
+       DESTINATION ${LIBEXEC_INSTALL_DIR}
+)
+
+add_subdirectory(providers)
diff --git a/camel/camel.pc.in b/camel/camel.pc.in
index 8009590..55e1099 100644
--- a/camel/camel.pc.in
+++ b/camel/camel.pc.in
@@ -1,7 +1,6 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
 
 privlibdir=@privlibdir@
 privincludedir=@privincludedir@
@@ -10,7 +9,7 @@ camel_providerdir=@camel_providerdir@
 
 Name: camel
 Description: the Evolution MIME message handling library
-Version: @VERSION@
+Version: @PROJECT_VERSION@
 Requires: gio-2.0 sqlite3 @mozilla_nss@ @mozilla_nspr@
-Libs: -L${libdir} -lcamel-1.2 @MANUAL_NSS_LIBS@
+Libs: -L${libdir} -lcamel-@API_VERSION@ @MANUAL_NSS_LIBS@
 Cflags: -I${privincludedir} @MANUAL_NSS_CFLAGS@
diff --git a/camel/providers/CMakeLists.txt b/camel/providers/CMakeLists.txt
new file mode 100644
index 0000000..c1e5859
--- /dev/null
+++ b/camel/providers/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_subdirectory(imapx)
+add_subdirectory(local)
+add_subdirectory(nntp)
+add_subdirectory(pop3)
+add_subdirectory(smtp)
+
+if(NOT WIN32)
+       add_subdirectory(sendmail)
+endif(NOT WIN32)
\ No newline at end of file
diff --git a/camel/providers/imapx/CMakeLists.txt b/camel/providers/imapx/CMakeLists.txt
new file mode 100644
index 0000000..cadc4a9
--- /dev/null
+++ b/camel/providers/imapx/CMakeLists.txt
@@ -0,0 +1,86 @@
+set(SOURCES
+       camel-imapx-provider.c
+       camel-imapx-command.c
+       camel-imapx-command.h
+       camel-imapx-conn-manager.c
+       camel-imapx-conn-manager.h
+       camel-imapx-folder.c
+       camel-imapx-folder.h
+       camel-imapx-input-stream.c
+       camel-imapx-input-stream.h
+       camel-imapx-job.c
+       camel-imapx-job.h
+       camel-imapx-list-response.c
+       camel-imapx-list-response.h
+       camel-imapx-logger.c
+       camel-imapx-logger.h
+       camel-imapx-mailbox.c
+       camel-imapx-mailbox.h
+       camel-imapx-namespace.c
+       camel-imapx-namespace.h
+       camel-imapx-namespace-response.c
+       camel-imapx-namespace-response.h
+       camel-imapx-search.c
+       camel-imapx-search.h
+       camel-imapx-server.c
+       camel-imapx-server.h
+       camel-imapx-settings.c
+       camel-imapx-settings.h
+       camel-imapx-status-response.c
+       camel-imapx-status-response.h
+       camel-imapx-store.c
+       camel-imapx-store.h
+       camel-imapx-store-summary.c
+       camel-imapx-store-summary.h
+       camel-imapx-summary.c
+       camel-imapx-summary.h
+       camel-imapx-tokenise.h
+       camel-imapx-utils.c
+       camel-imapx-utils.h
+)
+
+add_custom_command(
+       OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/camel-imapx-tokenise.h
+       COMMAND ${GPERF} -H imapx_hash -N imapx_tokenise_struct -L ANSI-C -o -t -k1,$$ 
${CMAKE_CURRENT_SOURCE_DIR}/camel-imapx-tokens.txt 
--output-file=${CMAKE_CURRENT_BINARY_DIR}/camel-imapx-tokenise.h
+       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/camel-imapx-tokens.txt
+)
+
+add_library(camelimapx MODULE ${SOURCES})
+
+add_dependencies(camelimapx camel)
+
+target_compile_definitions(camelimapx PRIVATE
+       -DG_LOG_DOMAIN=\"camel-imapx-provider\"
+)
+
+target_compile_options(camelimapx PUBLIC
+       ${CAMEL_CFLAGS}
+       ${GIO_UNIX_CFLAGS}
+       ${CALENDAR_CFLAGS}
+)
+
+target_include_directories(camelimapx PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_BINARY_DIR}/camel
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_SOURCE_DIR}/camel
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CAMEL_INCLUDE_DIRS}
+       ${GIO_UNIX_INCLUDE_DIRS}
+       ${CALENDAR_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelimapx
+       camel
+       ${CAMEL_LDFLAGS}
+       ${GIO_UNIX_LDFLAGS}
+       ${CALENDAR_LDFLAGS}
+)
+
+install(TARGETS camelimapx
+       DESTINATION ${camel_providerdir}
+)
+
+install(FILES libcamelimapx.urls
+       DESTINATION ${camel_providerdir}
+)
diff --git a/camel/providers/local/CMakeLists.txt b/camel/providers/local/CMakeLists.txt
new file mode 100644
index 0000000..ce9a328
--- /dev/null
+++ b/camel/providers/local/CMakeLists.txt
@@ -0,0 +1,77 @@
+set(SOURCES
+       camel-local-folder.c
+       camel-local-folder.h
+       camel-local-store.c
+       camel-local-store.h
+       camel-local-summary.c
+       camel-local-summary.h
+       camel-local-private.c
+       camel-local-private.h
+       camel-local-provider.c
+       camel-maildir-folder.c
+       camel-maildir-folder.h
+       camel-maildir-store.c
+       camel-maildir-store.h
+       camel-maildir-summary.c
+       camel-maildir-summary.h
+       camel-mbox-folder.c
+       camel-mbox-folder.h
+       camel-mbox-store.c
+       camel-mbox-store.h
+       camel-mbox-summary.c
+       camel-mbox-summary.h
+       camel-mh-folder.c
+       camel-mh-folder.h
+       camel-mh-settings.c
+       camel-mh-settings.h
+       camel-mh-store.c
+       camel-mh-store.h
+       camel-mh-summary.c
+       camel-mh-summary.h
+)
+
+if(NOT WIN32)
+       list(APPEND SOURCES
+               camel-spool-folder.c
+               camel-spool-folder.h
+               camel-spool-settings.c
+               camel-spool-settings.h
+               camel-spool-store.c
+               camel-spool-store.h
+               camel-spool-summary.c
+               camel-spool-summary.h
+       )
+endif(NOT WIN32)
+
+add_library(camellocal MODULE ${SOURCES})
+
+add_dependencies(camellocal camel)
+
+target_compile_definitions(camellocal PRIVATE
+       -DG_LOG_DOMAIN=\"camel-local-provider\"
+)
+
+target_compile_options(camellocal PUBLIC
+       ${CAMEL_CFLAGS}
+)
+
+target_include_directories(camellocal PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_BINARY_DIR}/camel
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_SOURCE_DIR}/camel
+       ${CAMEL_INCLUDE_DIRS}
+)
+
+target_link_libraries(camellocal
+       camel
+       ${CAMEL_LDFLAGS}
+)
+
+install(TARGETS camellocal
+       DESTINATION ${camel_providerdir}
+)
+
+install(FILES libcamellocal.urls
+       DESTINATION ${camel_providerdir}
+)
diff --git a/camel/providers/nntp/CMakeLists.txt b/camel/providers/nntp/CMakeLists.txt
new file mode 100644
index 0000000..bdf2298
--- /dev/null
+++ b/camel/providers/nntp/CMakeLists.txt
@@ -0,0 +1,50 @@
+set(SOURCES
+       camel-nntp-folder.c
+       camel-nntp-folder.h
+       camel-nntp-private.h
+       camel-nntp-provider.c
+       camel-nntp-resp-codes.h
+       camel-nntp-settings.c
+       camel-nntp-settings.h
+       camel-nntp-store-summary.c
+       camel-nntp-store-summary.h
+       camel-nntp-store.c
+       camel-nntp-store.h
+       camel-nntp-stream.c
+       camel-nntp-stream.h
+       camel-nntp-summary.c
+       camel-nntp-summary.h
+)
+
+add_library(camelnntp MODULE ${SOURCES})
+
+add_dependencies(camelnntp camel)
+
+target_compile_definitions(camelnntp PRIVATE
+       -DG_LOG_DOMAIN=\"camel-nntp-provider\"
+)
+
+target_compile_options(camelnntp PUBLIC
+       ${CAMEL_CFLAGS}
+)
+
+target_include_directories(camelnntp PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_BINARY_DIR}/camel
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_SOURCE_DIR}/camel
+       ${CAMEL_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelnntp
+       camel
+       ${CAMEL_LDFLAGS}
+)
+
+install(TARGETS camelnntp
+       DESTINATION ${camel_providerdir}
+)
+
+install(FILES libcamelnntp.urls
+       DESTINATION ${camel_providerdir}
+)
diff --git a/camel/providers/pop3/CMakeLists.txt b/camel/providers/pop3/CMakeLists.txt
new file mode 100644
index 0000000..f3d8c6a
--- /dev/null
+++ b/camel/providers/pop3/CMakeLists.txt
@@ -0,0 +1,46 @@
+set(SOURCES
+       camel-pop3-engine.c
+       camel-pop3-engine.h
+       camel-pop3-folder.c
+       camel-pop3-folder.h
+       camel-pop3-provider.c
+       camel-pop3-settings.c
+       camel-pop3-settings.h
+       camel-pop3-stream.c
+       camel-pop3-stream.h
+       camel-pop3-store.c
+       camel-pop3-store.h
+)
+
+add_library(camelpop3 MODULE ${SOURCES})
+
+add_dependencies(camelpop3 camel)
+
+target_compile_definitions(camelpop3 PRIVATE
+       -DG_LOG_DOMAIN=\"camel-pop3-provider\"
+)
+
+target_compile_options(camelpop3 PUBLIC
+       ${CAMEL_CFLAGS}
+)
+
+target_include_directories(camelpop3 PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_BINARY_DIR}/camel
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_SOURCE_DIR}/camel
+       ${CAMEL_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelpop3
+       camel
+       ${CAMEL_LDFLAGS}
+)
+
+install(TARGETS camelpop3
+       DESTINATION ${camel_providerdir}
+)
+
+install(FILES libcamelpop3.urls
+       DESTINATION ${camel_providerdir}
+)
diff --git a/camel/providers/sendmail/CMakeLists.txt b/camel/providers/sendmail/CMakeLists.txt
new file mode 100644
index 0000000..ee808e9
--- /dev/null
+++ b/camel/providers/sendmail/CMakeLists.txt
@@ -0,0 +1,42 @@
+set(SOURCES
+       camel-sendmail-settings.c
+       camel-sendmail-settings.h
+       camel-sendmail-provider.c
+       camel-sendmail-transport.c
+       camel-sendmail-transport.h
+)
+
+add_library(camelsendmail MODULE ${SOURCES})
+
+add_dependencies(camelsendmail camel)
+
+target_compile_definitions(camelsendmail PRIVATE
+       -DG_LOG_DOMAIN=\"camel-sendmail-provider\"
+)
+
+target_compile_options(camelsendmail PUBLIC
+       ${CAMEL_CFLAGS}
+)
+
+target_include_directories(camelsendmail PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_BINARY_DIR}/camel
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_SOURCE_DIR}/camel
+       ${CAMEL_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelsendmail
+       camel
+       ${CAMEL_LDFLAGS}
+)
+
+install(TARGETS camelsendmail
+       DESTINATION ${camel_providerdir}
+)
+
+install(FILES libcamelsendmail.urls
+       DESTINATION ${camel_providerdir}
+)
+
+unset(SOURCES)
diff --git a/camel/providers/smtp/CMakeLists.txt b/camel/providers/smtp/CMakeLists.txt
new file mode 100644
index 0000000..b08ff12
--- /dev/null
+++ b/camel/providers/smtp/CMakeLists.txt
@@ -0,0 +1,40 @@
+set(SOURCES
+       camel-smtp-provider.c
+       camel-smtp-settings.c
+       camel-smtp-settings.h
+       camel-smtp-transport.c
+       camel-smtp-transport.h
+)
+
+add_library(camelsmtp MODULE ${SOURCES})
+
+add_dependencies(camelsmtp camel)
+
+target_compile_definitions(camelsmtp PRIVATE
+       -DG_LOG_DOMAIN=\"camel-smtp-provider\"
+)
+
+target_compile_options(camelsmtp PUBLIC
+       ${CAMEL_CFLAGS}
+)
+
+target_include_directories(camelsmtp PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_BINARY_DIR}/camel
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_SOURCE_DIR}/camel
+       ${CAMEL_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelsmtp
+       camel
+       ${CAMEL_LDFLAGS}
+)
+
+install(TARGETS camelsmtp
+       DESTINATION ${camel_providerdir}
+)
+
+install(FILES libcamelsmtp.urls
+       DESTINATION ${camel_providerdir}
+)
diff --git a/cmake/modules/CodeCoverageGCOV.cmake b/cmake/modules/CodeCoverageGCOV.cmake
index aa33677..bf670e0 100644
--- a/cmake/modules/CodeCoverageGCOV.cmake
+++ b/cmake/modules/CodeCoverageGCOV.cmake
@@ -17,7 +17,7 @@ include(PrintableOptions)
 add_printable_option(ENABLE_CODE_COVERAGE "Enable build with GCOV code coverage" OFF)
 
 if(ENABLE_CODE_COVERAGE)
-       if("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc")
+       if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
                CHECK_LIBRARY_EXISTS("gcov" "gcov_exit" "" HAVE_GCOV_LIBRARY)
                if(HAVE_GCOV_LIBRARY)
                        set(CODE_COVERAGE_CFLAGS "-O0 -g -fprofile-arcs -ftest-coverage")
@@ -34,9 +34,9 @@ if(ENABLE_CODE_COVERAGE)
                        message(FATAL_ERROR "Cannot fing gcov library, use -DENABLE_CODE_COVERAGE=OFF disable 
it")
                endif(HAVE_GCOV_LIBRARY)
 
-       else("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc")
+       else("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
                message(FATAL_ERROR "Code coverage requires gcc compiler, use -DENABLE_CODE_COVERAGE=OFF 
disable it")
-       endif("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc")
+       endif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
 else(ENABLE_CODE_COVERAGE)
        set(CODE_COVERAGE_DEFINES "")
        set(CODE_COVERAGE_CFLAGS "")
diff --git a/cmake/modules/GLibTools.cmake b/cmake/modules/GLibTools.cmake
new file mode 100644
index 0000000..62fcd12
--- /dev/null
+++ b/cmake/modules/GLibTools.cmake
@@ -0,0 +1,104 @@
+# GLibTools.cmake
+#
+# Provides functions to run glib tools.
+#
+# Functions:
+# glib_mkenums(_output_filename_noext _enums_header _define_name)
+#    runs glib-mkenums to generate enumtypes .h and .c files from _enums_header.
+#    It searches for files in the current source directory and exports to the current
+#    binary directory.
+#
+#    An example call is:
+#        glib_mkenums(camel-enumtypes camel-enums.h CAMEL_ENUMTYPES_H)
+#        which uses camel-enums.h as the source of known enums and generates
+#        camel-enumtypes.h which will use the CAMEL_ENUMTYPES_H define
+#        and also generates camel-enumtypes.c with the needed code.
+
+find_program(GLIB_MKENUMS glib-mkenums)
+if(NOT GLIB_MKENUMS)
+       message(FATAL_ERROR "Cannot find glib-mkenums, which is required to build ${PROJECT_NAME}")
+endif(NOT GLIB_MKENUMS)
+
+function(glib_mkenums _output_filename_noext _enums_header _define_name)
+       set(HEADER_TMPL "
+/*** BEGIN file-header ***/
+#ifndef ${_define_name}
+#define ${_define_name}
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* Enumerations from \"@filename@\" */
+
+/*** END file-production ***/
+
+/*** BEGIN enumeration-production ***/
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@  (@enum_name@_get_type())
+GType @enum_name@_get_type     (void) G_GNUC_CONST;
+
+/*** END enumeration-production ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* ${_define_name} */
+/*** END file-tail ***/")
+
+       file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes.h.template" 
"${HEADER_TMPL}\n")
+
+       add_custom_command(
+               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h
+               COMMAND ${GLIB_MKENUMS} --template 
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes.h.template" 
"${CMAKE_CURRENT_SOURCE_DIR}/${_enums_header}" >${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h
+       )
+
+set(SOURCE_TMPL "
+/*** BEGIN file-header ***/
+#include \"${_output_filename_noext}.h\"
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from \"@filename@\" */
+#include \"@filename@\"
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+       static volatile gsize the_type__volatile = 0;
+
+       if (g_once_init_enter (&the_type__volatile)) {
+               static const G\@Type\@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+                       { \@VALUENAME\@,
+                         \"@VALUENAME@\",
+                         \"@valuenick@\" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+                       { 0, NULL, NULL }
+               };
+               GType the_type = g_\@type\@_register_static (
+                       g_intern_static_string (\"@EnumName@\"),
+                       values);
+               g_once_init_leave (&the_type__volatile, the_type);
+       }
+       return the_type__volatile;
+}
+
+/*** END value-tail ***/")
+
+       file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes.c.template" 
"${SOURCE_TMPL}\n")
+
+       add_custom_command(
+               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c
+               COMMAND ${GLIB_MKENUMS} --template 
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes.c.template" 
"${CMAKE_CURRENT_SOURCE_DIR}/${_enums_header}" >${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c
+       )
+endfunction()
diff --git a/cmake/modules/PkgConfigEx.cmake b/cmake/modules/PkgConfigEx.cmake
index f562b57..c8bfce0 100644
--- a/cmake/modules/PkgConfigEx.cmake
+++ b/cmake/modules/PkgConfigEx.cmake
@@ -76,3 +76,15 @@ function(pkg_check_variable _output_name _pkg _name)
 
     set("${_output_name}" "${_pkg_result}" CACHE STRING "pkg-config variable ${_name} of ${_pkg}")
 endfunction()
+
+macro(add_pkgconfig_file _input _output)
+       configure_file(
+               ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+               ${CMAKE_CURRENT_BINARY_DIR}/${_output}
+               @ONLY
+       )
+
+       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_output}
+               DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
+       )
+endmacro()
diff --git a/cmake/modules/SetupBuildFlags.cmake b/cmake/modules/SetupBuildFlags.cmake
index bff58ce..6b7f3fc 100644
--- a/cmake/modules/SetupBuildFlags.cmake
+++ b/cmake/modules/SetupBuildFlags.cmake
@@ -5,14 +5,13 @@
 include(CheckCCompilerFlag)
 include(CheckCXXCompilerFlag)
 
-function(setup_build_flags _maintainer_mode)
+macro(setup_build_flags _maintainer_mode)
        list(APPEND proposed_flags
                -Werror-implicit-function-declaration
                -Wformat
                -Wformat-security
                -Winit-self
                -Wmissing-declarations
-               -Wmissing-include-dirs
                -Wmissing-noreturn
                -Wpointer-arith
                -Wredundant-decls
@@ -27,9 +26,12 @@ function(setup_build_flags _maintainer_mode)
                        -Wall
                        -Wextra
                        -Wdeprecated-declarations
+                       -Wmissing-include-dirs
                )
        else(_maintainer_mode)
-               list(APPEND proposed_flags -Wno-deprecated-declarations)
+               list(APPEND proposed_flags
+                       -Wno-deprecated-declarations
+                       -Wno-missing-include-dir)
        endif(_maintainer_mode)
 
        list(APPEND proposed_c_flags
@@ -70,10 +72,10 @@ function(setup_build_flags _maintainer_mode)
                unset(cxx_flag_${flag}_supported)
        endforeach()
 
-       if(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc"))
+       if(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
                set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
                set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
                set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
                set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -Wl,--no-undefined")
-       endif(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "gcc"))
-endfunction()
+       endif(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
+endmacro()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]