Building the Library

libgfx is a C++ library which is meant to be fairly easy to compile on a wide range of systems. It was developed under Windows NT 4.0, Windows 2000, and RedHat Linux 6.

This library does make use of the ANSI C++ Standard Library. For instance, it uses the new <iostream> rather than the old <iostream.h> package. And it does make some minimal use of the Standard Template Library (STL). Therefore, it may not work on older C++ compilers. It is known to work on Microsoft Visual C++ version 5.0 and above and GNU GCC version 2.9 and above.

Required external libraries:

Optional external libraries:

For Windows Systems

Visual C++

A Visual C++ 6.0 workspace and accompanying project files are provided in the vc6 directory. An older VC++ 5.0 workspace is available in the vc5 directory. However, this is no longer in regular use and may be out of date.

Manual Build

The library can also be built manually using the nmake command line tool. A configure.bat batch file is provided which will set up the necessary configuration files.

To build the library manually, use the following process:

  1. configure.bat
  2. cd src
  3. nmake /f Makefile.vc

Cygwin

The libgfx library will build properly under Windows with the Cygwin toolset. Simply follow the directions for Unix systems.

For Unix Systems

The Unix build process relies on the GNU Autoconf system to properly configure the software.

Once the required libraries are installed, you should be able to build the library using the following process:

  1. ./configure
  2. cd src
  3. make
If the support libraries are installed in a directory outside the default search path, you can invoke the configure script with the option --with-local[=dir] which will add "dir" to the search path. The default local directory is /usr/local, but you can specify any directory of your choice.

For Mac OS X Systems

The current version of libgfx can be successfully compiled under Mac OS X, but it requires a bit of manual intervention.

First, you should install the FLTK library. To build under Mac OS X, you must use version 1.1.0 or later. Next, you should follow the instructions for using the Autoconf script outlined in the directions for Unix systems above.

This is sufficient to compile command-line programs. However, GUI programs require a little extra work. The typical GUI make rule looks like this:

    gui-program: gui-program.cxx
	    $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) -lgfx $(GUI_LIBS) -lm
To work correctly with the Mac OS, you must add an additional step to this make rule:
    gui-program: gui-program.cxx
	    $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) -lgfx $(GUI_LIBS) -lm
	    $(FLTKCONFIG) --post $@
This uses the fltk-config script to add a standard resource fork to the compiled application.