[cmake-developers] New find module: FindGLEW.cmake

Benjamin Eikel cmake at eikel.org
Thu Aug 30 04:14:00 EDT 2012


Am Mittwoch, 29. August 2012 um 19:54:58 schrieb Alexander Neundorf:
> On Wednesday 29 August 2012, Benjamin Eikel wrote:
> > Dear CMake developers,
> > 
> > I have written a find module for the OpenGL Extension Wrangler (GLEW) [1]
> > library (see attachment). I tried to follow all the instructions that I
> > have found. I am willing to maintain that module. Unfortunately, the
> > header file "glew.h" does not contain any version information. I could
> 
> Cool :-)
> From looking a bit around on the web, it seems other alternative names for
> the glew library are "glew" and "glew32s"
> Maybe you can add those two names to the find_library() call ?

You are right, I was able to find both in GLEW's Makefile. "glew32s" is the name 
of the static library. I will add both of them. Thank you.

> 
> > extract version information using PkgConfig, but I have in mind that
> > using PkgConfig is discouraged. I am looking forward to your feedback.
> 
> If possible, it'd be nice to do that without pkg-config, that's right.
> glew.h on my system contains several version-related macros, isn't any of
> these usable ?
> 
> /usr/include/GL$ grep VERSION *
> ...
> glew.h:/* ----------------------------- GL_VERSION_1_1
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_1_1
> glew.h:#define GL_VERSION_1_1 1
> glew.h:#define GL_VERSION 0x1F02
> glew.h:#define GLEW_VERSION_1_1 GLEW_GET_VAR(__GLEW_VERSION_1_1)
> glew.h:#endif /* GL_VERSION_1_1 */
> glew.h:/* ----------------------------- GL_VERSION_1_2
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_1_2
> glew.h:#define GL_VERSION_1_2 1
> glew.h:#define GLEW_VERSION_1_2 GLEW_GET_VAR(__GLEW_VERSION_1_2)
> glew.h:#endif /* GL_VERSION_1_2 */
> glew.h:/* ---------------------------- GL_VERSION_1_2_1
> --------------------------- */
> glew.h:#ifndef GL_VERSION_1_2_1
> glew.h:#define GL_VERSION_1_2_1 1
> glew.h:#define GLEW_VERSION_1_2_1 GLEW_GET_VAR(__GLEW_VERSION_1_2_1)
> glew.h:#endif /* GL_VERSION_1_2_1 */
> glew.h:/* ----------------------------- GL_VERSION_1_3
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_1_3
> glew.h:#define GL_VERSION_1_3 1
> glew.h:#define GLEW_VERSION_1_3 GLEW_GET_VAR(__GLEW_VERSION_1_3)
> glew.h:#endif /* GL_VERSION_1_3 */
> glew.h:/* ----------------------------- GL_VERSION_1_4
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_1_4
> glew.h:#define GL_VERSION_1_4 1
> glew.h:#define GLEW_VERSION_1_4 GLEW_GET_VAR(__GLEW_VERSION_1_4)
> glew.h:#endif /* GL_VERSION_1_4 */
> glew.h:/* ----------------------------- GL_VERSION_1_5
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_1_5
> glew.h:#define GL_VERSION_1_5 1
> glew.h:#define GLEW_VERSION_1_5 GLEW_GET_VAR(__GLEW_VERSION_1_5)
> glew.h:#endif /* GL_VERSION_1_5 */
> glew.h:/* ----------------------------- GL_VERSION_2_0
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_2_0
> glew.h:#define GL_VERSION_2_0 1
> glew.h:#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
> glew.h:#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)
> glew.h:#endif /* GL_VERSION_2_0 */
> glew.h:/* ----------------------------- GL_VERSION_2_1
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_2_1
> glew.h:#define GL_VERSION_2_1 1
> glew.h:#define GLEW_VERSION_2_1 GLEW_GET_VAR(__GLEW_VERSION_2_1)
> glew.h:#endif /* GL_VERSION_2_1 */
> glew.h:/* ----------------------------- GL_VERSION_3_0
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_3_0
> glew.h:#define GL_VERSION_3_0 1
> glew.h:#define GL_MAJOR_VERSION 0x821B
> glew.h:#define GL_MINOR_VERSION 0x821C
> glew.h:#define GLEW_VERSION_3_0 GLEW_GET_VAR(__GLEW_VERSION_3_0)
> glew.h:#endif /* GL_VERSION_3_0 */
> glew.h:/* ----------------------------- GL_VERSION_3_1
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_3_1
> glew.h:#define GL_VERSION_3_1 1
> glew.h:#define GLEW_VERSION_3_1 GLEW_GET_VAR(__GLEW_VERSION_3_1)
> glew.h:#endif /* GL_VERSION_3_1 */
> glew.h:/* ----------------------------- GL_VERSION_3_2
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_3_2
> glew.h:#define GL_VERSION_3_2 1
> glew.h:#define GLEW_VERSION_3_2 GLEW_GET_VAR(__GLEW_VERSION_3_2)
> glew.h:#endif /* GL_VERSION_3_2 */
> glew.h:/* ----------------------------- GL_VERSION_3_3
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_3_3
> glew.h:#define GL_VERSION_3_3 1
> glew.h:#define GLEW_VERSION_3_3 GLEW_GET_VAR(__GLEW_VERSION_3_3)
> glew.h:#endif /* GL_VERSION_3_3 */
> glew.h:/* ----------------------------- GL_VERSION_4_0
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_4_0
> glew.h:#define GL_VERSION_4_0 1
> glew.h:#define GLEW_VERSION_4_0 GLEW_GET_VAR(__GLEW_VERSION_4_0)
> glew.h:#endif /* GL_VERSION_4_0 */
> glew.h:/* ----------------------------- GL_VERSION_4_1
> ---------------------------- */
> glew.h:#ifndef GL_VERSION_4_1
> glew.h:#define GL_VERSION_4_1 1
> glew.h:#define GLEW_VERSION_4_1 GLEW_GET_VAR(__GLEW_VERSION_4_1)
> glew.h:#endif /* GL_VERSION_4_1 */

The GL_VERSION_... constants only tell what GL version GLEW supports.

> glew.h:#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_1;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_2_1;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_3;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_4;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_1_5;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_0;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_2_1;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_0;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_1;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_2;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_3_3;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_0;
> glew.h:GLEW_VAR_EXPORT GLboolean __GLEW_VERSION_4_1;

These are the same as the GL_VERSION_... defines.

> glew.h:#define GLEW_ERROR_NO_GL_VERSION 1  /* missing GL version */
> glew.h:#define GLEW_ERROR_GL_VERSION_10_ONLY 2  /* GL 1.1 and up are not
> supported */
> glew.h:#define GLEW_ERROR_GLX_VERSION_11_ONLY 3  /* GLX 1.2 and up are not
> supported */
> glew.h:#define GLEW_VERSION 1
> glew.h:#define GLEW_VERSION_MAJOR 2
> glew.h:#define GLEW_VERSION_MINOR 3
> glew.h:#define GLEW_VERSION_MICRO 4

These seem to be the right ones, but these are no version numbers. They are 
more or less an enumeration. The constants can be used at runtime as parameter 
to glewGetString to query the version.
In the implementation of glewGetString, the version number is hard-coded in a 
string inside the function definition.



More information about the cmake-developers mailing list