Removed GLFW3 linking and added rglfw

This commit is contained in:
Ray San 2017-11-30 16:59:09 +01:00
parent c9722161d1
commit 9a7524661f

View File

@ -89,6 +89,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI)
UNAMEOS=$(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# Emscripten required variables # Emscripten required variables
@ -224,7 +230,7 @@ endif
# Define compiler flags: # Define compiler flags:
# -O1 defines optimization level # -O1 defines optimization level
# -Og enable debugging # -g enable debugging
# -s strip unnecessary data from build # -s strip unnecessary data from build
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
@ -270,7 +276,7 @@ endif
# Define include paths for required headers # Define include paths for required headers
# NOTE: Several external required libraries (stb and others) # NOTE: Several external required libraries (stb and others)
INCLUDE_PATHS = -I. -Iexternal -Iexternal/include INCLUDE_PATHS = -I. -Iexternal -Iexternal/include -Iexternal/glfw/include
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),FREEBSD) ifeq ($(PLATFORM_OS),FREEBSD)
@ -310,8 +316,23 @@ endif
# Define all object files required with a wildcard # Define all object files required with a wildcard
# The wildcard takes all files that finish with ".c", # The wildcard takes all files that finish with ".c",
# and replaces extentions with ".o", that are the object files # and replaces extentions with ".o", that are the object files
OBJS = $(patsubst %.c, %.o, $(wildcard *.c)) # NOTE: Some objects depend on the PLATFORM to be added or not!
OBJS += stb_vorbis.o # OBJS = $(patsubst %.c, %.o, $(wildcard *.c))
# Define object required on compilation
OBJS = core.o \
rlgl.o \
shapes.o \
textures.o \
text.o \
models.o \
audio.o \
stb_vorbis.o \
utils.o
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
OBJS += rglfw.o
endif
# Default target entry # Default target entry
all: raylib all: raylib
@ -338,24 +359,24 @@ else
ifeq ($(RAYLIB_LIBTYPE),SHARED) ifeq ($(RAYLIB_LIBTYPE),SHARED)
# NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library # NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -lglfw3 -lgdi32 -lopenal32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -lgdi32 -lopenal32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a
@echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!"
@echo "expected OpenAL Soft static library linking" @echo "expected OpenAL Soft static library linking"
endif endif
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# Compile raylib to shared library version for GNU/Linux. # Compile raylib to shared library version for GNU/Linux.
# WARNING: you should type "make clean" before doing this target # WARNING: you should type "make clean" before doing this target
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lm -lpthread -ldl $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lopenal -lm -lpthread -ldl
@echo "raylib shared library generated (libraylib.so)!" @echo "raylib shared library generated (libraylib.so)!"
endif endif
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
$(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -framework OpenGL -framework OpenAL -framework Cocoa
install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib
@echo "raylib shared library generated (libraylib.dylib)!" @echo "raylib shared library generated (libraylib.dylib)!"
endif endif
ifeq ($(PLATFORM_OS),FREEBSD) ifeq ($(PLATFORM_OS),FREEBSD)
# WARNING: you should type "gmake clean" before doing this target # WARNING: you should type "gmake clean" before doing this target
$(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lpthread $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lopenal -lpthread
@echo "raylib shared library generated (libraylib.so)!" @echo "raylib shared library generated (libraylib.so)!"
endif endif
ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(PLATFORM),PLATFORM_ANDROID)
@ -380,6 +401,10 @@ endif
# Compile core module # Compile core module
core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# Compile rglfw module
rglfw.o : rglfw.c
$(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS)
# Compile rlgl module # Compile rlgl module
rlgl.o : rlgl.c rlgl.h raymath.h rlgl.o : rlgl.c rlgl.h raymath.h