diff options
| author | ratalaika <ratalaika@gmail.com> | 2014-11-22 00:13:09 +0100 |
|---|---|---|
| committer | ratalaika <ratalaika@gmail.com> | 2014-11-22 00:13:09 +0100 |
| commit | ab05ace3ce8b999ab665194e63b8b5d03a7787ac (patch) | |
| tree | b7657d2b85f38f53d03368fe88ef54420e83bad2 /src | |
| parent | 05ccc4fd42a9ff2dfd33f13be29734bb7531d65a (diff) | |
| download | raylib-ab05ace3ce8b999ab665194e63b8b5d03a7787ac.tar.gz raylib-ab05ace3ce8b999ab665194e63b8b5d03a7787ac.zip | |
Added first version of OS X compilation support
Diffstat (limited to 'src')
| -rw-r--r-- | src/makefile | 10 | ||||
| -rw-r--r-- | src/rlgl.c | 16 | ||||
| -rw-r--r-- | src/utils.c | 4 |
3 files changed, 22 insertions, 8 deletions
diff --git a/src/makefile b/src/makefile index 0c078e86..780aa16b 100644 --- a/src/makefile +++ b/src/makefile @@ -24,8 +24,8 @@ #************************************************************************************************** # define raylib platform (by default, compile for RPI) -# Other possible platforms: PLATFORM_DESKTOP PLATFORM_DESKTOP_LINUX -PLATFORM ?= PLATFORM_RPI +# Other possible platforms: PLATFORM_DESKTOP PLATFORM_DESKTOP_LINUX PLATFORM_DESKTOP_OSX +PLATFORM ?= PLATFORM_DESKTOP_OSX # define raylib graphics api depending on selected platform ifeq ($(PLATFORM),PLATFORM_RPI) @@ -57,7 +57,7 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) INCLUDES = -I. -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads else - INCLUDES = -I. + INCLUDES = -I. -I../external/glfw3/include/ -I../external/openal_soft/include/ endif # define all object files required @@ -124,9 +124,13 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX) find . -type f -executable -delete rm -f *.o libraylib.a else +ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX) + rm -f *.o libraylib.a +else del *.o libraylib.a endif endif +endif @echo Cleaning done # instead of defining every module one by one, we can define a pattern @@ -32,13 +32,23 @@ #include <stdlib.h> // Declares malloc() and free() for memory management, rand() #if defined(GRAPHICS_API_OPENGL_11) - #include <GL/gl.h> // Basic OpenGL include + #ifdef __APPLE__ + #include <OpenGL/gl.h> + #include <OpenGL/glu.h> + #include <GLUT/glut.h> + #else + #include <GL/gl.h> // Basic OpenGL include + #endif #endif #if defined(GRAPHICS_API_OPENGL_33) #define GLEW_STATIC - #include <GL/glew.h> // Extensions loading lib - //#include "glad.h" // TODO: Other extensions loading lib? --> REVIEW + #ifdef __APPLE__ + #include <OpenGL/gl3.h> + #else + #include <GL/glew.h> // Extensions loading lib + //#include "glad.h" // TODO: Other extensions loading lib? --> REVIEW + #endif #endif #if defined(GRAPHICS_API_OPENGL_ES2) diff --git a/src/utils.c b/src/utils.c index b5112111..26a44065 100644 --- a/src/utils.c +++ b/src/utils.c @@ -40,7 +40,7 @@ #include <stdarg.h> // Used for functions with variable number of parameters (TraceLog()) //#include <string.h> // String management functions: strlen(), strrchr(), strcmp() -#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_DESKTOP_OSX) #define STB_IMAGE_WRITE_IMPLEMENTATION #include "stb_image_write.h" // Create PNG file #endif @@ -107,7 +107,7 @@ unsigned char *DecompressData(const unsigned char *data, unsigned long compSize, return pUncomp; } -#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) +#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) || defined(PLATFORM_DESKTOP_OSX) // Creates a bitmap (BMP) file from an array of pixel data // NOTE: This function is not explicitly available to raylib users void WriteBitmap(const char *fileName, unsigned char *imgData, int width, int height) |
