[evolution-data-server/wip/cmake] Finish/correct UOA module build



commit 702ec02df15f22a715b54c24187c236191b8e2c6
Author: Milan Crha <mcrha redhat com>
Date:   Tue Sep 27 12:57:27 2016 +0200

    Finish/correct UOA module build

 cmake/modules/FindIntltool.cmake              |   34 ++++-
 modules/ubuntu-online-accounts/CMakeLists.txt |  164 ++++++++++++++++---------
 2 files changed, 133 insertions(+), 65 deletions(-)
---
diff --git a/cmake/modules/FindIntltool.cmake b/cmake/modules/FindIntltool.cmake
index 8553019..4b27fd9 100644
--- a/cmake/modules/FindIntltool.cmake
+++ b/cmake/modules/FindIntltool.cmake
@@ -115,17 +115,37 @@ macro(intltool_process_po_files)
 endmacro(intltool_process_po_files)
 
 macro(intltool_merge _in_filename _out_filename)
-       get_filename_component(_path ${_in_filename} DIRECTORY)
+       set(_in ${_in_filename})
+       set(_out ${_out_filename})
+
+       get_filename_component(_path ${_in} DIRECTORY)
        if(_path STREQUAL "")
-               set(_in_filename "${CMAKE_CURRENT_SOURCE_DIR}/${_in_filename}")
+               set(_in ${CMAKE_CURRENT_SOURCE_DIR}/${_in})
        endif(_path STREQUAL "")
 
-       get_filename_component(_path ${_out_filename} DIRECTORY)
+       get_filename_component(_path ${_out} DIRECTORY)
        if(_path STREQUAL "")
-               set(_out_filename "${CMAKE_CURRENT_BINARY_DIR}/${_out_filename}")
+               set(_out ${CMAKE_CURRENT_BINARY_DIR}/${_out})
        endif(_path STREQUAL "")
 
-       add_custom_command(OUTPUT ${_out_filename}
-               COMMAND ${INTLTOOL_MERGE} ${ARGN} "${GETTEXT_PO_DIR}" "${_in_filename}" "${_out_filename}"
-       )
+       set(_has_no_translations OFF)
+       set(_args)
+       foreach(_arg ${ARGN})
+               list(APPEND _args "${_arg}")
+               if(_arg STREQUAL "--no-translations")
+                       set(_has_no_translations ON)
+               endif(_arg STREQUAL "--no-translations")
+       endforeach(_arg)
+
+       if(_has_no_translations)
+               add_custom_command(OUTPUT ${_out}
+                       COMMAND ${INTLTOOL_MERGE} ${_args} --quiet "${_in}" "${_out}"
+                       DEPENDS ${_in}
+               )
+       else(_has_no_translations)
+               add_custom_command(OUTPUT ${_out}
+                       COMMAND ${INTLTOOL_MERGE} ${_args} --quiet "${GETTEXT_PO_DIR}" "${_in}" "${_out}"
+                       DEPENDS ${_in}
+               )
+       endif(_has_no_translations)
 endmacro(intltool_merge)
