DEADSOFTWARE

sdl2: fix building with sdl2 on linux
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 1 Apr 2020 15:36:20 +0000 (18:36 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Wed, 1 Apr 2020 15:36:20 +0000 (18:36 +0300)
src/CMakeLists.txt
src/openal/sound.c
src/sdl/main.c
src/sdl2/main.c
src/sdlmixer/sound.c

index f3d8ed042eef4a092488c30801ce849511a83a5b..e496d8cf2f59118da7f79497d79473752d4e71e4 100644 (file)
@@ -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)
index fc1e60ab43b37acfeccea68b4c86a26eef80e3a4..73d36a42968a46e87f3548c900257a0dd84635a8 100644 (file)
@@ -14,7 +14,7 @@
 #  include <AL/alc.h>
 #endif
 
-#include <SDL.h> // SDL_BuildAudioCVT SDL_ConvertAudio
+#include "SDL.h" // SDL_BuildAudioCVT SDL_ConvertAudio
 #include <assert.h>
 #include <stdlib.h> // malloc
 #include <string.h> // memcpy
index df880c432e3a2b9cf8e447faf0adfd02e6872082..0b1aada10b2c8886093651c5401a8fbab2eca3e9 100644 (file)
@@ -20,7 +20,7 @@
    51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */
 
-#include <SDL.h>
+#include "SDL.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h> // srand exit
index 81ecaa173cb0574bae6f6808724a8f2e322db8d2..fc50b90823a2899c36767640429e7cd64334f0c1 100644 (file)
@@ -1,4 +1,4 @@
-#include <SDL.h>
+#include "SDL.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h> // srand exit
index 93c1b6350f3cd9ae3935a1c4dde5071fcf2391e8..8867e57057cfd62460e526c27a2132949e610549 100644 (file)
@@ -6,8 +6,8 @@
 #include "files.h" // F_findres
 #include "error.h"
 
-#include <SDL.h>
-#include <SDL_mixer.h>
+#include "SDL.h"
+#include "SDL_mixer.h"
 #include <assert.h>
 
 #define TAG_MIX1 0x4d495831