Skip to content

Commit

Permalink
Merge pull request #82 from kulp/sdl2-config
Browse files Browse the repository at this point in the history
Prefer sdl2-config over pkg-config
  • Loading branch information
kulp committed Mar 20, 2021
2 parents 74a51e1 + 532a632 commit 3f72436
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mk/os/vars/Win32.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ URL_SDL2 = https://www.libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz
DL_DIR_SDL2 = $(TOP)/3rdparty/sdl2
DL_DIR_SDL2_image = $(TOP)/3rdparty/sdl2

SDL2_PKGCONFIG = PKG_CONFIG_PATH=$(TOP)/3rdparty/sdl2/$(MACHINE)/lib/pkgconfig pkg-config --define-variable=prefix=$(TOP)/3rdparty/sdl2/$(MACHINE)
SDL2_CONFIG = PKG_CONFIG_PATH=$(TOP)/3rdparty/sdl2/$(MACHINE)/lib/pkgconfig pkg-config --define-variable=prefix=$(TOP)/3rdparty/sdl2/$(MACHINE)

# Create Wine path for a given UNIX path
os_path = z:$(subst /,\\,$1)
Expand Down
4 changes: 2 additions & 2 deletions mk/os/vars/default.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CFLAGS_PIC += -fPIC
PATH_SEP_CHAR=':'
DYLIB_SUFFIX = .so
EXE_SUFFIX =
# Respect SDL2_PKGCONFIG from environment
SDL2_PKGCONFIG ?= pkg-config
# Respect SDL2_CONFIG from environment
SDL2_CONFIG ?= sdl2-config
# Pass through path unchanged in default configuration
os_path = $1
11 changes: 3 additions & 8 deletions mk/sdl.mk
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
ifneq ($(SDL),0)
sdl2_pkg_config ?= $(shell $(SDL2_PKGCONFIG) $1 $2)
SDL_VERSION := $(call sdl2_pkg_config,--modversion,sdl2)
ifneq ($(SDL_VERSION),)
sdl2_config ?= $(shell $(SDL2_CONFIG) $1 $2)
PDEVICES_SDL += sdlled sdlvga
PDEVICES += $(PDEVICES_SDL)
# Mark SDL header includes as system includes to avoid subjecting them to full
# pedantry
libtenyrsdl%$(DYLIB_SUFFIX) $(PDEVICES_SDL:%=devices/%.d): \
CPPFLAGS += $(patsubst -I%,-isystem %,$(call sdl2_pkg_config,--cflags-only-I,sdl2 SDL2_image))
libtenyrsdl%$(DYLIB_SUFFIX) $(PDEVICES_SDL:%=devices/%.d): \
CPPFLAGS += $(call sdl2_pkg_config,--cflags-only-other,sdl2 SDL2_image)
libtenyrsdl%$(DYLIB_SUFFIX): LDLIBS += $(call sdl2_pkg_config,--libs,sdl2 SDL2_image)
CPPFLAGS += $(patsubst -I%,-isystem %,$(call sdl2_config,--cflags))
libtenyrsdl%$(DYLIB_SUFFIX): LDLIBS += $(call sdl2_config,--libs) -lSDL2_image
libtenyrsdlvga$(DYLIB_SUFFIX): | $(TOP)/rsrc/font10x15/invert.font10x15.png
$(TOP)/rsrc/font10x15/%:
$(MAKE) -C $(@D) $(@F)
Expand All @@ -19,5 +15,4 @@ $(TOP)/rsrc/font10x15/%:
# unused.
sdl%.o: CFLAGS += -W$(PEDANTRY_EXCEPTION)unused-macros -W'$(PEDANTRY_EXCEPTION)\#warnings'
endif
endif

0 comments on commit 3f72436

Please sign in to comment.