summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt21
-rw-r--r--cmake/CompizBcop.cmake41
-rw-r--r--cmake/CompizCommon.cmake273
-rw-r--r--cmake/CompizDefaults.cmake15
-rw-r--r--cmake/CompizDefaults.cmake.in5
-rw-r--r--cmake/CompizGconf.cmake52
-rw-r--r--cmake/CompizPackage.cmake101
-rw-r--r--cmake/CompizPlugin.cmake451
-rw-r--r--cmake/FindCompiz.cmake89
-rw-r--r--cmake/all_plugins_in_folder_example-CMakeLists.txt10
-rw-r--r--cmake/base.cmake63
11 files changed, 1121 insertions, 0 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
new file mode 100644
index 0000000..be750f3
--- /dev/null
+++ b/cmake/CMakeLists.txt
@@ -0,0 +1,21 @@
+compiz_configure_file (
+ ${CMAKE_CURRENT_SOURCE_DIR}/CompizDefaults.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/CompizDefaults.cmake
+)
+
+set (_files
+ CompizCommon.cmake
+ CompizPlugin.cmake
+ CompizPackage.cmake
+ CompizBcop.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/CompizDefaults.cmake
+)
+
+if (USE_GCONF)
+ list (APPEND _files CompizGconf.cmake)
+endif ()
+
+install (
+ FILES ${_files}
+ DESTINATION ${COMPIZ_DESTDIR}${CMAKE_INSTALL_PREFIX}/share/compiz/cmake
+)
diff --git a/cmake/CompizBcop.cmake b/cmake/CompizBcop.cmake
new file mode 100644
index 0000000..0d00a95
--- /dev/null
+++ b/cmake/CompizBcop.cmake
@@ -0,0 +1,41 @@
+find_program (XSLTPROC_EXECUTABLE xsltproc)
+mark_as_advanced (FORCE XSLTPROC_EXECUTABLE)
+
+if (NOT XSLTPROC_EXECUTABLE)
+ message (FATAL_ERROR "xsltproc not found.")
+endif ()
+
+# does the plugin require bcop
+function (compiz_plugin_needs_bcop _file _return)
+ file (READ ${_file} _xml_content)
+ if ("${_xml_content}" MATCHES "useBcop=\"true\"")
+ set (${_return} TRUE PARENT_SCOPE)
+ else ()
+ set (${_return} FALSE PARENT_SCOPE)
+ endif ()
+endfunction ()
+
+# prepare bcop build
+function (compiz_add_bcop_targets _plugin _file _sources)
+
+ add_custom_command (
+ OUTPUT ${CMAKE_BINARY_DIR}/generated/${_plugin}_options.h
+ COMMAND ${XSLTPROC_EXECUTABLE}
+ -o ${CMAKE_BINARY_DIR}/generated/${_plugin}_options.h
+ --stringparam "file" "header" ${COMPIZ_BCOP_XSLT}
+ ${_file}
+ DEPENDS ${_file}
+ )
+ add_custom_command (
+ OUTPUT ${CMAKE_BINARY_DIR}/generated/${_plugin}_options.cpp
+ COMMAND ${XSLTPROC_EXECUTABLE}
+ -o ${CMAKE_BINARY_DIR}/generated/${_plugin}_options.cpp
+ --stringparam "file" "source" ${COMPIZ_BCOP_XSLT}
+ ${_file} > ${CMAKE_BINARY_DIR}/generated/${_plugin}_options.cpp
+ DEPENDS ${_file}
+ ${CMAKE_BINARY_DIR}/generated/${_plugin}_options.h
+ )
+ set (${_sources} "${CMAKE_BINARY_DIR}/generated/${_plugin}_options.h;${CMAKE_BINARY_DIR}/generated/${_plugin}_options.cpp" PARENT_SCOPE)
+
+
+endfunction () \ No newline at end of file
diff --git a/cmake/CompizCommon.cmake b/cmake/CompizCommon.cmake
new file mode 100644
index 0000000..1ad6900
--- /dev/null
+++ b/cmake/CompizCommon.cmake
@@ -0,0 +1,273 @@
+cmake_minimum_required (VERSION 2.6)
+
+if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
+ message (SEND_ERROR "Building in the source directory is not supported.")
+ message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} <path to the sources>\".")
+endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
+
+#### policies
+
+cmake_policy (SET CMP0000 OLD)
+cmake_policy (SET CMP0002 OLD)
+cmake_policy (SET CMP0003 NEW)
+cmake_policy (SET CMP0005 OLD)
+cmake_policy (SET CMP0011 OLD)
+
+set (CMAKE_SKIP_RPATH FALSE)
+
+option (COMPIZ_BUILD_WITH_RPATH "Leave as ON unless building packages" ON)
+option (COMPIZ_RUN_LDCONFIG "Leave OFF unless you need to run ldconfig after install")
+option (COMPIZ_PACKAGING_ENABLED "Enable to manually set prefix, exec_prefix, libdir, includedir, datadir" OFF)
+set (COMPIZ_DESTDIR ${COMPIZ_DESTDIR} CACHE STRING "Leave blank unless building packages")
+
+set (COMPIZ_DATADIR ${CMAKE_INSTALL_PREFIX}/share)
+set (COMPIZ_METADATADIR ${CMAKE_INSTALL_PREFIX}/share/compiz)
+set (COMPIZ_IMAGEDIR ${CMAKE_INSTALL_PREFIX}/share/compiz/images)
+set (COMPIZ_PLUGINDIR ${libdir}/compiz)
+set (COMPIZ_SYSCONFDIR ${sysconfdir})
+
+set (
+ VERSION ${VERSION} CACHE STRING
+ "Package version that is added to a plugin pkg-version file"
+)
+
+set (
+ COMPIZ_I18N_DIR ${COMPIZ_I18N_DIR} CACHE PATH "Translation file directory"
+)
+
+option (COMPIZ_SIGN_WARNINGS "Should compiz use -Wsign-conversion during compilation." OFF)
+
+if (COMPIZ_SIGN_WARNINGS)
+ set (CMAKE_CXX_FLAGS "-Wall -Wsign-conversion")
+ set (CMAKE_C_FLAGS "-Wall -Wsign-conversion")
+else ()
+ set (CMAKE_CXX_FLAGS "-Wall")
+ set (CMAKE_C_FLAGS "-Wall")
+endif ()
+
+function (compiz_ensure_linkage)
+ find_program (LDCONFIG_EXECUTABLE ldconfig)
+ mark_as_advanced (FORCE LDCONFIG_EXECUTABLE)
+
+ if (LDCONFIG_EXECUTABLE AND ${COMPIZ_RUN_LDCONFIG})
+
+ install (
+ CODE "message (\"Running \" ${LDCONFIG_EXECUTABLE} \" \" ${CMAKE_INSTALL_PREFIX} \"/lib\")
+ exec_program (${LDCONFIG_EXECUTABLE} ARGS \"-v\" ${CMAKE_INSTALL_PREFIX}/lib)"
+ )
+
+ endif (LDCONFIG_EXECUTABLE AND ${COMPIZ_RUN_LDCONFIG})
+endfunction ()
+
+macro (compiz_add_git_dist)
+ set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${VERSION})
+ add_custom_target(dist
+ COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
+ | bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+endmacro ()
+
+# unsets the given variable
+macro (compiz_unset var)
+ set (${var} "" CACHE INTERNAL "")
+endmacro ()
+
+# sets the given variable
+macro (compiz_set var value)
+ set (${var} ${value} CACHE INTERNAL "")
+endmacro ()
+
+
+macro (compiz_format_string str length return)
+ string (LENGTH "${str}" _str_len)
+ math (EXPR _add_chr "${length} - ${_str_len}")
+ set (${return} "${str}")
+ while (_add_chr GREATER 0)
+ set (${return} "${${return}} ")
+ math (EXPR _add_chr "${_add_chr} - 1")
+ endwhile ()
+endmacro ()
+
+string (ASCII 27 _escape)
+function (compiz_color_message _str)
+ if (CMAKE_COLOR_MAKEFILE)
+ message (${_str})
+ else ()
+ string (REGEX REPLACE "${_escape}.[0123456789;]*m" "" __str ${_str})
+ message (${__str})
+ endif ()
+endfunction ()
+
+function (compiz_configure_file _src _dst)
+ foreach (_val ${ARGN})
+ set (_${_val}_sav ${${_val}})
+ set (${_val} "")
+ foreach (_word ${_${_val}_sav})
+ set (${_val} "${${_val}}${_word} ")
+ endforeach (_word ${_${_val}_sav})
+ endforeach (_val ${ARGN})
+
+ configure_file (${_src} ${_dst} @ONLY)
+
+ foreach (_val ${ARGN})
+ set (${_val} ${_${_val}_sav})
+ set (_${_val}_sav "")
+ endforeach (_val ${ARGN})
+endfunction ()
+
+function (compiz_add_plugins_in_folder folder)
+ file (
+ GLOB _plugins_in
+ RELATIVE "${folder}"
+ "${folder}/*/CMakeLists.txt"
+ )
+
+ foreach (_plugin ${_plugins_in})
+ get_filename_component (_plugin_dir ${_plugin} PATH)
+ add_subdirectory (${folder}/${_plugin_dir})
+ endforeach ()
+endfunction ()
+
+#### pkg-config handling
+
+include (FindPkgConfig)
+
+function (compiz_pkg_check_modules _var _req)
+ if (NOT ${_var})
+ pkg_check_modules (${_var} ${_req} ${ARGN})
+ if (${_var}_FOUND)
+ set (${_var} 1 CACHE INTERNAL "" FORCE)
+ endif ()
+ set(__pkg_config_checked_${_var} 0 CACHE INTERNAL "" FORCE)
+ endif ()
+endfunction ()
+
+#### translations
+
+# translate metadata file
+function (compiz_translate_xml _src _dst)
+ find_program (INTLTOOL_MERGE_EXECUTABLE intltool-merge)
+ mark_as_advanced (FORCE INTLTOOL_MERGE_EXECUTABLE)
+
+ if (INTLTOOL_MERGE_EXECUTABLE
+ AND COMPIZ_I18N_DIR
+ AND EXISTS ${COMPIZ_I18N_DIR})
+ add_custom_command (
+ OUTPUT ${_dst}
+ COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -x -u -c
+ ${CMAKE_BINARY_DIR}/.intltool-merge-cache
+ ${COMPIZ_I18N_DIR}
+ ${_src}
+ ${_dst}
+ DEPENDS ${_src}
+ )
+ else ()
+ add_custom_command (
+ OUTPUT ${_dst}
+ COMMAND cat ${_src} |
+ sed -e 's;<_;<;g' -e 's;</_;</;g' >
+ ${_dst}
+ DEPENDS ${_src}
+ )
+ endif ()
+endfunction ()
+
+function (compiz_translate_desktop_file _src _dst)
+ find_program (INTLTOOL_MERGE_EXECUTABLE intltool-merge)
+ mark_as_advanced (FORCE INTLTOOL_MERGE_EXECUTABLE)
+
+ if (INTLTOOL_MERGE_EXECUTABLE
+ AND COMPIZ_I18N_DIR
+ AND EXISTS ${COMPIZ_I18N_DIR})
+ add_custom_command (
+ OUTPUT ${_dst}
+ COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d -u -c
+ ${CMAKE_BINARY_DIR}/.intltool-merge-cache
+ ${COMPIZ_I18N_DIR}
+ ${_src}
+ ${_dst}
+ DEPENDS ${_src}
+ )
+ else ()
+ add_custom_command (
+ OUTPUT ${_dst}
+ COMMAND cat ${_src} |
+ sed -e 's;^_;;g' >
+ ${_dst}
+ DEPENDS ${_src}
+ )
+ endif ()
+endfunction ()
+
+#### optional file install
+
+function (compiz_opt_install_file _src _dst)
+ install (CODE
+ "message (\"-- Installing: ${_dst}\")
+ execute_process (
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${_src}\" \"${COMPIZ_DESTDIR}${_dst}\"
+ RESULT_VARIABLE _result
+ OUTPUT_QUIET ERROR_QUIET
+ )
+ if (_result)
+ message (\"-- Failed to install: ${_dst}\")
+ endif ()
+ "
+ )
+endfunction ()
+
+#### uninstall
+
+macro (compiz_add_uninstall)
+ if (NOT _compiz_uninstall_rule_created)
+ compiz_set(_compiz_uninstall_rule_created TRUE)
+
+ set (_file "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
+
+ file (WRITE ${_file} "if (NOT EXISTS \"${CMAKE_BINARY_DIR}/install_manifest.txt\")\n")
+ file (APPEND ${_file} " message (FATAL_ERROR \"Cannot find install manifest: \\\"${CMAKE_BINARY_DIR}/install_manifest.txt\\\"\")\n")
+ file (APPEND ${_file} "endif (NOT EXISTS \"${CMAKE_BINARY_DIR}/install_manifest.txt\")\n\n")
+ file (APPEND ${_file} "file (READ \"${CMAKE_BINARY_DIR}/install_manifest.txt\" files)\n")
+ file (APPEND ${_file} "string (REGEX REPLACE \"\\n\" \";\" files \"\${files}\")\n")
+ file (APPEND ${_file} "foreach (file \${files})\n")
+ file (APPEND ${_file} " message (STATUS \"Uninstalling \\\"\${file}\\\"\")\n")
+ file (APPEND ${_file} " if (EXISTS \"\${file}\")\n")
+ file (APPEND ${_file} " exec_program(\n")
+ file (APPEND ${_file} " \"${CMAKE_COMMAND}\" ARGS \"-E remove \\\"\${file}\\\"\"\n")
+ file (APPEND ${_file} " OUTPUT_VARIABLE rm_out\n")
+ file (APPEND ${_file} " RETURN_VALUE rm_retval\n")
+ file (APPEND ${_file} " )\n")
+ file (APPEND ${_file} " if (\"\${rm_retval}\" STREQUAL 0)\n")
+ file (APPEND ${_file} " else (\"\${rm_retval}\" STREQUAL 0)\n")
+ file (APPEND ${_file} " message (FATAL_ERROR \"Problem when removing \\\"\${file}\\\"\")\n")
+ file (APPEND ${_file} " endif (\"\${rm_retval}\" STREQUAL 0)\n")
+ file (APPEND ${_file} " else (EXISTS \"\${file}\")\n")
+ file (APPEND ${_file} " message (STATUS \"File \\\"\${file}\\\" does not exist.\")\n")
+ file (APPEND ${_file} " endif (EXISTS \"\${file}\")\n")
+ file (APPEND ${_file} "endforeach (file)\n")
+
+ add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
+
+ endif ()
+endmacro ()
+
+#posix 2008 scandir check
+include (CheckCXXSourceCompiles)
+CHECK_CXX_SOURCE_COMPILES (
+ "# include <dirent.h>
+ int func (const char *d, dirent ***list, void *sort)
+ {
+ int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
+ return n;
+ }
+
+ int main (int, char **)
+ {
+ return 0;
+ }
+ "
+ HAVE_SCANDIR_POSIX)
+
+if (HAVE_SCANDIR_POSIX)
+ add_definitions (-DHAVE_SCANDIR_POSIX)
+endif ()
diff --git a/cmake/CompizDefaults.cmake b/cmake/CompizDefaults.cmake
new file mode 100644
index 0000000..aad551c
--- /dev/null
+++ b/cmake/CompizDefaults.cmake
@@ -0,0 +1,15 @@
+set (COMPIZ_PREFIX ${CMAKE_INSTALL_PREFIX})
+set (COMPIZ_INCLUDEDIR ${includedir})
+set (COMPIZ_LIBDIR ${libdir})
+
+list (APPEND COMPIZ_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/include)
+list (APPEND COMPIZ_INCLUDE_DIRS ${CMAKE_BINARY_DIR})
+
+set (COMPIZ_BCOP_XSLT ${CMAKE_SOURCE_DIR}/xslt/bcop.xslt)
+
+set (COMPIZ_GCONF_SCHEMAS_SUPPORT ${USE_GCONF})
+set (COMPIZ_GCONF_SCHEMAS_XSLT ${CMAKE_SOURCE_DIR}/xslt/compiz_gconf_schemas.xslt)
+
+set (COMPIZ_PLUGIN_INSTALL_TYPE "package")
+
+set (_COMPIZ_INTERNAL 1)
diff --git a/cmake/CompizDefaults.cmake.in b/cmake/CompizDefaults.cmake.in
new file mode 100644
index 0000000..e3f1ea4
--- /dev/null
+++ b/cmake/CompizDefaults.cmake.in
@@ -0,0 +1,5 @@
+
+set (COMPIZ_BCOP_XSLT @CMAKE_INSTALL_PREFIX@/share/compiz/xslt/bcop.xslt)
+
+set (COMPIZ_GCONF_SCHEMAS_SUPPORT @USE_GCONF@)
+set (COMPIZ_GCONF_SCHEMAS_XSLT @CMAKE_INSTALL_PREFIX@/share/compiz/xslt/compiz_gconf_schemas.xslt) \ No newline at end of file
diff --git a/cmake/CompizGconf.cmake b/cmake/CompizGconf.cmake
new file mode 100644
index 0000000..4d82020
--- /dev/null
+++ b/cmake/CompizGconf.cmake
@@ -0,0 +1,52 @@
+option (
+ COMPIZ_DISABLE_SCHEMAS_INSTALL
+ "Disables gconf schema installation with gconftool"
+ OFF
+)
+
+set (
+ COMPIZ_INSTALL_GCONF_SCHEMA_DIR ${COMPIZ_INSTALL_GCONF_SCHEMA_DIR} CACHE PATH
+ "Installation path of the gconf schema file"
+)
+
+function (compiz_install_gconf_schema _src _dst)
+ find_program (GCONFTOOL_EXECUTABLE gconftool-2)
+ mark_as_advanced (FORCE GCONFTOOL_EXECUTABLE)
+
+ if (GCONFTOOL_EXECUTABLE AND NOT COMPIZ_DISABLE_SCHEMAS_INSTALL)
+ install (CODE "
+ if (\"\$ENV{USER}\" STREQUAL \"root\")
+ exec_program (${GCONFTOOL_EXECUTABLE}
+ ARGS \"--get-default-source\"
+ OUTPUT_VARIABLE ENV{GCONF_CONFIG_SOURCE})
+ exec_program (${GCONFTOOL_EXECUTABLE}
+ ARGS \"--makefile-install-rule ${_src} > /dev/null\")
+ else (\"\$ENV{USER}\" STREQUAL \"root\")
+ exec_program (${GCONFTOOL_EXECUTABLE}
+ ARGS \"--install-schema-file=${_src} > /dev/null\")
+ endif (\"\$ENV{USER}\" STREQUAL \"root\")
+ ")
+ endif ()
+ install (
+ FILES "${_src}"
+ DESTINATION "${COMPIZ_DESTDIR}${_dst}"
+ )
+endfunction ()
+
+# generate gconf schema
+function (compiz_gconf_schema _src _dst _inst)
+ find_program (XSLTPROC_EXECUTABLE xsltproc)
+ mark_as_advanced (FORCE XSLTPROC_EXECUTABLE)
+
+ if (XSLTPROC_EXECUTABLE)
+ add_custom_command (
+ OUTPUT ${_dst}
+ COMMAND ${XSLTPROC_EXECUTABLE}
+ -o ${_dst}
+ ${COMPIZ_GCONF_SCHEMAS_XSLT}
+ ${_src}
+ DEPENDS ${_src}
+ )
+ compiz_install_gconf_schema (${_dst} ${_inst})
+ endif ()
+endfunction ()
diff --git a/cmake/CompizPackage.cmake b/cmake/CompizPackage.cmake
new file mode 100644
index 0000000..aae7c54
--- /dev/null
+++ b/cmake/CompizPackage.cmake
@@ -0,0 +1,101 @@
+include (CompizCommon)
+
+function (compiz_package_generation _name)
+ include(InstallRequiredSystemLibraries)
+
+ set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${_name}")
+ set (CPACK_PACKAGE_VENDOR "Compiz")
+ set (CPACK_PACKAGE_VERSION "${VERSION}")
+ set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}")
+
+ set (CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
+ set (CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
+ set (CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
+ set (CPACK_RPM_PACKAGE_RELEASE 1)
+ set (CPACK_RPM_PACKAGE_LICENCE "GPL")
+ set (CPACK_RPM_PACKAGE_GROUP "unknown")
+ set (CPACK_RPM_PACKAGE_VENDOR ${CPACK_PACKAGE_VENDOR})
+ set (CPACK_RPM_PACKAGE_DESCRIPTION "The blingiest window manager in the world")
+ set (CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
+ set (CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~")
+ list (APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git")
+ list (APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_BINARY_DIR}")
+ list (APPEND CPACK_SOURCE_IGNORE_FILES "legacy/")
+ list (APPEND CPACK_SOURCE_IGNORE_FILES "\\\\.intltool-merge-cache")
+ list (APPEND CPACK_SOURCE_IGNORE_FILES "/po/POTFILES$")
+ list (APPEND CPACK_SOURCE_IGNORE_FILES "CMakeCache.txt")
+ list (APPEND CPACK_SOURCE_IGNORE_FILES "CMakeFiles")
+ include(CPack)
+
+ #file (REMOVE "${CMAKE_BINARY_DIR}/CPackConfig.cmake")
+endfunction ()
+
+function (compiz_print_configure_header _name)
+ compiz_format_string ("${_name}" 40 _project)
+ compiz_format_string ("${VERSION}" 40 _version)
+ compiz_color_message ("\n${_escape}[40;37m************************************************************${_escape}[0m")
+ compiz_color_message ("${_escape}[40;37m* ${_escape}[1;31mCompiz ${_escape}[0;40;34mBuildsystem${_escape}[0m${_escape}[40;37m *${_escape}[0m")
+ compiz_color_message ("${_escape}[40;37m* *${_escape}[0m")
+ compiz_color_message ("${_escape}[40;37m* Package : ${_escape}[32m${_project} ${_escape}[37m *${_escape}[0m")
+ compiz_color_message ("${_escape}[40;37m* Version : ${_escape}[32m${_version} ${_escape}[37m *${_escape}[0m")
+ compiz_color_message ("${_escape}[40;37m************************************************************${_escape}[0m")
+endfunction ()
+
+function (compiz_print_configure_footer)
+ compiz_color_message ("${_escape}[40;37m************************************************************${_escape}[0m\n")
+endfunction ()
+
+function (compiz_print_plugin_stats _folder)
+ compiz_color_message ("\n${_escape}[4mPlugin configure check results:${_escape}[0m\n")
+ file (
+ GLOB _plugins_in
+ RELATIVE "${_folder}"
+ "${_folder}/*/CMakeLists.txt"
+ )
+ foreach (_plugin ${_plugins_in})
+ file (READ "${_folder}/${_plugin}" _file)
+ if (_file MATCHES "^.*compiz_plugin ?\\(([^\\) ]*).*$")
+ string (
+ REGEX REPLACE
+ "^.*compiz_plugin ?\\(([^\\) ]*).*$" "\\1"
+ _plugin_name ${_file}
+ )
+ else ()
+ get_filename_component (_plugin_name ${_plugin} PATH)
+ endif ()
+
+ string (TOUPPER ${_plugin_name} _PLUGIN)
+ compiz_format_string (${_plugin_name} 14 _plugin_name)
+
+ if (COMPIZ_DISABLE_PLUGIN_${_PLUGIN})
+ compiz_color_message (" ${_plugin_name}: ${_escape}[1;34mDisabled${_escape}[0m")
+ else ()
+ if (COMPIZ_${_PLUGIN}_BUILD)
+ compiz_color_message (" ${_plugin_name}: ${_escape}[1;32mYes${_escape}[0m")
+ else ()
+ compiz_color_message (" ${_plugin_name}: ${_escape}[1;31mNo${_escape}[0m (Missing dependencies :${COMPIZ_${_PLUGIN}_MISSING_DEPS})")
+ endif ()
+ endif ()
+ endforeach ()
+ message ("")
+endfunction ()
+
+function (compiz_print_result_message _name _var)
+ compiz_format_string ("${_name}" 30 __name)
+ if (${_var})
+ set (_result "${_escape}[1;32mYes${_escape}[0m")
+ else (${_var})
+ set (_result "${_escape}[1;31mNo${_escape}[0m")
+ endif (${_var})
+ compiz_color_message (" ${__name} : ${_result}")
+endfunction (compiz_print_result_message)
+
+function (compiz_get_version_from_file)
+ file (READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" _file)
+ string (
+ REGEX REPLACE
+ "^.*VERSION=([^\n]*).*$" "\\1"
+ _version ${_file}
+ )
+ set (VERSION ${_version} PARENT_SCOPE)
+endfunction ()
diff --git a/cmake/CompizPlugin.cmake b/cmake/CompizPlugin.cmake
new file mode 100644
index 0000000..60551d6
--- /dev/null
+++ b/cmake/CompizPlugin.cmake
@@ -0,0 +1,451 @@
+#######################################################################
+#
+# Generic Compiz Fusion plugin cmake module
+#
+# Copyright : (C) 2008 by Dennis Kasprzyk
+# E-mail : onestone@opencompositing.org
+#
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+#######################################################################
+#
+# This module provides the following macro:
+#
+# compiz_plugin (<plugin name>
+# [PKGDEPS dep1 dep2 ...]
+# [PLUGINDEPS plugin1 plugin2 ...]
+# [LDFLAGSADD flag1 flag2 ...]
+# [CFLAGSADD flag1 flag2 ...]
+# [LIBRARIES lib1 lib2 ...]
+# [LIBDIRS dir1 dir2 ...]
+# [INCDIRS dir1 dir2 ...])
+#
+# PKGDEPS = pkgconfig dependencies
+# PLUGINDEPS = compiz plugin dependencies
+# LDFLAGSADD = flags added to the link command
+# CFLAGSADD = flags added to the compile command
+# LIBRARIES = libraries added to link command
+# LIBDIRS = additional link directories
+# INCDIRS = additional include directories
+#
+# The following variables will be used by this macro:
+#
+# BUILD_GLOBAL=true Environment variable to install a plugin
+# into the compiz directories
+#
+# COMPIZ_PLUGIN_INSTALL_TYPE = (package | compiz | local (default))
+# package = Install into ${CMAKE_INSTALL_PREFIX}
+# compiz = Install into compiz prefix (BUILD_GLOBAL=true)
+# local = Install into home directory
+#
+# COMPIZ_I18N_DIR = Translation file directory
+#
+# COMPIZ_DISABLE_SCHEMAS_INSTALL = Disables gconf schema installation with gconftool
+# COMPIZ_INSTALL_GCONF_SCHEMA_DIR = Installation path of the gconf schema file
+#
+# VERSION = package version that is added to a plugin pkg-version file
+#
+#######################################################################
+
+include (CompizCommon)
+include (CompizBcop)
+
+if (COMPIZ_GCONF_SCHEMAS_SUPPORT)
+ include (CompizGconf)
+endif ()
+
+if (COMPIZ_PACKAGING_ENABLED)
+ set (prefix ${CMAKE_INSTALL_PREFIX} CACHE PATH "prefix")
+ set (exec_prefix ${CMAKE_INSTALL_PREFIX}/bin CACHE PATH "bindir")
+ set (libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} CACHE PATH "libdir")
+ set (includedir ${CMAKE_INSTALL_PREFIX}/include CACHE PATH "includedir")
+ set (datadir ${CMAKE_INSTALL_PREFIX}/share CACHE PATH "datadir")
+else (COMPIZ_PACKAGING_ENABLED)
+ set (prefix ${CMAKE_INSTALL_PREFIX} )
+ set (exec_prefix ${CMAKE_INSTALL_PREFIX}/bin )
+ set (libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
+ set (includedir ${CMAKE_INSTALL_PREFIX}/include )
+ set (datadir ${CMAKE_INSTALL_PREFIX}/share )
+endif (COMPIZ_PACKAGING_ENABLED)
+
+# determinate installation directories
+macro (_prepare_directories)
+ set (CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;MinSizeRe" CACHE INTERNAL "" FORCE)
+ if ("${COMPIZ_PLUGIN_INSTALL_TYPE}" STREQUAL "package")
+ set (PLUGIN_BUILDTYPE global)
+ set (PLUGIN_PREFIX ${CMAKE_INSTALL_PREFIX})
+ set (PLUGIN_LIBDIR ${libdir}/compiz)
+ set (PLUGIN_INCDIR ${includedir})
+ set (PLUGIN_PKGDIR ${libdir}/pkgconfig)
+ set (PLUGIN_XMLDIR ${datadir}/compiz)
+ set (PLUGIN_IMAGEDIR ${datadir}/compiz)
+ set (PLUGIN_DATADIR ${datadir}/compiz)
+ if (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (PLUGIN_SCHEMADIR "${datadir}/gconf/schemas")
+ else (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (PLUGIN_SCHEMADIR "${COMPIZ_INSTALL_GCONF_SCHEMA_DIR}")
+ endif (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+
+ elseif ("${COMPIZ_PLUGIN_INSTALL_TYPE}" STREQUAL "compiz" OR
+ "$ENV{BUILD_GLOBAL}" STREQUAL "true")
+ set (PLUGIN_BUILDTYPE global)
+ set (PLUGIN_PREFIX ${COMPIZ_PREFIX})
+ set (PLUGIN_LIBDIR ${COMPIZ_LIBDIR}/compiz)
+ set (PLUGIN_INCDIR ${COMPIZ_INCLUDEDIR})
+ set (PLUGIN_PKGDIR ${COMPIZ_LIBDIR}/pkgconfig)
+ set (PLUGIN_XMLDIR ${COMPIZ_PREFIX}/share/compiz)
+ set (PLUGIN_IMAGEDIR ${COMPIZ_PREFIX}/share/compiz)
+ set (PLUGIN_DATADIR ${COMPIZ_PREFIX}/share/compiz)
+ if (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (PLUGIN_SCHEMADIR "${COMPIZ_PREFIX}/share/gconf/schemas")
+ else (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (PLUGIN_SCHEMADIR "${COMPIZ_INSTALL_GCONF_SCHEMA_DIR}")
+ endif (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+
+ if (NOT "${CMAKE_BUILD_TYPE}")
+ set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)
+ endif (NOT "${CMAKE_BUILD_TYPE}")
+ else ("${COMPIZ_PLUGIN_INSTALL_TYPE}" STREQUAL "compiz" OR
+ "$ENV{BUILD_GLOBAL}" STREQUAL "true")
+ set (PLUGIN_BUILDTYPE local)
+ set (PLUGIN_PREFIX $ENV{HOME}/.compiz-1)
+ set (PLUGIN_LIBDIR $ENV{HOME}/.compiz-1/plugins)
+ set (PLUGIN_XMLDIR $ENV{HOME}/.compiz-1/metadata)
+ set (PLUGIN_IMAGEDIR $ENV{HOME}/.compiz-1)
+ set (PLUGIN_DATADIR $ENV{HOME}/.compiz-1)
+
+ if (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (PLUGIN_SCHEMADIR "$ENV{HOME}/.gconf/schemas")
+ else (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (PLUGIN_SCHEMADIR "${COMPIZ_INSTALL_GCONF_SCHEMA_DIR}")
+ endif (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+
+ if (NOT "${CMAKE_BUILD_TYPE}")
+ set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (Debug/Release/RelWithDebInfo/MinSizeRe)" FORCE)
+ endif (NOT "${CMAKE_BUILD_TYPE}")
+ endif ("${COMPIZ_PLUGIN_INSTALL_TYPE}" STREQUAL "package")
+endmacro (_prepare_directories)
+
+# parse plugin macro parameter
+macro (_get_plugin_parameters _prefix)
+ set (_current_var _foo)
+ set (_supported_var PKGDEPS PLUGINDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS)
+ foreach (_val ${_supported_var})
+ set (${_prefix}_${_val})
+ endforeach (_val)
+ foreach (_val ${ARGN})
+ set (_found FALSE)
+ foreach (_find ${_supported_var})
+ if ("${_find}" STREQUAL "${_val}")
+ set (_found TRUE)
+ endif ("${_find}" STREQUAL "${_val}")
+ endforeach (_find)
+
+ if (_found)
+ set (_current_var ${_prefix}_${_val})
+ else (_found)
+ list (APPEND ${_current_var} ${_val})
+ endif (_found)
+ endforeach (_val)
+endmacro (_get_plugin_parameters)
+
+# check pkgconfig dependencies
+macro (_check_plugin_pkg_deps _prefix)
+ set (${_prefix}_HAS_PKG_DEPS TRUE)
+ foreach (_val ${ARGN})
+ string (REGEX REPLACE "[<>=\\.]" "_" _name ${_val})
+ string (TOUPPER ${_name} _name)
+
+ compiz_pkg_check_modules (_${_name} ${_val})
+
+ if (_${_name}_FOUND)
+ list (APPEND ${_prefix}_PKG_LIBDIRS "${_${_name}_LIBRARY_DIRS}")
+ list (APPEND ${_prefix}_PKG_LIBRARIES "${_${_name}_LIBRARIES}")
+ list (APPEND ${_prefix}_PKG_INCDIRS "${_${_name}_INCLUDE_DIRS}")
+ else ()
+ set (${_prefix}_HAS_PKG_DEPS FALSE)
+ compiz_set (COMPIZ_${_prefix}_MISSING_DEPS "${COMPIZ_${_prefix}_MISSING_DEPS} ${_val}")
+ set(__pkg_config_checked__${_name} 0 CACHE INTERNAL "" FORCE)
+ endif ()
+ endforeach ()
+endmacro ()
+
+# check plugin dependencies
+macro (_check_plugin_plugin_deps _prefix)
+ set (${_prefix}_HAS_PLUGIN_DEPS TRUE)
+ foreach (_val ${ARGN})
+ string (TOUPPER ${_val} _name)
+
+ find_file (
+ _plugin_dep_${_val}
+ compiz-${_val}.pc.in
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../${_val}
+ NO_DEFAULT_PATH
+ )
+
+ if (_plugin_dep_${_val})
+ file (RELATIVE_PATH _relative ${CMAKE_CURRENT_SOURCE_DIR} ${_plugin_dep_${_val}})
+ get_filename_component (_plugin_inc_dir ${_relative} PATH)
+ list (APPEND ${_prefix}_LOCAL_INCDIRS "${_plugin_inc_dir}/include")
+ list (APPEND ${_prefix}_LOCAL_LIBRARIES ${_val})
+ else ()
+ # fallback to pkgconfig
+ compiz_pkg_check_modules (_${_name} compiz-${_val})
+ if (_${_name}_FOUND)
+ list (APPEND ${_prefix}_PKG_LIBDIRS "${_${_name}_LIBRARY_DIRS}")
+ list (APPEND ${_prefix}_PKG_LIBRARIES "${_${_name}_LIBRARIES}")
+ list (APPEND ${_prefix}_PKG_INCDIRS "${_${_name}_INCLUDE_DIRS}")
+ else ()
+ set (${_prefix}_HAS_PLUGIN_DEPS FALSE)
+ compiz_set (COMPIZ_${_prefix}_MISSING_DEPS "${COMPIZ_${_prefix}_MISSING_DEPS} compiz-${_val}")
+ endif ()
+ endif ()
+
+ compiz_set (_plugin_dep_${_val} "${_plugin_dep_${_val}}")
+
+ endforeach ()
+endmacro ()
+
+
+
+
+# main function
+function (_build_compiz_plugin plugin)
+ string (TOUPPER ${plugin} _PLUGIN)
+
+ if (COMPIZ_PLUGIN_INSTALL_TYPE)
+ set (
+ COMPIZ_PLUGIN_INSTALL_TYPE ${COMPIZ_PLUGIN_INSTALL_TYPE} CACHE STRING
+ "Where a plugin should be installed \(package | compiz | local\)"
+ )
+ else (COMPIZ_PLUGIN_INSTALL_TYPE)
+ set (
+ COMPIZ_PLUGIN_INSTALL_TYPE "local" CACHE STRING
+ "Where a plugin should be installed \(package | compiz | local\)"
+ )
+ endif (COMPIZ_PLUGIN_INSTALL_TYPE)
+
+ _get_plugin_parameters (${_PLUGIN} ${ARGN})
+ _prepare_directories ()
+
+ find_file (
+ _${plugin}_xml_in ${plugin}.xml.in
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}
+ NO_DEFAULT_PATH
+ )
+ if (_${plugin}_xml_in)
+ set (_${plugin}_xml ${_${plugin}_xml_in})
+ else ()
+ find_file (
+ _${plugin}_xml ${plugin}.xml
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR} }
+ NO_DEFAULT_PATH
+ )
+ endif ()
+
+ set (${_PLUGIN}_HAS_PKG_DEPS)
+ set (${_PLUGIN}_HAS_PLUGIN_DEPS)
+
+ # check dependencies
+ compiz_unset (COMPIZ_${_PLUGIN}_MISSING_DEPS)
+ _check_plugin_plugin_deps (${_PLUGIN} ${${_PLUGIN}_PLUGINDEPS})
+ _check_plugin_pkg_deps (${_PLUGIN} ${${_PLUGIN}_PKGDEPS})
+
+ if (${_PLUGIN}_HAS_PKG_DEPS AND ${_PLUGIN}_HAS_PLUGIN_DEPS)
+
+ compiz_set (COMPIZ_${_PLUGIN}_BUILD TRUE PARENT_SCOPE)
+
+ if (NOT EXISTS ${CMAKE_BINARY_DIR}/generated)
+ file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/generated)
+ endif (NOT EXISTS ${CMAKE_BINARY_DIR}/generated)
+
+ if (_${plugin}_xml_in)
+ # translate xml
+ compiz_translate_xml ( ${_${plugin}_xml_in} "${CMAKE_BINARY_DIR}/generated/${plugin}.xml")
+ set (_translation_sources "${CMAKE_BINARY_DIR}/generated/${plugin}.xml")
+ set (_translated_xml ${CMAKE_BINARY_DIR}/generated/${plugin}.xml)
+ else ()
+ if (_${plugin}_xml)
+ set (_translated_xml ${_${plugin}_xml})
+ endif ()
+ endif ()
+
+ if (_${plugin}_xml)
+ # do we need bcop for our plugin
+ compiz_plugin_needs_bcop (${_${plugin}_xml} _needs_bcop)
+ if (_needs_bcop)
+ # initialize everything we need for bcop
+ compiz_add_bcop_targets (${plugin} ${_${plugin}_xml} _bcop_sources)
+ endif ()
+ endif ()
+
+ if (_translated_xml)
+ if (COMPIZ_GCONF_SCHEMAS_SUPPORT)
+ # generate gconf schema
+ compiz_gconf_schema (${_translated_xml} "${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.schemas" ${PLUGIN_SCHEMADIR})
+ set (_schema_sources "${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.schemas")
+ endif ()
+
+ # install xml
+ install (
+ FILES ${_translated_xml}
+ DESTINATION ${COMPIZ_DESTDIR}${PLUGIN_XMLDIR}
+ )
+ endif (_translated_xml)
+
+ find_file (
+ _${plugin}_pkg compiz-${plugin}.pc.in
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}
+ NO_DEFAULT_PATH
+ )
+
+ # generate pkgconfig file and install it and the plugin header file
+ if (_${plugin}_pkg AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin})
+ if ("${PLUGIN_BUILDTYPE}" STREQUAL "local")
+ message (STATUS "[WARNING] The plugin ${plugin} might be needed by other plugins. Install it systemwide.")
+ else ()
+ set (prefix ${PLUGIN_PREFIX})
+ set (libdir ${PLUGIN_LIBDIR})
+ set (includedir ${PLUGIN_INCDIR})
+ if (NOT VERSION)
+ set (VERSION 0.0.1-git)
+ endif (NOT VERSION)
+
+ compiz_configure_file (
+ ${_${plugin}_pkg}
+ ${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc
+ COMPIZ_REQUIRES
+ COMPIZ_CFLAGS
+ )
+
+ install (
+ FILES ${CMAKE_BINARY_DIR}/generated/compiz-${plugin}.pc
+ DESTINATION ${COMPIZ_DESTDIR}${PLUGIN_PKGDIR}
+ )
+ install (
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}
+ DESTINATION ${COMPIZ_DESTDIR}${PLUGIN_INCDIR}/compiz
+ )
+ endif ()
+ endif ()
+
+ # install plugin data files
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/data)
+ install (
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data
+ DESTINATION ${COMPIZ_DESTDIR}${PLUGIN_DATADIR}
+ )
+ endif ()
+
+ # install plugin image files
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/images)
+ install (
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images
+ DESTINATION ${COMPIZ_DESTDIR}${PLUGIN_IMAGEDIR}
+ )
+ endif ()
+
+ # find files for build
+ file (GLOB _h_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")
+ file (GLOB _h_ins_files "${CMAKE_CURRENT_SOURCE_DIR}/include/${plugin}/*.h")
+ file (GLOB _cpp_files "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
+
+# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs")
+
+# set (_cflags "-Wall -Wpointer-arith -fno-strict-aliasing")
+
+
+ add_definitions (-DPREFIX='\"${PLUGIN_PREFIX}\"'
+ -DIMAGEDIR='\"${PLUGIN_IMAGEDIR}\"'
+ -DDATADIR='\"${PLUGIN_DATADIR}\"')
+
+ include_directories (
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_BINARY_DIR}/generated
+ ${${_PLUGIN}_LOCAL_INCDIRS}
+ ${${_PLUGIN}_PKG_INCDIRS}
+ ${${_PLUGIN}_INCDIRS}
+ ${COMPIZ_INCLUDE_DIRS}
+ )
+
+ link_directories (
+ ${COMPIZ_LINK_DIRS}
+ ${${_PLUGIN}_PKG_LIBDIRS}
+ ${${_PLUGIN}_LIBDIRS}
+ ${PLUGIN_LIBDIR}
+ ${COMPIZ_LIBDIR}/compiz
+ )
+
+ add_library (
+ ${plugin} SHARED ${_cpp_files}
+ ${_h_files}
+ ${_h_ins_files}
+ ${_bcop_sources}
+ ${_translation_sources}
+ ${_schema_sources}
+ )
+
+ if (COMPIZ_BUILD_WITH_RPATH)
+ set_target_properties (
+ ${plugin} PROPERTIES
+ INSTALL_RPATH_USE_LINK_PATH 1
+ BUILD_WITH_INSTALL_RPATH 1
+ SKIP_BUILD_RPATH 0
+ COMPILE_FLAGS "${${_PLUGIN}_CFLAGSADD}"
+ LINK_FLAGS "${${_PLUGIN}_LDFLAGSADD}"
+ )
+ else (COMPIZ_BUILD_WITH_RPATH)
+ set_target_properties (
+ ${plugin} PROPERTIES
+ INSTALL_RPATH_USE_LINK_PATH 0
+ SKIP_BUILD_RPATH 1
+ INSTALL_RPATH "${COMPIZ_LIBDIR}/compiz"
+ COMPILE_FLAGS "${${_PLUGIN}_CFLAGSADD}"
+ LINK_FLAGS "${${_PLUGIN}_LDFLAGSADD}"
+ )
+ endif (COMPIZ_BUILD_WITH_RPATH)
+
+ target_link_libraries (
+ ${plugin} ${COMPIZ_LIBRARIES}
+ ${${_PLUGIN}_LOCAL_LIBRARIES}
+ ${${_PLUGIN}_PKG_LIBRARIES}
+ ${${_PLUGIN}_LIBRARIES}
+ )
+
+ install (
+ TARGETS ${plugin}
+ LIBRARY DESTINATION ${COMPIZ_DESTDIR}${PLUGIN_LIBDIR}
+ )
+
+ compiz_add_uninstall ()
+
+ else ()
+ message (STATUS "[WARNING] One or more dependencies for compiz plugin ${plugin} not found. Skipping plugin.")
+ message (STATUS "Missing dependencies :${COMPIZ_${_PLUGIN}_MISSING_DEPS}")
+ compiz_set (COMPIZ_${_PLUGIN}_BUILD FALSE)
+ endif ()
+endfunction ()
+
+macro (compiz_plugin plugin)
+ string (TOUPPER ${plugin} _PLUGIN)
+
+ option (
+ COMPIZ_DISABLE_PLUGIN_${_PLUGIN}
+ "Disable building of plugin \"${plugin}\""
+ OFF
+ )
+
+ if (NOT COMPIZ_DISABLE_PLUGIN_${_PLUGIN})
+ _build_compiz_plugin (${plugin} ${ARGN})
+ endif (NOT COMPIZ_DISABLE_PLUGIN_${_PLUGIN})
+endmacro ()
diff --git a/cmake/FindCompiz.cmake b/cmake/FindCompiz.cmake
new file mode 100644
index 0000000..3aafc5d
--- /dev/null
+++ b/cmake/FindCompiz.cmake
@@ -0,0 +1,89 @@
+
+
+
+################################################################################
+#
+# FindCompiz
+#
+# This module finds Compiz (www.compiz.org). It uses the FindPkgConfig to
+# locate Compiz and adds the Compiz CMake module path to the CMake module path.
+# It also loads the CompizDefaults that sets all variables to compile Compiz
+# modules.
+#
+# This module sets the following variables:
+# COMPIZ_FOUND ... set to true if compiz and its CompizDefaults macro
+# is found
+#
+# Variables set by the FindPkgConfig macro for compiz
+# COMPIZ_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
+# COMPIZ_LDFLAGS ... all required linker flags
+# COMPIZ_LDFLAGS_OTHER ... all other linker flags
+# COMPIZ_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
+# COMPIZ_CFLAGS ... all required cflags
+# COMPIZ_CFLAGS_OTHER ... the other compiler flags
+# COMPIZ_VERSION ... version of the module
+# COMPIZ_PREFIX ... prefix-directory of the module
+# COMPIZ_INCLUDEDIR ... include-dir of the module
+# COMPIZ_LIBDIR ... lib-dir of the module
+#
+# If the _COMPIZ_INTERNAL variable is set to true, then this module will do
+# nothing. This is required for the Compiz core package build system.
+#
+# Author: Dennis Kasprzyk <onestone@compiz.org>
+#
+################################################################################
+
+if (NOT _COMPIZ_INTERNAL)
+
+ if (Compiz_FIND_REQUIRED)
+ set (_req REQUIRED)
+ endif ()
+
+ # look for pkg-config
+ find_package (PkgConfig ${_req})
+
+ if (PKG_CONFIG_FOUND)
+
+ # do we need to look for a specified version?
+ set (_comp_ver)
+ if (Compiz_FIND_VERSION)
+ if (Compiz_FIND_VERSION_EXACT)
+ set (_comp_ver "=${Compiz_FIND_VERSION}")
+ else ()
+ set (_comp_ver ">=${Compiz_FIND_VERSION}")
+ endif ()
+ endif ()
+
+ # add install prefix to pkgconfig search path if needed
+ string (REGEX REPLACE "([\\+\\(\\)\\^\\\$\\.\\-\\*\\?\\|])" "\\\\\\1" PKGCONFIG_REGEX ${CMAKE_INSTALL_PREFIX})
+ set (PKGCONFIG_REGEX ".*${PKGCONFIG_REGEX}/lib/pkgconfig:${PKGCONFIG_REGEX}/share/pkgconfig.*")
+
+ if (NOT "$ENV{PKG_CONFIG_PATH}" MATCHES "${PKGCONFIG_REGEX}")
+ if ("" STREQUAL "$ENV{PKG_CONFIG_PATH}")
+ set (ENV{PKG_CONFIG_PATH} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig:${CMAKE_INSTALL_PREFIX}/share/pkgconfig")
+ else ()
+ set (ENV{PKG_CONFIG_PATH}
+ "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig:${CMAKE_INSTALL_PREFIX}/share/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+ endif ()
+ endif ()
+
+ # look for compiz
+ pkg_check_modules (COMPIZ ${_req} "compiz${_comp_ver}")
+
+ # is the CompizDefaults module installed?
+ find_path(_compiz_def_macro CompizDefaults.cmake ${COMPIZ_PREFIX}/share/compiz/cmake)
+
+ if (COMPIZ_FOUND AND _compiz_def_macro)
+ # everything found. Set module path and include defaults module
+ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${COMPIZ_PREFIX}/share/compiz/cmake)
+ include (CompizDefaults)
+ else ()
+ set (COMPIZ_FOUND 0)
+ endif ()
+
+ if (Compiz_FIND_REQUIRED AND NOT COMPIZ_FOUND)
+ message (FATAL_ERROR "Unable to find Compiz ${_comp_ver}")
+ endif ()
+ endif ()
+endif ()
+
diff --git a/cmake/all_plugins_in_folder_example-CMakeLists.txt b/cmake/all_plugins_in_folder_example-CMakeLists.txt
new file mode 100644
index 0000000..6ba885a
--- /dev/null
+++ b/cmake/all_plugins_in_folder_example-CMakeLists.txt
@@ -0,0 +1,10 @@
+find_package (Compiz REQUIRED)
+
+include (CompizCommon)
+include (CompizPackage)
+
+compiz_add_plugins_in_folder ("${CMAKE_SOURCE_DIR}")
+
+compiz_print_configure_header ("Compiz")
+compiz_print_plugin_stats ("${CMAKE_SOURCE_DIR}")
+compiz_print_configure_footer () \ No newline at end of file
diff --git a/cmake/base.cmake b/cmake/base.cmake
new file mode 100644
index 0000000..05493d9
--- /dev/null
+++ b/cmake/base.cmake
@@ -0,0 +1,63 @@
+set (USE_GCONF 1 CACHE BOOL "Install GConf schemas")
+
+if (USE_GCONF)
+ pkg_check_modules (GCONF gconf-2.0)
+
+ find_program (GCONFTOOL_EXECUTABLE gconftool-2)
+ mark_as_advanced (FORCE GCONFTOOL_EXECUTABLE)
+
+ if (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (SCHEMADIR "${CMAKE_INSTALL_PREFIX}/share/gconf/schemas")
+ else (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+ set (SCHEMADIR "${COMPIZ_INSTALL_GCONF_SCHEMA_DIR}")
+ endif (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR)
+
+ if (NOT GCONF_FOUND OR NOT GCONFTOOL_EXECUTABLE)
+ set (USE_GCONF 0)
+ else ()
+ include (CompizGconf)
+ endif ()
+endif ()
+
+function (_print_configure_results)
+ compiz_print_configure_header ("Compiz")
+ compiz_color_message ("\n${_escape}[4mOptional features:${_escape}[0m\n")
+
+ compiz_print_result_message ("gtk window decorator" USE_GTK)
+ compiz_print_result_message ("metacity theme support" USE_METACITY)
+ compiz_print_result_message ("gconf schemas" USE_GCONF)
+ compiz_print_result_message ("gnome" USE_GNOME)
+ compiz_print_result_message ("kde4 window decorator" USE_KDE4)
+
+ compiz_print_configure_footer ()
+ compiz_print_plugin_stats ("${CMAKE_SOURCE_DIR}/plugins")
+ compiz_print_configure_footer ()
+endfunction ()
+
+function (_check_compiz_cmake_macro)
+ find_file (_find_compiz FindCompiz.cmake PATHS ${CMAKE_ROOT}/Modules ${ARGN})
+ if (NOT _find_compiz)
+ compiz_color_message ("${_escape}[1;31mWARNING:${_escape}[0m")
+ message ("\"FindCompiz.cmake\" file not found in cmake module directories.")
+ message ("It should be installed to allow building of external compiz packages.")
+ message ("Call \"sudo make findcompiz_install\" to install it.\n")
+ compiz_print_configure_footer ()
+ endif ()
+ add_custom_target (
+ findcompiz_install
+ ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/cmake/FindCompiz.cmake ${COMPIZ_DESTDIR}${CMAKE_ROOT}/Modules
+ )
+endfunction ()
+
+# add install prefix to pkgconfig search path if needed
+string (REGEX REPLACE "([\\+\\(\\)\\^\\\$\\.\\-\\*\\?\\|])" "\\\\\\1" PKGCONFIG_REGEX ${CMAKE_INSTALL_PREFIX})
+set (PKGCONFIG_REGEX ".*${PKGCONFIG_REGEX}/lib/pkgconfig:${PKGCONFIG_REGEX}/share/pkgconfig.*")
+
+if (NOT "$ENV{PKG_CONFIG_PATH}" MATCHES "${PKGCONFIG_REGEX}")
+ if ("" STREQUAL "$ENV{PKG_CONFIG_PATH}")
+ set (ENV{PKG_CONFIG_PATH} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig:${CMAKE_INSTALL_PREFIX}/share/pkgconfig")
+ else ()
+ set (ENV{PKG_CONFIG_PATH}
+ "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig:${CMAKE_INSTALL_PREFIX}/share/pkgconfig:$ENV{PKG_CONFIG_PATH}")
+ endif ()
+endif ()