[Cmake-commits] CMake branch, next, updated. v2.8.5-2008-g56f5043

Clinton Stimpson clinton at elemtech.com
Mon Oct 3 13:02:01 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  56f5043b03c0795dd3f392391763f4f0d0aa1f89 (commit)
       via  06180459cc61a107047957edbc945116e3ca6171 (commit)
       via  cf4b52980db90600fb9bf77f826ae72b38f71967 (commit)
      from  ea832e530542edb30596d12a30fef81401852266 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=56f5043b03c0795dd3f392391763f4f0d0aa1f89
commit 56f5043b03c0795dd3f392391763f4f0d0aa1f89
Merge: ea832e5 0618045
Author:     Clinton Stimpson <clinton at elemtech.com>
AuthorDate: Mon Oct 3 13:01:59 2011 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Oct 3 13:01:59 2011 -0400

    Merge topic 'qt4-deploy-module' into next
    
    0618045 Add DeployQt4 module.
    cf4b529 Add QT_LIBRARIES_PLUGINS variable to UseQt4.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=06180459cc61a107047957edbc945116e3ca6171
commit 06180459cc61a107047957edbc945116e3ca6171
Author:     Mike McQuaid <mike at mikemcquaid.com>
AuthorDate: Fri Sep 30 13:40:49 2011 +0100
Commit:     Clinton Stimpson <clinton at elemtech.com>
CommitDate: Mon Oct 3 11:01:48 2011 -0600

    Add DeployQt4 module.
    
    Add a module that gives better support to BundleUtilities to handle
    Qt plugins and deploy Qt applications.

diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
new file mode 100644
index 0000000..bdf8360
--- /dev/null
+++ b/Modules/DeployQt4.cmake
@@ -0,0 +1,274 @@
+# - Functions to help assemble a standalone Qt4 executable.
+# A collection of CMake utility functions useful for deploying
+# Qt4 executables.
+#
+# The following functions are provided by this module:
+#   write_qt4_conf
+#   resolve_qt4_paths
+#   fixup_qt4_executable
+#   install_qt4_plugin_path
+#   install_qt4_plugin
+#   install_qt4_executable
+# Requires CMake 2.6 or greater because it uses function and
+# PARENT_SCOPE. Also depends on BundleUtilities.cmake.
+#
+#  WRITE_QT4_CONF(<qt_conf_dir> <qt_conf_contents>)
+# Writes a qt.conf file with the <qt_conf_contents> into <qt_conf_dir>.
+#
+#  RESOLVE_QT4_PATHS(<paths_var> [<executable_path>])
+# Loop through <paths_var> list and if any don't exist resolve them
+# relative to the <executable_path> (if supplied) or the CMAKE_INSTALL_PREFIX.
+#
+#  FIXUP_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
+# Copies Qt plugins, writes a Qt configuration file (if needed) and fixes up a
+# Qt4 executable using BundleUtilities so it is standalone and can be
+# drag-and-drop copied to another machine as long as all of the system
+# libraries are compatible.
+#
+# <executable> should point to the executable to be fixed-up.
+#
+# <qtplugins> should contain a list of the names or paths of any Qt plugins
+# to be installed.
+#
+# <libs> will be passed to BundleUtilities and should be a list of any already
+# installed plugins, libraries or executables to also be fixed-up.
+#
+# <dirs> will be passed to BundleUtilities and should contain and directories
+# to be searched to find library dependencies.
+#
+# <plugins_dir> allows an custom plugins directory to be used.
+#
+# <request_qt_conf> will force a qt.conf file to be written even if not needed.
+#
+#  INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var <plugins_dir> <component> <configurations>)
+# Install (or copy) a resolved <plugin> to the default plugins directory
+# (or <plugins_dir>) relative to <executable> and store the result in
+# <installed_plugin_path_var>.
+#
+# If <copy> is set to TRUE then the plugins will be copied rather than
+# installed. This is to allow this module to be used at CMake time rather than
+# install time.
+#
+# If <component> is set then anything installed will use this COMPONENT.
+#
+#  INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var <plugins_dir> <component>)
+# Install (or copy) an unresolved <plugin> to the default plugins directory
+# (or <plugins_dir>) relative to <executable> and store the result in
+# <installed_plugin_path_var>. See documentation of INSTALL_QT4_PLUGIN_PATH.
+#
+#  INSTALL_QT4_EXECUTABLE(<executable> <qtplugins> [<libs> <dirs> <plugins_dir> <request_qt_conf>])
+# Installs Qt plugins, writes a Qt configuration file (if needed) and fixes up
+# a Qt4 executable using BundleUtilities so it is standalone and can be
+# drag-and-drop copied to another machine as long as all of the system
+# libraries are compatible. The executable will be fixed-up at install time.
+# See documentation of FIXUP_QT4_BUNDLE.
+
+#=============================================================================
+# Copyright 2011 Mike McQuaid <mike at mikemcquaid.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# The functions defined in this file depend on the fixup_bundle function
+# (and others) found in BundleUtilities.cmake
+
+include(BundleUtilities)
+set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
+
+function(write_qt4_conf qt_conf_dir qt_conf_contents)
+        set(qt_conf_path "${qt_conf_dir}/qt.conf")
+        message(STATUS "Writing ${qt_conf_path}")
+        file(WRITE "${qt_conf_path}" "${qt_conf_contents}")
+endfunction()
+
+function(resolve_qt4_paths paths_var)
+        set(executable_path ${ARGV1})
+
+        set(paths_resolved)
+        foreach(path ${${paths_var}})
+                if(EXISTS "${path}")
+                        list(APPEND paths_resolved "${path}")
+                else()
+                        if(${executable_path})
+                                list(APPEND paths_resolved "${executable_path}/${path}")
+                        else()
+                                list(APPEND paths_resolved "\${CMAKE_INSTALL_PREFIX}/${path}")
+                        endif()
+                endif()
+        endforeach()
+        set(${paths_var} ${paths_resolved} PARENT_SCOPE)
+endfunction()
+
+function(fixup_qt4_executable executable qtplugins)
+        set(libs ${ARGV2})
+        set(dirs ${ARGV3})
+        set(plugins_dir ${ARGV4})
+        set(request_qt_conf ${ARGV5})
+
+        message(STATUS "fixup_qt4_executable")
+        message(STATUS "  executable='${executable}'")
+        message(STATUS "  qtplugins='${qtplugins}'")
+        message(STATUS "  libs='${libs}'")
+        message(STATUS "  dirs='${dirs}'")
+        message(STATUS "  plugins_dir='${plugins_dir}'")
+        message(STATUS "  request_qt_conf='${request_qt_conf}'")
+
+        if(QT_LIBRARY_DIR)
+                list(APPEND dirs "${QT_LIBRARY_DIR}")
+        endif()
+
+        if(APPLE)
+                set(qt_conf_dir "${executable}/Contents/Resources")
+                set(executable_path "${executable}")
+                set(write_qt_conf TRUE)
+        else()
+                get_filename_component(executable_path "${executable}" PATH)
+                if(NOT executable_path)
+                        set(executable_path ".")
+                endif()
+                set(qt_conf_dir "${executable_path}")
+                set(write_qt_conf ${request_qt_conf})
+        endif()
+
+        foreach(plugin ${qtplugins})
+                set(installed_plugin_path "")
+                install_qt4_plugin("${plugin}" "${plugins_dir}" "${executable}" 1 installed_plugin_path)
+                list(APPEND libs ${installed_plugin_path})
+        endforeach()
+
+        foreach(lib ${libs})
+                if(NOT EXISTS "${lib}")
+                        message(FATAL_ERROR "Library does not exist: ${lib}")
+                endif()
+        endforeach()
+
+        resolve_qt4_paths(libs "${executable_path}")
+        resolve_qt4_paths(dirs "${executable_path}")
+
+        if(write_qt_conf)
+                set(qt_conf_contents "[Paths]\nPlugins = ${plugins_dir}")
+                write_qt4_conf("${qt_conf_dir}" "${qt_conf_contents}")
+        endif()
+
+        fixup_bundle("${executable}" "${libs}" "${dirs}")
+endfunction()
+
+function(install_qt4_plugin_path plugin executable copy installed_plugin_path_var)
+        set(plugins_dir ${ARGV4})
+        set(component ${ARGV5})
+        set(configurations ${ARGV6})
+        if(EXISTS "${plugin}")
+                if(plugins_dir)
+                        set(plugins_dir "${plugins_dir}")
+                else()
+                        if(APPLE)
+                                set(plugins_dir "PlugIns")
+                        else()
+                                set(plugins_dir "plugins")
+                        endif()
+                endif()
+                if(APPLE)
+                        set(plugins_path "${executable}/Contents/${plugins_dir}")
+                else()
+                        get_filename_component(executable_path "${executable}" PATH)
+                        if(NOT executable_path)
+                                set(executable_path ".")
+                        endif()
+                        set(plugins_path "${executable_path}/${plugins_dir}")
+                endif()
+
+                set(plugin_group "")
+
+                get_filename_component(plugin_path "${plugin}" PATH)
+                get_filename_component(plugin_parent_path "${plugin_path}" PATH)
+                get_filename_component(plugin_parent_dir_name "${plugin_parent_path}" NAME)
+                get_filename_component(plugin_name "${plugin}" NAME)
+                string(TOLOWER "${plugin_parent_dir_name}" plugin_parent_dir_name)
+
+                if("${plugin_parent_dir_name}" STREQUAL "plugins")
+                        get_filename_component(plugin_group "${plugin_path}" NAME)
+                        set(${plugin_group_var} "${plugin_group}")
+                endif()
+                set(plugins_path "${plugins_path}/${plugin_group}")
+
+                if(${copy})
+                        file(MAKE_DIRECTORY "${plugins_path}")
+                        file(COPY "${plugin}" DESTINATION "${plugins_path}")
+                else()
+                        if(configurations AND (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE))
+                                set(configurations CONFIGURATIONS ${configurations})
+                        endif()
+                        if(component)
+                                set(component COMPONENT ${component})
+                        endif()
+                        install(FILES "${plugin}" DESTINATION "${plugins_path}" ${configurations} ${component})
+                endif()
+                set(${installed_plugin_path_var} ${${installed_path_var}} "${plugins_path}/${plugin_name}" PARENT_SCOPE)
+        endif()
+endfunction()
+
+function(install_qt4_plugin plugin executable copy installed_plugin_path_var)
+        set(plugins_dir ${ARGV4})
+        set(component ${ARGV5})
+        if(EXISTS "${plugin}")
+                install_qt4_plugin_path("${plugin}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}")
+        else()
+                if(QT_IS_STATIC)
+                        string(TOUPPER "QT_${plugin}_LIBRARY" plugin_var)
+                else()
+                        string(TOUPPER "QT_${plugin}_PLUGIN" plugin_var)
+                endif()
+                set(plugin_release "${${plugin_var}_RELEASE}")
+                set(plugin_debug "${${plugin_var}_DEBUG}")
+                if(NOT EXISTS "${plugin_release}" AND NOT EXISTS "${plugin_debug}")
+                        message(WARNING "Qt plugin \"${plugin}\" not recognized or found.")
+                endif()
+                install_qt4_plugin_path("${plugin_release}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Release|RelWithDebInfo|MinSizeRel")
+                install_qt4_plugin_path("${plugin_debug}" "${executable}" "${copy}" "${installed_plugin_path_var}" "${plugins_dir}" "${component}" "Debug")
+        endif()
+        set(installed_plugin_path_var "${installed_plugin_path_var}" PARENT_SCOPE)
+endfunction()
+
+function(install_qt4_executable executable)
+        set(qtplugins ${ARGV1})
+        set(libs ${ARGV2})
+        set(dirs ${ARGV3})
+        set(plugins_dir ${ARGV4})
+        set(request_qt_conf ${ARGV5})
+        set(plugin_component ${ARGV6})
+        if(QT_LIBRARY_DIR)
+                list(APPEND dirs "${QT_LIBRARY_DIR}")
+        endif()
+
+        get_filename_component(executable_absolute "${executable}" ABSOLUTE)
+        gp_file_type("${executable_absolute}" "${QT_QTCORE_LIBRARY}" qtcore_type)
+        if(qtcore_type STREQUAL "system")
+                set(qt_plugins_dir "")
+        endif()
+
+        if(NOT qtplugins AND QT_LIBRARIES_PLUGINS)
+                set(qtplugins "${QT_LIBRARIES_PLUGINS}")
+        endif()
+
+        foreach(plugin ${qtplugins})
+                set(installed_plugin_paths "")
+                install_qt4_plugin("${plugin}" "${executable}" 0 installed_plugin_paths "${plugins_dir}" "${plugin_component}")
+                list(APPEND libs ${installed_plugin_paths})
+        endforeach()
+
+        resolve_qt4_paths(libs)
+        resolve_qt4_paths(dirs)
+
+        install(CODE
+                " INCLUDE( \"${DeployQt4_cmake_dir}/DeployQt4.cmake\" )
+                SET( BU_CHMOD_BUNDLE_ITEMS TRUE )
+                FIXUP_QT4_EXECUTABLE( \"\${CMAKE_INSTALL_PREFIX}/${executable}\" \"\" \"${libs}\" \"${dirs}\" \"${plugins_dir}\" \"${request_qt_conf}\" ) "
+        )
+endfunction()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf4b52980db90600fb9bf77f826ae72b38f71967
commit cf4b52980db90600fb9bf77f826ae72b38f71967
Author:     Mike McQuaid <mike at mikemcquaid.com>
AuthorDate: Wed Jul 20 22:28:32 2011 -0400
Commit:     Clinton Stimpson <clinton at elemtech.com>
CommitDate: Mon Oct 3 11:01:39 2011 -0600

    Add QT_LIBRARIES_PLUGINS variable to UseQt4.

diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 3b05c2b..c56827e 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1062,6 +1062,14 @@ IF (QT_QMAKE_EXECUTABLE AND QTVERSION)
   SET( QT_SCRIPT_PLUGINS qtscriptdbus )
   SET( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds )
 
+  SET( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} )
+  SET( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets )
+  SET( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} )
+  SET( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
+  SET( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} )
+  SET( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} )
+  SET( QT_QTSVG_PLUGINS qsvg qsvgicon )
+
   IF(QT_QMAKE_CHANGED)
     FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES})
       STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type)
diff --git a/Modules/UseQt4.cmake b/Modules/UseQt4.cmake
index dbe28ac..b824392 100644
--- a/Modules/UseQt4.cmake
+++ b/Modules/UseQt4.cmake
@@ -28,6 +28,7 @@ ENDIF()
 INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
 
 SET(QT_LIBRARIES "")
+SET(QT_LIBRARIES_PLUGINS "")
 
 IF (QT_USE_QTMAIN)
   IF (Q_WS_WIN)
@@ -91,6 +92,7 @@ FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
         INCLUDE_DIRECTORIES(${QT_${module}_INCLUDE_DIR})
       ENDIF(QT_USE_${module})
       SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
+      SET(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
       IF(QT_IS_STATIC)
         SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
       ENDIF(QT_IS_STATIC)

-----------------------------------------------------------------------

Summary of changes:
 Modules/DeployQt4.cmake |  274 +++++++++++++++++++++++++++++++++++++++++++++++
 Modules/FindQt4.cmake   |    8 ++
 Modules/UseQt4.cmake    |    2 +
 3 files changed, 284 insertions(+), 0 deletions(-)
 create mode 100644 Modules/DeployQt4.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list