Version 16 (modified by helsing72@…, 6 years ago)

Added a short intro to CPack. Added links to 7zip CMake/CPack references

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 NameContents
libopenthreadsThe OpenThreads library. On windows building shared binaries it contains the dll
libopenthreads-devOpenThreads headers. If building static binaries this package includes the library. On windows and building shared binaries this package contains the link library
libopenscenegraphThe OpenSceneGraph libraries. On windows building shared binaries it contains the core dll's
libopenscenegraph-devOpenSceneGraph 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 NamePre-requisiteContents
openscenegraphBUILD_APPLICATIONS=ONThe OSG applications, e.g. osgviewer, osgversion
openscenegraph-examplesBUILD_EXAMPLES=ONThe OSG examples, e.g. osgvolume, osganimate, osg2cpp
openthreads-docBUILD_DOCUMENTATION=ONThe OpenThreads reference documentation
openscenegraph-docBUILD_DOCUMENTATION=ONThe 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 NameContentsDependencies
libopenscenegraph-ivThe inventor pluginCoin
libopenscenegraph-daeThe COLLADA pluginCOLLADA version-??
libopenscenegraph-dicomThe dicom pluginITK or DCMT
libopenscenegraph-gdalThe GDAL pluginGDAL
libopenscenegraph-geckoThe Gecko pluginlibxul-1.8.x
libopenscenegraph-pdfThe pdf pluginCairo, Poppler
libopenscenegraph-svgThe svg pluginCairo/SVGR
libopenscenegraph-vncThe VNC pluginlibVNCServer
libopenscenegraph-vrmlThe VRML pluginVRML-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 ;-)

TODO

  • Add dependency package_openscenegraph-doc to doc_openscenegraph.
  • Add support for generationg debian and rpm archives