|Version 1 (modified by martin, 10 years ago)|
Compiling OpenSceneGraph with Cygwin
- Developer Blog
- Mailing Lists
- Getting Started
- Platform Specifics
- User Guides
- Programming Guides
- Reference Guides
- Tips And Tricks
- Knowledge Base
- Trac Usage Examples
- TracGuide Documentation
- Software Patents
- Software Patents Europe
Follows are details on usage of OpenSceneGraph such as how to get things compiling using Cygwin.
The following assumes that the OpenSceneGraph and its dependencies (OpenThreads, Producer, and optionally gdal) have been downloaded, either from CVS or tarballs, and installed under a common parent directory. I will call this "/development".
Load the proper version of the GCC Compiler
The current default gcc compiler version distributed with Cygwin is 3.4.1. Unfortunately, this version has problems dealing with the complexity of the OpenSceneGraph and Producer template usage. The libraries will compile, but they will not run. To build OSG you need to manually direct the cygwin installer to load version 3.3.3 of the gcc compiler family.
Set up the Cygwin environment
You must create some initial environment variables so that the OpenSceneGraph build process knows where OpenThreads and Producer are installed. The best place to locate these variables is in your shell resources file. Assuming you are using the default bash shell, your bash resources file will be
Using your favorite text editor, add these variables to the file:
export OPENTHREADS_INC_DIR=/usr/local/OpenThreads/include export OPENTHREADS_LIB_DIR=/usr/local/OpenThreads/bin export PRODUCER_INC_DIR=/usr/local/Producer/include export PRODUCER_LIB_DIR=/usr/local/Producer/bin
OSG also uses environment variables to control which parts of the distribution is compiled. To compile the example programs, add the following line to the .bashrc file
Introspection does not seem to work within Cygwin, so also add this line to the .bashrc:
If you have installed GDAL (required for the osgTerrain component) also add:
Next you must add these paths and the path to the OpenSceneGraph installed bin directory to the systems PATH environment variable:
export PATH="$OPENTHREADS_LIB_DIR:$PATH" export PATH="$PRODUCER_LIB_DIR:$PATH" export PATH="/usr/local/OpenSceneGraph/bin:$PATH"
The $PATH variable on the end makes sure that any previously assigned paths are also included.
That's all that needs to be done for the .bashrc file, though you could also add the variable that specifies the directory of the OpenSceneGraph data, or any other variables that are particular to your setup.
Go to the OpenThreads directory
$ cd /development/OpenThreads
$ make $ make install
A bug in the make system requires that we manually create the target directory for the !Producer library. Go to the library directory:
and create a new directory
$ mkdir CYGWIN32
Having done that you can build the Producer library.
$ cd /development/Producer $ make $ make install
First, we must work around the same bug as in !Producer:
$ cd /development/OpenSceneGraph/lib $ mkdir CYGWIN32
Go to the OpenSceneGraph home directory and make, then install, OpenSceneGraph.
$ cd /development/OpenSceneGraph $ make $ make install