$G in practice
Development Environment
The graphics group has developed a system over many years that allows easy development of a large, shared base of software. We give the whole thing the nickname $G ("dollar gee"), named after the environment variable that represents the root of the source tree.
There source code our group has created is modified and backed up through a source control system called CVS (Concurrent Versioning System). You must have CVS set up properly in order to develop with our shared codebase.
Source control works by allowing an individual user to make structured copies of the master versions of files (this process is called "checking out" the files). The user then modifies his or her personal copies of the files, and then "checks in" the changes once they're certain that the code compiles and runs properly. The location where a user modifies a personal copy of shared code is called a "sandbox", because it is in some sense walled off from the master copy: destructive changes to the code in the sandbox do not affect the master copy, provided the user doesn't check them in.
Environment variables are used to configure the development environment. Visit this page for general instructions for Setting Environment Variables and using them. The instructions in the remainder of this section require that you know how to set up environment variables. For Windows the instructions use the native Windows (cmd.exe) command shell. Unix command examples should work on most shells.
Even if you intend to work on Windows you should set up your sandbox at Brown using Linux. The instructions will include Windows specific instructions when applicable. Explicit procedures for setting up a remote Windows system (like your laptop) are not yet in place. If you are familiar with setting up Windows development environments you should be able to adapt these procedures.
Access to CVS
The CVS repository is accessed by setting the 'CVSROOT variable. Once set you will be able to checkout code and make updates to the repository.
On Unix set CVSROOT to: /map/gfx0/cvsroot/
On Windows set CVSROOT to: Y:\map\gfx0\cvsroot\
CAUTION: The free versions of CVS we've tried do not work reliably on Windows. Unless you are carefully check your work you should perform CVS operations on Unix. It is generally safe to check software out from CVS on Windows.
Creating a Development Sandbox
Your sandbox is the area where you work. It can be any directory, but the area /map/gfx0/users/<Login Id> is set aside for students in the graphics group. Create a directory there to work in or if you'd like also create a subdirectory to work in. To create your own sandbox, do the following (the ">" just indicates the beginning of each command):
> mkdir -p /map/gfx0/users/$USER #Establish your work area. > cd /map/gfx0/users/$USER > mkdir -p <subdirectory>/<sandbox> #Optionally create a $G work area.
After setting everything up your sandbox will have several top level directories. Thecommon directory contains software shared by projects and the project directory contains student applications. There are two other directories of interest. One is the import directory which is where third party software is installed. The other is the install_linux or install_WIN32 directory. This is where software that you build is installed when you perform a "make install". All of these directories can be rearranged to suite your needs. If you are just getting started just create them all at the top level of your sandbox.
The common/ directory has the build make files and shared programs and libraries written at Brown. You only need the common/build/ directory to develop programs, but since you probably will eventually want other common code just check the whole directory out.
> cd <Sandbox> # Go into your sandbox directory. > cvs co common # Get all the common software.
Next create the remaining top level directories and you can populate them later.
> mkdir project > mkdir import > mkdir install_linux > mkdir install_WIN32 # Optional if you only use Linux.
Setting Environment Variables
There are several environment variables to set up. You can set these up in your login scripts along with the setting for CVSROOT.
GARCH: Designate the platform architecture.
GARCH = WIN32 # Use this setting on Windows. GARCH = linux # Use this setting on Linux.
G: This is used to access the G Build system and is set to the location of the common directory. By default it is also used to access the import directory. If your sandbox is at the top of your users' directory then set:
G = /map/gfx0/users/<login>
GROOT: At Brown this variable is used to access these directories:
$GROOT/data # Contains large data sets. $GROOT/users # Work areas for end users.
GROOT = /map/gfx0
GTO: This is the location of the install directories. Usually you will want to keep them at the top of your sandbox then it will be the same as $G.
GTO = $G
G_COMPILER: Set to the compiler you want to work with. You might need to change this depending on project requirements. Supported settings are:
gcc2 gcc version 2.95 gcc3 gcc version 3.4 gcc4 gcc version 4.1 cl6 Microsoft Studio version 6 cl8 Microsoft Studio version 8 (2005) cl9 Microsoft Studio version 9 (2008)
PATH: Only on Windows this needs to be set to access Unix utilities for Windows. Windows users need a few Unix utilities installed to build projects. You can check these out of CVS with:
> cd <Sandbox> > cvs co import/make
Check to see that the utilities are in: <Sandbox>/import/make/g.utility_1.0/
On your Windows system you will need to add this path to the front of your PATH environment variable. After it is set verify that you can run these utilities from the command line.
Verify You Can Build Software
- Build on Linux
Try a simple build to see that everything is properly set up.
> cd <Sandbox>/common/utility > make all > make install
This should populate the install directory. Take a look with:
> ls <Sandbox>/install_linux/*/*
- Build on Windows
Run the 'cmd.exe' shell and try:
> cd/d <Sandbox>\common\utility > make all > make install
Finally inspect <Sandbox>\install_WIN32 to ensure it was properly populated.