• Immutable Page
  • Info
  • Attachments

Working with our Build System

Quick Guide to setting up a build system for your plugin

  1. Decide on a short name for your plugin. (ie: ezoom, move, resize).
  2. Create a directory, preferably using your short name.
  3. Create a CMakeLists.txt file. This represents the CMake Buildsystem for your plugin
  4. Create a directory called "src" and add your .cpp and .h files in there. All files inside are automatically compiled
  5. Add a shortname.xml.in

Currently, the CMake buildsystem only allows for out-of-source building. The most standard way to do thisis to create a directory called "build".

And that's it for the build system. You can now run "cmake .." to configure, "make" to build and "make install" to install to ~/.compiz.

Please note that we strongly advice developers to use GIT from day one. Getting your git repository hosted on compiz-fusion.org is easy.

Creating your CMakeLists.txt file

Your CMakeLists.txt file should have the following minimal information in it:

find_package (Compiz REQUIRED) # Finds the "Compiz" package and CMake modules required for compiling your plugin

include (CompizPlugin) # Adds the plugin-compilation functions

compiz_plugin (shortname) # CMake function to handle automatic configuration and compilation of your plugin, other options are available

Plugin Dependencies

If you are planning to do more than a few simple window management tasks, the chances are that your plugin will depend on other plugins. This is especially the case if you plan to use any opengl related functions.

The PLUGINDEPS variable will automatically add the compile-time and link-time requirements of your plugin to other plugins. You do not need to worry about setting up any include directories or link directories

For example, if you plan to use any functions out of the opengl and composite plugins, you would want the following PLUGINDEPS

find_package (Compiz REQUIRED) # Finds the "Compiz" package and CMake modules required for compiling your plugin

include (CompizPlugin) # Adds the plugin-compilation functions

compiz_plugin (shortname PLUGINDEPS composite opengl) # CMake function to handle automatic configuration and compilation of your plugin, other options are available

Note that once you do this, you will need to add the required plugins to your list of dependencies in your plugin's source code and the metadata file.

External Library Dependencies

If you need to use an external library within your plugin, this can also be done through the LIBRARIES INCDIRS and LIBDIRS

INDIRS specified the non-absolute path of any include directories LIBDIRS is used to specified a non absolute path of any link-time directories. Note that you shouldn't need to use this except in very rare circumstances. The Compiz buildsystem will automatically import library paths from LD_LIBRARY_PATH. LIBRARIES can be used to specify library names.

For example, some plugins depend on libGLU, so you would want to add their libraries like this:

find_package (Compiz REQUIRED)
include (CompizPlugin)
include (FindOpenGL)

if (OPENGL_GLU_FOUND)
    compiz_plugin (shortname PLUGINDEPS composite opengl LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
endif (OPENGL_GLU_FOUND)

Package Dependencies

In most cases, you will want to add dependencies on pkgconfig files, which will automatically set the required include, link and library directories. You can use the PKGDEPS flag to do this.

For example, if you wanted to add a package dependency to cairo, then you could do something like:

find_package (Compiz REQUIRED)

include (CompizPlugin)

compiz_plugin (wall PLUGINDEPS composite opengl PKGDEPS cairo)

Hints

If you need more from the build system, for instance dependencies, look at the Makefile. It has examples of commonly needed variables.

Never use the combined repositories to develop code (plugins-main, for instance). These are automatically merged from the individual repositories, and the build system set up to build those are outside the scope of this Wiki page. As a plugin-developer, you will not need to know how it works.

CMake is a very extensible and scriptable buildsystem. There is plenty that you can do to control the build process of your plugin or entire application based around compiz very easy. For more information, it is suggested that you check out the http://www.cmake.org/cmake/help/documentation.html

Development/zero-nine/BuildSystem (last edited 2010-07-25 07:57:06 by 124-169-107-122)