Fix building on Windows

- Drop linking opengl32/glew32.libs using `#pragma`s in favour of
  specifing the libraries at build time.
- Use check for the `WIN32` macro when including Windows specific
  headers in `src/render_gl.c`.
- Undefine the `min`, `max`, `near`, and `far` macros when building on
  Windows.
This commit is contained in:
Stephen Gregoratto 2023-08-13 17:50:39 +10:00
parent ecf1e63508
commit 9207839c80
2 changed files with 11 additions and 9 deletions

View file

@ -11,18 +11,14 @@
// Linux
#elif defined(__unix__)
#include <GL/glew.h>
#elif defined(__MSYS__)
#include <GL/glew.h>
// WINDOWS
#else
// Windows
#elif defined(WIN32)
#include <windows.h>
#define GL3_PROTOTYPES 1
#include <glew.h>
#pragma comment(lib, "glew32.lib")
#include <gl/GL.h>
#pragma comment(lib, "opengl32.lib")
#include <GL/glew.h>
#include <GL/gl.h>
#endif

View file

@ -4,6 +4,12 @@
#include <string.h>
#include "types.h"
#ifdef WIN32
#undef min
#undef max
#undef near
#undef far
#endif
#if !defined(offsetof)
#define offsetof(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))