NagyD / SDLPoP

An open-source port of Prince of Persia, based on the disassembly of the DOS version.
GNU General Public License v3.0
1.1k stars 141 forks source link

Adjust SDL2 headers search path in CMake or macOS builds #249

Closed alebcay closed 3 years ago

alebcay commented 3 years ago

SDLPoP includes SDL.h as #include <SDL.h> (not #include <SDL2/SDL.h>). The current Makefile works on Linux because pkg-config correctly passes cflags as #{prefix}/include/SDL2. Unfortunately, on macOS, /opt/local/include won't work - it would be /opt/local/include/SDL2.

Instead of fixing this with a hard-coded path, just rely on pkg-config to set the appropriate paths on both macOS and Linux. An additional benefit here is that people who have SDL2/SDL2_image installed in non-standard locations can adjust PKG_CONFIG_PATH to point at the appropriate search locations.

The same issue exists for the CMake-based build, which this PR also fixes.

We encountered this issue while packaging SDLPoP 1.22 for Homebrew - see downstream discussion at https://github.com/Homebrew/homebrew-core/pull/80795. Thanks!