diff --git a/modules/ubuntu-online-accounts/CMakeLists.txt b/modules/ubuntu-online-accounts/CMakeLists.txt
index d4d0ca1..4eeb7c8 100644
--- a/modules/ubuntu-online-accounts/CMakeLists.txt
+++ b/modules/ubuntu-online-accounts/CMakeLists.txt
@@ -1,9 +1,108 @@
-set(extra_deps)
+# ******************************
+# Data files
+# ******************************
+
+set(filedeps)
+
+set(servicetype_files)
+set(servicetype_files_gen)
+list(APPEND servicetype_files
+       mail.service-type
+       calendar.service-type
+       contacts.service-type
+)
+
+set(service_files)
+set(service_files_gen)
+list(APPEND service_files
+       google-gmail.service
+       google-calendar.service
+       google-contacts.service
+       windows-live-mail.service
+       yahoo-mail.service
+       yahoo-calendar.service
+)
+
+configure_file(evolution-data-server.application.in.in
+       evolution-data-server.application.in
+       @ONLY
+)
+
+intltool_merge(${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server.application.in 
evolution-data-server.application --no-translations --xml-style --utf8)
+
+configure_file(evolution-data-server-uoa.desktop.in.in
+       evolution-data-server-uoa.desktop.in
+       @ONLY
+)
+
+intltool_merge(${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server-uoa.desktop.in 
evolution-data-server-uoa.desktop --desktop-style --utf8)
+
+list(APPEND filedeps ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server.application)
+list(APPEND filedeps ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server-uoa.desktop)
+
+foreach(_file IN LISTS servicetype_files)
+       configure_file(${_file}.in.in
+               ${_file}.in
+               @ONLY
+       )
+       intltool_merge(${CMAKE_CURRENT_BINARY_DIR}/${_file}.in ${_file} --no-translations --xml-style --utf8)
+       list(APPEND servicetype_files_gen ${CMAKE_CURRENT_BINARY_DIR}/${_file})
+       list(APPEND filedeps ${CMAKE_CURRENT_BINARY_DIR}/${_file})
+endforeach(_file)
+
+foreach(_file IN LISTS service_files)
+       configure_file(${_file}.in.in
+               ${_file}.in
+               @ONLY
+       )
+       intltool_merge(${CMAKE_CURRENT_BINARY_DIR}/${_file}.in ${_file} --no-translations --xml-style --utf8)
+       list(APPEND service_files_gen ${CMAKE_CURRENT_BINARY_DIR}/${_file})
+       list(APPEND filedeps ${CMAKE_CURRENT_BINARY_DIR}/${_file})
+endforeach(_file)
+
+set(desktopdir ${SHARE_INSTALL_DIR}/applications)
+pkg_check_variable(libaccountsprefixdir libaccounts-glib prefix)
+pkg_check_variable(applicationdir libaccounts-glib applicationfilesdir)
+pkg_check_variable(servicetypedir libaccounts-glib servicetypefilesdir)
+pkg_check_variable(servicedir libaccounts-glib servicefilesdir)
+
+# To honor configured prefix, but still use the right place
+string(REPLACE "${libaccountsprefixdir}" "${CMAKE_INSTALL_PREFIX}" applicationdir "${applicationdir}")
+string(REPLACE "${libaccountsprefixdir}" "${CMAKE_INSTALL_PREFIX}" servicetypedir "${servicetypedir}")
+string(REPLACE "${libaccountsprefixdir}" "${CMAKE_INSTALL_PREFIX}" servicedir "${servicedir}")
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server.application
+       DESTINATION ${applicationdir}
+)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server-uoa.desktop
+       DESTINATION ${desktopdir}
+)
+
+install(FILES ${servicetype_files_gen}
+       DESTINATION ${servicetypedir}
+)
+
+install(FILES ${service_files_gen}
+       DESTINATION ${servicedir}
+)
+
+# ******************************
+# Source registry module
+# ******************************
+
 set(sources
        module-ubuntu-online-accounts.c
        uoa-utils.c
        uoa-utils.h
 )
+set(extra_deps)
+set(extra_filedeps
+       ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server.application
+       ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server-uoa.desktop
+       ${servicetype_files_gen}
+       ${service_files_gen}
+)
 set(extra_defines)
 set(extra_cflags
        ${LIBACCOUNTS_GLIB_CFLAGS}
@@ -33,6 +132,12 @@ add_source_registry_module(module-ubuntu-online-accounts
        extra_ldflags
 )
 
+add_custom_target(module-ubuntu-online-accounts-files
+       DEPENDS ${filedeps}
+)
+
+add_dependencies(module-ubuntu-online-accounts module-ubuntu-online-accounts-files)
+
 # ******************************
 # Credentials module
 # ******************************
@@ -51,60 +156,3 @@ add_credentials_module(module-credentials-uoa
        extra_incdirs
        extra_ldflags
 )
-
-# ******************************
-# Data files
-# ******************************
-
-set(servicetype_files)
-set(servicetype_files_gen)
-list(APPEND servicetype_files
-       mail.service-type
-       calendar.service-type
-       contacts.service-type
-)
-
-set(service_files)
-set(service_files_gen)
-list(APPEND service_files
-       google-gmail.service
-       google-calendar.service
-       google-contacts.service
-       windows-live-mail.service
-       yahoo-mail.service
-       yahoo-calendar.service
-)
-
-intltool_merge(evolution-data-server.application.in evolution-data-server.application --no-translations 
--xml-style  --utf8)
-intltool_merge(evolution-data-server-uoa.desktop.in evolution-data-server-uoa.desktop --desktop-style --utf8)
-
-foreach(_file IN LISTS servicetype_files)
-       intltool_merge(${_file}.in ${_file} --no-translations -x -u)
-       list(APPEND servicetype_files_gen ${CMAKE_CURRENT_BINARY_DIR}/${_file})
-endforeach(_file)
-
-foreach(_file IN LISTS service_files)
-       intltool_merge(${_file}.in ${_file} --no-translations -x -u)
-       list(APPEND service_files_gen ${CMAKE_CURRENT_BINARY_DIR}/${_file})
-endforeach(_file)
-
-desktopdir = ${SHARE_INSTALL_DIR}/applications
-pkg_check_variable(applicationdir libaccounts-glib applicationfilesdir)
-pkg_check_variable(servicetypedir libaccounts-glib servicetypefilesdir)
-pkg_check_variable(servicedir libaccounts-glib servicefilesdir)
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server.application
-       DESTINATION ${applicationdir}
-)
-
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/evolution-data-server-uoa.desktop
-       DESTINATION ${desktopdir}
-)
-
-install(FILES ${servicetype_files_gen}
-       DESTINATION ${servicetypedir}
-)
-
-install(FILES ${service_files_gen}
-       DESTINATION ${servicedir}
-)


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