Name of gl/gl.h in mingw


#1

Hi,

 

I'm cross compiling JUCE with mingw on Linux, and needed to apply this patch:

diff --git a/modules/juce_opengl/juce_opengl.h b/modules/juce_opengl/juce_opengl.h
index 5c627ae..43768fd 100644
--- a/modules/juce_opengl/juce_opengl.h
+++ b/modules/juce_opengl/juce_opengl.h
@@ -34,7 +34,7 @@
  #define JUCE_OPENGL_ES 1
 #endif
 
-#if JUCE_WINDOWS
+#if JUCE_WINDOWS && !JUCE_MINGW
  #ifndef APIENTRY
   #define APIENTRY __stdcall
   #define CLEAR_TEMP_APIENTRY 1
@@ -52,6 +52,8 @@
   #undef APIENTRY
   #undef CLEAR_TEMP_APIENTRY
  #endif
+#elif JUCE_MINGW
+ #include <GL/gl.h>
 #elif JUCE_LINUX
  #include <GL/gl.h>
  #undef KeyPress

 

I couldn't find any issue about this in the forum though, so maybe it's usually the other way around (i.e "/GL/gl.h" instead of "gl/GL.h" on mingw)?

 

 


#2

Oh, I guess both mingw/windows and the microsoft c compiler are case insensitive? In that case, maybe the simple patch below would be correct. Because mingw is not case insensitive when cross compiling on linux.

diff --git a/modules/juce_opengl/juce_opengl.h b/modules/juce_opengl/juce_opengl.h
index 5c627ae..b719659 100644
--- a/modules/juce_opengl/juce_opengl.h
+++ b/modules/juce_opengl/juce_opengl.h
@@ -43,7 +43,7 @@
   #define WINGDIAPI __declspec(dllimport)
   #define CLEAR_TEMP_WINGDIAPI 1
  #endif
- #include <gl/GL.h>
+ #include <GL/gl.h>
  #ifdef CLEAR_TEMP_WINGDIAPI
   #undef WINGDIAPI
   #undef CLEAR_TEMP_WINGDIAPI

 


#3

I don't think I ever built juce opengl stuff with mingw, but for regular usage this is what I have:

#include "GL/gl.h"

I know that one works.

 


#4

Yes, that's the one I have always seen in Linux. But maybe, for some reason, it's "gl/GL.h" in Windows.

 

Anyway, I was compiling the plugin audio host to check if it would crash when opening the GUI of a plugin there. It did not crash in the "audio plugin host", and I finally found out that this block of code:

 

     this->setSize (400, 300);
      this->setUsingNativeTitleBar(true);

      this->setContentOwned(editor, true);
      
      if (data->x <= 0 || data->y <= 0) {
        this->centreWithSize (getWidth(), getHeight());
      } else {
        this->setTopLeftPosition(data->x, data->y);
      }

      this->setVisible(true);

 

...had to be run inside the constructor of the PluginWindow class, and not after the constructor function was finished. I think that is really weird... The host will crash if you run the above code after the constructor has finished and try to show the GUI of a VST plugin that shows a popup window first. The demo version of the "OhmBoyz" plugin does this, and also the SampleTank3 pluginafter the try-out duration is finished.


#5

Hmm, but I'm not able to reproduce the crash in the JUCE "audio plugin host" example program though (although it is 100% reproducable in my program). In my program, maybe it has something to do with using Qt, JUCE and running an additional OpenGL thread at the same time. I still don't grasp why it makes a difference to run that code inside the constructor though.

 


#6

The official MS Windows SDK really does use gl/GL.h, but usually on Windows this doesn't really matter as filenames are case-insensitive.

Can you guys confirm that if I change the current line

 #include <gl/GL.h>

to

 #if JUCE_MINGW
  #include <GL/gl.h>
 #else
  #include <gl/GL.h>
 #endif

..then that'll make everyone happy?


#7

I can confirm that the master branch of git (i.e. 4.2.4) cross-compiles on Linux using mingw gcc 5.4.0 (from mxe). So all seems good now. Thank you.