Browse Source

Add GL headers to compile on Windows

Danil Kolumbet 3 years ago
parent
commit
c71ca54301
3 changed files with 12 additions and 3 deletions
  1. 1 1
      build_msvc.bat
  2. 4 0
      glextloader.c
  3. 7 2
      setup_dependencies.bat

+ 1 - 1
build_msvc.bat

@@ -2,7 +2,7 @@
 rem launch this from msvc-enabled console
 
 set CFLAGS=/std:c11 /O2 /FC /W4 /WX /Zl /D_USE_MATH_DEFINES /wd4996 /nologo
-set INCLUDES=/I Dependencies\GLFW\include
+set INCLUDES=/I Dependencies\GLFW\include /I Dependencies\GL\include /I Dependencies\KHR\include
 set LIBS=Dependencies\GLFW\lib\glfw3.lib opengl32.lib User32.lib Gdi32.lib Shell32.lib
 
 cl.exe %CFLAGS% %INCLUDES% /Fe"main.exe" ./main.c %LIBS% /link /NODEFAULTLIB:libcmt.lib

+ 4 - 0
glextloader.c

@@ -1,3 +1,7 @@
+#ifdef _WIN32
+#include <GL/glcorearb.h>
+#endif
+
 static PFNGLCREATESHADERPROC glCreateShader = NULL;
 static PFNGLSHADERSOURCEPROC glShaderSource = NULL;
 static PFNGLCOMPILESHADERPROC glCompileShader = NULL;

+ 7 - 2
setup_glfw.bat → setup_dependencies.bat

@@ -4,7 +4,12 @@ curl -fsSL -o glfw-3.3.2.bin.WIN64.zip https://github.com/glfw/glfw/releases/dow
 tar -xf glfw-3.3.2.bin.WIN64.zip
 mkdir Dependencies\GLFW\lib\
 move glfw-3.3.2.bin.WIN64\lib-vc2019\glfw3.lib Dependencies\GLFW\lib\glfw3.lib
-mkdir Dependencies\GLFW\include\GLFW
+mkdir Dependencies\GLFW\include\GLFW\
 move glfw-3.3.2.bin.WIN64\include\GLFW\glfw3.h Dependencies\GLFW\include\GLFW\glfw3.h
-del glfw-3.3.2.bin.WIN64.zip
+del  glfw-3.3.2.bin.WIN64.zip
 rmdir /s /q glfw-3.3.2.bin.WIN64
+
+mkdir         Dependencies\GL\include\GL\
+curl -fsSL -o Dependencies\GL\include\GL\glcorearb.h     https://www.khronos.org/registry/OpenGL/api/GL/glcorearb.h
+mkdir         Dependencies\KHR\include\KHR\
+curl -fsSL -o Dependencies\KHR\include\KHR\khrplatform.h https://www.khronos.org/registry/EGL/api/KHR/khrplatform.h