Include the canonical SDL2 path, which drops the SDL2/ prefix.
Use pkg-config or sdl2-config to determine SDL and GL compilation flags.
This commit is contained in:
parent
0ea361a82f
commit
7c9508ae96
29
Makefile
29
Makefile
@ -55,6 +55,11 @@ CC := clang
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Find libraries with pkg-config if available.
|
||||||
|
ifneq (, $(shell which pkg-config))
|
||||||
|
PKG_CONFIG := pkg-config
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM),windows32)
|
ifeq ($(PLATFORM),windows32)
|
||||||
# To force use of the Unix version instead of the Windows version
|
# To force use of the Unix version instead of the Windows version
|
||||||
MKDIR := $(shell which mkdir)
|
MKDIR := $(shell which mkdir)
|
||||||
@ -82,7 +87,19 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
CFLAGS += -Werror -Wall -Wno-unused-result -Wno-strict-aliasing -Wno-unknown-warning -Wno-unknown-warning-option -Wno-multichar -Wno-int-in-bool-context -std=gnu11 -D_GNU_SOURCE -DVERSION="$(VERSION)" -I. -D_USE_MATH_DEFINES
|
CFLAGS += -Werror -Wall -Wno-unused-result -Wno-strict-aliasing -Wno-unknown-warning -Wno-unknown-warning-option -Wno-multichar -Wno-int-in-bool-context -std=gnu11 -D_GNU_SOURCE -DVERSION="$(VERSION)" -I. -D_USE_MATH_DEFINES
|
||||||
SDL_LDFLAGS := -lSDL2 -lGL
|
ifeq (,$(PKG_CONFIG))
|
||||||
|
SDL_CFLAGS := $(shell sdl2-config --cflags)
|
||||||
|
SDL_LDFLAGS := $(shell sdl2-config --libs)
|
||||||
|
else
|
||||||
|
SDL_CFLAGS := $(shell $(PKG_CONFIG) --cflags sdl2)
|
||||||
|
SDL_LDFLAGS := $(shell $(PKG_CONFIG) --libs sdl2)
|
||||||
|
endif
|
||||||
|
ifeq (,$(PKG_CONFIG))
|
||||||
|
GL_LDFLAGS := -lGL
|
||||||
|
else
|
||||||
|
GL_CFLAGS := $(shell $(PKG_CONFIG) --cflags gl)
|
||||||
|
GL_LDFLAGS := $(shell $(PKG_CONFIG) --libs gl || echo -lGL)
|
||||||
|
endif
|
||||||
ifeq ($(PLATFORM),windows32)
|
ifeq ($(PLATFORM),windows32)
|
||||||
CFLAGS += -IWindows -Drandom=rand
|
CFLAGS += -IWindows -Drandom=rand
|
||||||
LDFLAGS += -lmsvcrt -lcomdlg32 -lSDL2main -Wl,/MANIFESTFILE:NUL
|
LDFLAGS += -lmsvcrt -lcomdlg32 -lSDL2main -Wl,/MANIFESTFILE:NUL
|
||||||
@ -169,6 +186,10 @@ ifneq ($(filter $(MAKECMDGOALS),cocoa),)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(OBJ)/SDL/%.dep: SDL/%
|
||||||
|
-@$(MKDIR) -p $(dir $@)
|
||||||
|
$(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@
|
||||||
|
|
||||||
$(OBJ)/%.dep: %
|
$(OBJ)/%.dep: %
|
||||||
-@$(MKDIR) -p $(dir $@)
|
-@$(MKDIR) -p $(dir $@)
|
||||||
$(CC) $(CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@
|
$(CC) $(CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@
|
||||||
@ -179,6 +200,10 @@ $(OBJ)/Core/%.c.o: Core/%.c
|
|||||||
-@$(MKDIR) -p $(dir $@)
|
-@$(MKDIR) -p $(dir $@)
|
||||||
$(CC) $(CFLAGS) -DGB_INTERNAL -c $< -o $@
|
$(CC) $(CFLAGS) -DGB_INTERNAL -c $< -o $@
|
||||||
|
|
||||||
|
$(OBJ)/SDL/%.c.o: SDL/%.c
|
||||||
|
-@$(MKDIR) -p $(dir $@)
|
||||||
|
$(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJ)/%.c.o: %.c
|
$(OBJ)/%.c.o: %.c
|
||||||
-@$(MKDIR) -p $(dir $@)
|
-@$(MKDIR) -p $(dir $@)
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
@ -256,7 +281,7 @@ $(BIN)/SameBoy.qlgenerator/Contents/Resources/cgb_boot_fast.bin: $(BIN)/BootROMs
|
|||||||
# Unix versions build only one binary
|
# Unix versions build only one binary
|
||||||
$(BIN)/SDL/sameboy: $(CORE_OBJECTS) $(SDL_OBJECTS)
|
$(BIN)/SDL/sameboy: $(CORE_OBJECTS) $(SDL_OBJECTS)
|
||||||
-@$(MKDIR) -p $(dir $@)
|
-@$(MKDIR) -p $(dir $@)
|
||||||
$(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS)
|
$(CC) $^ -o $@ $(LDFLAGS) $(SDL_LDFLAGS) $(GL_LDFLAGS)
|
||||||
ifeq ($(CONF), release)
|
ifeq ($(CONF), release)
|
||||||
strip $@
|
strip $@
|
||||||
endif
|
endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <SDL2/SDL.h>
|
|
||||||
#include <OpenDialog/open_dialog.h>
|
#include <OpenDialog/open_dialog.h>
|
||||||
|
#include <SDL.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef gui_h
|
#ifndef gui_h
|
||||||
#define gui_h
|
#define gui_h
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL.h>
|
||||||
#include <Core/gb.h>
|
#include <Core/gb.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <OpenDialog/open_dialog.h>
|
#include <OpenDialog/open_dialog.h>
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL.h>
|
||||||
#include <Core/gb.h>
|
#include <Core/gb.h>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#define GL_GLEXT_PROTOTYPES
|
#define GL_GLEXT_PROTOTYPES
|
||||||
#include <SDL2/SDL_opengl.h>
|
#include <SDL_opengl.h>
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#define GL_COMPAT_NAME(func) gl_compat_##func
|
#define GL_COMPAT_NAME(func) gl_compat_##func
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define opengl_compat_h
|
#define opengl_compat_h
|
||||||
|
|
||||||
#define GL_GLEXT_PROTOTYPES
|
#define GL_GLEXT_PROTOTYPES
|
||||||
#include <SDL2/SDL_opengl.h>
|
#include <SDL_opengl.h>
|
||||||
#include <SDL2/SDL_video.h>
|
#include <SDL_video.h>
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
#define GL_COMPAT_NAME(func) gl_compat_##func
|
#define GL_COMPAT_NAME(func) gl_compat_##func
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include <SDL2/SDL.h>
|
#include <SDL.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user