Skip to content

Commit

Permalink
build: use pkg-config for SDL2
Browse files Browse the repository at this point in the history
SDL2 hasn't required suing sdl2-config in a long time and using
pkg-config can have better results for distros.
  • Loading branch information
orbea committed Oct 21, 2024
1 parent 966a5df commit b007759
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions projects/unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,18 @@ endif

# test for presence of SDL
ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
SDL_CONFIG = $(CROSS_COMPILE)sdl2-config
ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
$(error No SDL development libraries found!)
else
ifeq ($(NETPLAY), 1)
SDL_LDLIBS += -lSDL2_net
ifeq ($(shell $(PKG_CONFIG) --modversion sdl2 2>/dev/null),)
$(error No SDL2 development libraries found!)
endif
ifeq ($(NETPLAY), 1)
ifeq ($(shell $(PKG_CONFIG) --modversion SDL2_net 2>/dev/null),)
$(error No SDL2_net development libraries found!)
endif
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags SDL2_net)
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs SDL2_net)
endif
SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
SDL_CFLAGS += $(shell $(PKG_CONFIG) --cflags sdl2)
SDL_LDLIBS += $(shell $(PKG_CONFIG) --libs sdl2)
endif
CFLAGS += $(SDL_CFLAGS)
LDLIBS += $(SDL_LDLIBS)
Expand Down

0 comments on commit b007759

Please sign in to comment.