From: DeaDDooMER Date: Wed, 1 Apr 2020 15:36:20 +0000 (+0300) Subject: sdl2: fix building with sdl2 on linux X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=e4b2e65833f9ba8436226956c391e3d6d2ff2951;p=flatwaifu.git sdl2: fix building with sdl2 on linux --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3d8ed0..e496d8c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,6 +28,9 @@ set(D2D_SDLMIXER_ROOT ${D2D_GAME_ROOT}/sdlmixer) set(D2D_OPENAL_ROOT ${D2D_GAME_ROOT}/openal) set(D2D_STUBSOUND_ROOT ${D2D_GAME_ROOT}/stubsnd) +string(COMPARE EQUAL "${CMAKE_SYSTEM_NAME}" "Darwin" D2D_FOR_DARWIN) +string(COMPARE EQUAL "${CMAKE_SYSTEM_PROCESSOR}" "powerpc" D2D_FOR_POWERPC) + aux_source_directory(${D2D_GAME_ROOT} D2D_GAME_SRC) aux_source_directory(${D2D_SDL_ROOT} D2D_SDL_SRC) aux_source_directory(${D2D_SDL2_ROOT} D2D_SDL2_SRC) @@ -45,12 +48,19 @@ if(WITH_SDL) set(D2D_SYSTEM_INCLUDE_DIR "${SDL_INCLUDE_DIR}") set(D2D_SYSTEM_LIBRARY "${SDL_LIBRARY}") elseif(WITH_SDL2) -# find_package(SDL2 REQUIRED) - set(SDL2_INCLUDE_DIR "/usr/local/include/SDL2") - set(SDL2_LIBRARY "-lSDL2") + if(D2D_FOR_DARWIN AND D2D_FOR_POWERPC) + # tigerbrew did not provide sdl2 module for cmake + find_package(SDL2) + if(NOT SDL2_FOUND) + set(SDL2_INCLUDE_DIRS "/usr/local/include/SDL2") + set(SDL2_LIBRARIES "-lSDL2") + endif(NOT SDL2_FOUND) + else(D2D_FOR_DARWIN AND D2D_FOR_POWERPC) + find_package(SDL2 REQUIRED) + endif(D2D_FOR_DARWIN AND D2D_FOR_POWERPC) set(D2D_SYSTEM_SRC "${D2D_SDL2_SRC}") - set(D2D_SYSTEM_INCLUDE_DIR "${SDL2_INCLUDE_DIR}") - set(D2D_SYSTEM_LIBRARY "${SDL2_LIBRARY}") + set(D2D_SYSTEM_INCLUDE_DIR "${SDL2_INCLUDE_DIRS}") + set(D2D_SYSTEM_LIBRARY "${SDL2_LIBRARIES}") else(WITH_SDL) message(FATAL_ERROR "Select SYSTEM_DRIVER as 'SDL' or 'SDL2'") endif(WITH_SDL) diff --git a/src/openal/sound.c b/src/openal/sound.c index fc1e60a..73d36a4 100644 --- a/src/openal/sound.c +++ b/src/openal/sound.c @@ -14,7 +14,7 @@ # include #endif -#include // SDL_BuildAudioCVT SDL_ConvertAudio +#include "SDL.h" // SDL_BuildAudioCVT SDL_ConvertAudio #include #include // malloc #include // memcpy diff --git a/src/sdl/main.c b/src/sdl/main.c index df880c4..0b1aada 100644 --- a/src/sdl/main.c +++ b/src/sdl/main.c @@ -20,7 +20,7 @@ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include "SDL.h" #include #include #include // srand exit diff --git a/src/sdl2/main.c b/src/sdl2/main.c index 81ecaa1..fc50b90 100644 --- a/src/sdl2/main.c +++ b/src/sdl2/main.c @@ -1,4 +1,4 @@ -#include +#include "SDL.h" #include #include #include // srand exit diff --git a/src/sdlmixer/sound.c b/src/sdlmixer/sound.c index 93c1b63..8867e57 100644 --- a/src/sdlmixer/sound.c +++ b/src/sdlmixer/sound.c @@ -6,8 +6,8 @@ #include "files.h" // F_findres #include "error.h" -#include -#include +#include "SDL.h" +#include "SDL_mixer.h" #include #define TAG_MIX1 0x4d495831