/ Packaging OpenSceneGraph

OpenSceneGraph

Packaging OpenSceneGraph

About CPack

Quote from the cmake website

CPack is a powerful, easy to use, cross-platform software packaging tool distributed with CMake since version 2.4.2. It uses the generators concept from CMake, to abstract package generation on specific platforms, and it can be used with or without CMake.

See also CMake and http://www.cmake.org/Wiki/CMake

CPack support in the OpenSceneGraph source tree

Using either a simple configuration file or the CMake module, a complex project can be packaged into an installer. The OpenSceneGraph build system can generate packaging targets for you if you have cmake version 2.6.0 or higher. Versions of cmake from 2.6.1 works better in that it can generate packaging targets for the non-standard plugins (e.g. vnc, dae (COLLADA), vrml...). To enable generation of package targets run cmake with -DBUILD_PACKAGES=ON or check to box next to BUILD_PACKAGES in cmake-gui.

Targets are named package_<Package Name> (e.g. package_libopenscenegraph) on all platforms except Windows with MSVS, where projects are named "Package <Package Name>" (e.g. Package libopenscenegraph)

Targets for the following packages will (at least) be generated:

Package Name Contents
libopenthreads The OpenThreads library. On windows building shared binaries it contains the dll
libopenthreads-dev OpenThreads headers. If building static binaries this package includes the library. On windows and building shared binaries this package contains the link library
libopenscenegraph The OpenSceneGraph libraries. On windows building shared binaries it contains the core dll's
libopenscenegraph-dev OpenSceneGraph headers. Static libraries. On windows the .lib files for linking with the dlls

Targets for the following packages will be generated depending on certain CMake configurations variables

Package Name Pre-requisite Contents
openscenegraph BUILD_APPLICATIONS=ON The OSG applications, e.g. osgviewer, osgversion
openscenegraph-examples BUILD_EXAMPLES=ON The OSG examples, e.g. osgvolume, osganimate, osg2cpp
openthreads-doc BUILD_DOCUMENTATION=ON The OpenThreads reference documentation
openscenegraph-doc BUILD_DOCUMENTATION=ON The OpenSceneGraph reference documentation

If you are building non-standard plugins, targets for the following packages may be generated. Generating these targets will happen only with cmake-2.6.1 or higher

Package Name Contents Dependencies
libopenscenegraph-iv The inventor plugin Coin
libopenscenegraph-dae The COLLADA plugin COLLADA version-??
libopenscenegraph-dicom The dicom plugin ITK or DCMT
libopenscenegraph-gdal The GDAL plugin GDAL
libopenscenegraph-gecko The Gecko plugin libxul-1.8.x
libopenscenegraph-pdf The pdf plugin Cairo, Poppler
libopenscenegraph-svg The svg plugin Cairo/SVGR
libopenscenegraph-vnc The VNC plugin libVNCServer
libopenscenegraph-vrml The VRML plugin VRML-14.3

Platform specifics

  • On Windows CPack looks for 7-zip or Winzip in the ProgramFiles folder. I use only 7-zip and it works great for generating tgz's or zips if you like.
  • On windows the cmake scripts tries to determine what compiler you have. Especially it tries to distinguish between vc80 and vc80sp1 since vc80 (msvs 2005) is known to generate "false" error reports on osg-users

Package names

Package names are created on the form:

<package>-<osg version>-<platform>-<arch>[-<compiler>]-<build_type>[-static].tar.gz

where

package
is the component, e.g. libopenscenegraph, openscenegraph
osg version
major, minor and patch verison of your osg source
platform
win32, win64, Linux etc.
arch
i386, x86, ia64 etc.
compiler
If OSG_CPACK_COMPILER is set it will get put here. A default is generated for msvc but anyone can set OSG_CPACK_COMPILER
build_type
Corresponds to CMAKE_BUILD_TYPE. Debug or Release on unices. On windows might be RelWithDebInfo or MinSizeRel too.
static
If you are building static libraries the package name ends with static

Deb, rpm, Stgz and zip archives

It is always possible to generate archives in other formats using generated ${OSG_BINARY_DIR}/CPackConfig-xxxxx.cmake. You just need to invoke cpack yourself, e.g.

cpack -G ZIP --config <OSG_BUILD_DIR>/CPackConfig-libopenscenegraph.cmake

...to archive the runtine libraries in a zip file

cpack -G RPM --config <OSG_BUILD_DIR>/CPackConfig-openscenegraph-doc.cmake

...to archive the osg reference docs in an rpm

cpack -G STGZ --config <OSG_BUILD_DIR>/CPackConfig-libopenthreads.cmake

...to archive the openthreads runtime libraries as a selfextracting .sh script (not very interesting perhaps but it's possible ;-)