mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-27 00:51:55 +00:00
127 lines
4.8 KiB
HTML
127 lines
4.8 KiB
HTML
|
<h2>Installation</h2>
|
||
|
|
||
|
<p>
|
||
|
To use the shared library version of GLEW, you need to copy the
|
||
|
headers and libraries into their destination directories. On Windows
|
||
|
this typically boils down to copying:
|
||
|
</p>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" align="center"> <!-- bgcolor="#f0f0f0" -->
|
||
|
<tr><td align="left"><tt>bin/glew32.dll</tt></td><td> to </td>
|
||
|
<td align="left"><tt>%SystemRoot%/system32</tt></td></tr>
|
||
|
<tr><td align="left"><tt>lib/glew32.lib</tt></td><td> to </td>
|
||
|
<td align="left"><tt>{VC Root}/Lib</tt></td></tr>
|
||
|
<tr><td align="left"><tt>include/GL/glew.h</tt></td><td> to </td>
|
||
|
<td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
|
||
|
<tr><td align="left"><tt>include/GL/wglew.h</tt></td><td> to </td>
|
||
|
<td align="left"><tt>{VC Root}/Include/GL</tt></td></tr>
|
||
|
</table>
|
||
|
<p>
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
where <tt>{VC Root}</tt> is the Visual C++ root directory, typically
|
||
|
<tt>C:/Program Files/Microsoft Visual Studio/VC98</tt> for Visual
|
||
|
Studio 6.0 or <tt>C:/Program Files/Microsoft Visual
|
||
|
Studio .NET 2003/Vc7/PlatformSDK</tt> for Visual Studio .NET.
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
On Unix, typing <tt>make install</tt> will attempt to install GLEW
|
||
|
into <tt>/usr/include/GL</tt> and <tt>/usr/lib</tt>. You can
|
||
|
customize the installation target via the <tt>GLEW_DEST</tt>
|
||
|
environment variable if you do not have write access to these
|
||
|
directories.
|
||
|
</p>
|
||
|
|
||
|
<h2>Building Your Project with GLEW</h2>
|
||
|
<p>
|
||
|
There are two ways to build your project with GLEW.
|
||
|
</p>
|
||
|
<h3>Including the source files / project file</h3>
|
||
|
<p>
|
||
|
The simpler but less flexible way is to include <tt>glew.h</tt> and
|
||
|
<tt>glew.c</tt> into your project. On Windows, you also need to
|
||
|
define the <tt>GLEW_STATIC</tt> preprocessor token when building a
|
||
|
static library or executable, and the <tt>GLEW_BUILD</tt> preprocessor
|
||
|
token when building a dll. You also need to replace
|
||
|
<tt><GL/gl.h></tt> and <tt><GL/glu.h></tt> with
|
||
|
<tt><glew.h></tt> in your code and set the appropriate include
|
||
|
flag (<tt>-I</tt>) to tell the compiler where to look for it. For
|
||
|
example:
|
||
|
</p>
|
||
|
<p class="pre">
|
||
|
#include <glew.h><br>
|
||
|
#include <GL/glut.h><br>
|
||
|
<gl, glu, and glut functionality is available here><br>
|
||
|
</p>
|
||
|
<p>
|
||
|
Depending on where you put <tt>glew.h</tt> you may also need to change
|
||
|
the include directives in <tt>glew.c</tt>. Note that if you are using
|
||
|
GLEW together with GLUT, you have to include <tt>glew.h</tt> first.
|
||
|
In addition, <tt>glew.h</tt> includes <tt>glu.h</tt>, so you do not
|
||
|
need to include it separately.
|
||
|
</p>
|
||
|
<p>
|
||
|
On Windows, you also have the option of adding the supplied project
|
||
|
file <tt>glew_static.dsp</tt> to your workspace (solution) and compile
|
||
|
it together with your other projects. In this case you also need to
|
||
|
change the <tt>GLEW_BUILD</tt> preprocessor constant to
|
||
|
<tt>GLEW_STATIC</tt> when building a static library or executable,
|
||
|
otherwise you get build errors.
|
||
|
</p>
|
||
|
<p>
|
||
|
<b>Note that GLEW does not use the C
|
||
|
runtime library, so it does not matter which version (single-threaded,
|
||
|
multi-threaded or multi-threaded DLL) it is linked with (without
|
||
|
debugging information). It is, however, always a good idea to compile all
|
||
|
your projects including GLEW with the same C runtime settings.</b>
|
||
|
</p>
|
||
|
|
||
|
<h3>Using GLEW as a shared library</h3>
|
||
|
|
||
|
<p>
|
||
|
Alternatively, you can use the provided project files / makefile to
|
||
|
build a separate shared library you can link your projects with later.
|
||
|
In this case the best practice is to install <tt>glew.h</tt>,
|
||
|
<tt>glew32.lib</tt>, and <tt>glew32.dll</tt> / <tt>libGLEW.so</tt> to
|
||
|
where the OpenGL equivalents <tt>gl.h</tt>, <tt>opengl32.lib</tt>, and
|
||
|
<tt>opengl32.dll</tt> / <tt>libGL.so</tt> are located. Note that you
|
||
|
need administrative privileges to do this. If you do not have
|
||
|
administrator access and your system administrator will not do it for
|
||
|
you, you can install GLEW into your own lib and include subdirectories
|
||
|
and tell the compiler where to find it. Then you can just replace
|
||
|
<tt><GL/gl.h></tt> with <tt><GL/glew.h></tt> in your
|
||
|
program:
|
||
|
</p>
|
||
|
|
||
|
<p class="pre">
|
||
|
#include <GL/glew.h><br>
|
||
|
#include <GL/glut.h><br>
|
||
|
<gl, glu, and glut functionality is available here><br>
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
or:
|
||
|
</p>
|
||
|
|
||
|
<p class="pre">
|
||
|
#include <GL/glew.h><br>
|
||
|
<gl and glu functionality is available here><br>
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
Remember to link your project with <tt>glew32.lib</tt>,
|
||
|
<tt>glu32.lib</tt>, and <tt>opengl32.lib</tt> on Windows and
|
||
|
<tt>libGLEW.so</tt>, <tt>libGLU.so</tt>, and <tt>libGL.so</tt> on
|
||
|
Unix (<tt>-lGLEW -lGLU -lGL</tt>).
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
It is important to keep in mind that <tt>glew.h</tt> includes neither
|
||
|
<tt>windows.h</tt> nor <tt>gl.h</tt>. Also, GLEW will warn you by
|
||
|
issuing a preprocessor error in case you have included <tt>gl.h</tt>,
|
||
|
<tt>glext.h</tt>, or <tt>glATI.h</tt> before <tt>glew.h</tt>.
|
||
|
</p>
|
||
|
|