Compilation Instructions
Return to TetGen home page.
The latest version of TetGen is always available from its homepage. A summary of the new features in this version can be found at release notes. The source code of TetGen is written in standard C++. It is highly portable and should be compiled on all major operating systems and on 32-bit and 64-bit computers.
The downloaded archive (tetgen1.4.x.zip or tetgen1.4.x.tar.gz) should include the following files:
README |
General information |
LICENSE |
Copyright notices |
tetgen.h |
C++ header file of TetGen |
tetgen.cxx |
C++ source file of TetGen |
predicates.cxx |
C++ source file of Shewchuk's geometric predicates |
makefile |
Makefile of TetGen |
example.poly |
An example input file |
To compile TetGen, all you need is a C++ compiler for the operating system on which TetGen will be used. For example, the gcc/g++ is a free C/C++ compiler available for most of major operating systems, e.g., Unix/Linux, Mirosoft Windows, MacOS, etc. TetGen may be compiled into an executable program, or a library which can be linked into another program.
Compilation on Linux/Unix/Darwin
The easiest way to compile TetGen is to edit and use the included makefile, i.e., do the following steps:
- Put all C++ source files (tetgen.h, tetgen.cxx, and predicates.cxx) and the makefile in one directory, e.g., "$HOME/tetgen".
- Open "makefile" with any text editor. Read the instructions and edit it accordingly. Generally, you only need to specify the C++ compiler and the compilation options. Default, the GNU g++ compiler and the debug option -g are used. You can edit the following two lines to change the default settings.
CXX = g++
CXXFLAGS = -g
For instance, the following option will compile TetGen with optimization level 2
CXXFLAGS = -O2
Note that the compiler options of "predicates.cxx" are separatedly defined in the string "PREDCXXFLAGS". Default, it is -O0, i.e., no optimization.
- Type "make". This will compile TetGen into an excutable program.
- Type "make tetlib" to compile TetGen into a library, i.e., "libtet.a". It can be linked into other programs.
Compilation on Windows 9x/NT/2000/XP
TetGen compiles as a console program "tetgen.exe" or a library "tetgen.lib" on Win32 systems. Test have been done with Microsoft Visual C++ 6.0 (VC++). The easiest way to compile TetGen is to use the integrated development environment (IDE) of VC++. The minimum steps to create "tetgen.exe" are:
- Create a ``Win32 console application'' called ``tetgen''.
- Add all source files (tetgen.h, tetgen.cxx, predicates.cxx) into this project.
- Build the project.
To create a library do the following minimum steps:
- Create a ``Win32 static library'' called ``library''.
- Add all source files into this project.
- Add the symbol ``TETLIBRARY'' to compile switches.
- Build the project.
Return to TetGen home page.
Hang Si
2007-04-28