Building GLFW.. WITHOUT OpenGL!

bencelot wrote on Tuesday, February 01, 2011:

A crazy idea to be sure. GLFW would simply become… FW. But a framework is
exactly what I need :wink:

Basically, I’ve got my game running with GLFW (loving it btw). I’m using
GLFW for a number of things including: window setup, keyboard input, timing,
multithreading, etc…

Now here comes the problem. I want to create a linux dedicated server that’s
capable of running on machines with no graphics support at all. This means
they do NOT already have or! And even though I’ve disabled
the window creation in such a version, GLFW still requires these opengl shared
libraries to run. So I was wondering, is it possible to build GLFW without any
graphical dependencies and only build stuff like multithreading and timing?
This way I can release a dedicated version of my game without having to remove
all of GLFW’s lovely non-graphical features.


elmindreda wrote on Tuesday, February 01, 2011:

Have you tried simply not linking against GL and GLU? Your linker may be
clever enough to figure it out, since you’re most likely not calling anything
in x11_window.c.

If, however, you need to be rid of all X depdendencies, that will take some

bencelot wrote on Tuesday, February 01, 2011:

Hmm, well at the moment that won’t even let me compile as I get a whole bunch
of unresolved calls to gl commands. However, I haven’t gone to the trouble of
#ifdeffing them out just yet, so perhaps after I do that it won’t be a
problem anymore. I’ll keep you posted.

bencelot wrote on Thursday, February 03, 2011:

Yeah ok, that didn’t work. Even once I’d unlinked GL and GLU and then removed
all opengl calls in MY code… glfw started complaining when I compiled. To be
expected I spose. Anyway, it wasn’t that big an issue, I just replaced my
remaining timing, sleeping and multithreading glfw calls, effectively removing
glfw completely from my dedicated server. I could then unlink from libglfw.a
and it all works fine now.

Still, gotta love GLFW for my client :smiley: