cmake tweaks. make pas2c build with sdl2 (keycodes or something still missing) sdl2transition
authorsheepluva
Wed, 11 Nov 2015 23:29:49 +0100
branchsdl2transition
changeset 11359 c481d087f653
parent 11358 a91c4c4fd85c
child 11360 ea5edb4e5245
cmake tweaks. make pas2c build with sdl2 (keycodes or something still missing)
QTfrontend/CMakeLists.txt
hedgewars/SDLh.pas
hedgewars/sdlmain/CMakeLists.txt
hedgewars/uInputHandler.pas
project_files/hwc/CMakeLists.txt
project_files/hwc/rtl/fpcrtl.h
--- a/QTfrontend/CMakeLists.txt	Wed Nov 11 21:59:06 2015 +0100
+++ b/QTfrontend/CMakeLists.txt	Wed Nov 11 23:29:49 2015 +0100
@@ -212,8 +212,8 @@
     )
     
 if(WIN32 AND NOT UNIX)
-    if(NOT SDL_LIBRARY)
-        list(APPEND HW_LINK_LIBS SDL)
+    if(NOT SDL2_LIBRARY)
+        list(APPEND HW_LINK_LIBS SDL2)
     endif()
 
     list(APPEND HW_LINK_LIBS
--- a/hedgewars/SDLh.pas	Wed Nov 11 21:59:06 2015 +0100
+++ b/hedgewars/SDLh.pas	Wed Nov 11 23:29:49 2015 +0100
@@ -1115,7 +1115,7 @@
 function  SDL_ShowCursor(toggle: LongInt): LongInt; cdecl; external SDLLibName;
 procedure SDL_WarpMouse(x, y: Word); inline;
 
-function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName  name 'SDL_GetKeyboardState';
+function  SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
 
 procedure SDL_WM_SetIcon(icon: PSDL_Surface; mask : Byte); cdecl; external SDLLibName;
 procedure SDL_WM_SetCaption(title: PChar; icon: PChar); cdecl; external SDLLibName;
--- a/hedgewars/sdlmain/CMakeLists.txt	Wed Nov 11 21:59:06 2015 +0100
+++ b/hedgewars/sdlmain/CMakeLists.txt	Wed Nov 11 23:29:49 2015 +0100
@@ -1,6 +1,6 @@
-find_package(SDL REQUIRED)
+find_package(SDL2 REQUIRED)
 
-include_directories(${SDL_INCLUDE_DIR})
+include_directories(${SDL2_INCLUDE_DIR})
 
 add_library (SDLmain STATIC SDLMain.m)
 
--- a/hedgewars/uInputHandler.pas	Wed Nov 11 21:59:06 2015 +0100
+++ b/hedgewars/uInputHandler.pas	Wed Nov 11 23:29:49 2015 +0100
@@ -326,7 +326,7 @@
 
 
     // get the size of keyboard array
-    SDL_GetKeyState(@k);
+    SDL_GetKeyboardState(@k);
 
     // Controller(s)
     for j:= 0 to Pred(ControllerNumControllers) do
@@ -462,7 +462,7 @@
 var
     k: LongInt;
 begin
-    SDL_GetKeyState(@k);
+    SDL_GetKeyboardState(@k);
     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
     ProcessKey(k +  axis*2, value > 20000);
     ProcessKey(k + (axis*2)+1, value < -20000);
@@ -472,7 +472,7 @@
 var
     k: LongInt;
 begin
-    SDL_GetKeyState(@k);
+    SDL_GetKeyboardState(@k);
     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 0, (value and SDL_HAT_UP)   <> 0);
     ProcessKey(k +  ControllerNumAxes[joy]*2 + hat*4 + 1, (value and SDL_HAT_RIGHT)<> 0);
@@ -484,7 +484,7 @@
 var
     k: LongInt;
 begin
-    SDL_GetKeyState(@k);
+    SDL_GetKeyboardState(@k);
     k:= k + joy * (ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + ControllerNumButtons[joy]*2);
     ProcessKey(k +  ControllerNumAxes[joy]*2 + ControllerNumHats[joy]*4 + button, pressed);
 end;
--- a/project_files/hwc/CMakeLists.txt	Wed Nov 11 21:59:06 2015 +0100
+++ b/project_files/hwc/CMakeLists.txt	Wed Nov 11 23:29:49 2015 +0100
@@ -1,11 +1,11 @@
 #the usual set of dependencies
 find_package(OpenGL REQUIRED)
 find_package(GLEW REQUIRED)
-find_package(SDL REQUIRED)
-find_package(SDL_mixer REQUIRED)
-find_package(SDL_net REQUIRED)
-find_package(SDL_image REQUIRED)
-find_package(SDL_ttf REQUIRED)
+find_package(SDL2 REQUIRED)
+find_package(SDL2_mixer REQUIRED)
+find_package(SDL2_net REQUIRED)
+find_package(SDL2_image REQUIRED)
+find_package(SDL2_ttf REQUIRED)
 
 #compile our rtl implementation
 include_directories(${GLEW_INCLUDE_DIR})
@@ -13,7 +13,7 @@
 include_directories(${PHYSFS_INCLUDE_DIR})
 include_directories(${PHYSLAYER_INCLUDE_DIR})
 include_directories(${LUA_INCLUDE_DIR})
-include_directories(${SDL_INCLUDE_DIR})
+include_directories(${SDL2_INCLUDE_DIR})
 add_subdirectory(rtl)
 
 # convert list into pascal array
@@ -83,11 +83,11 @@
 target_link_libraries(hwengine  fpcrtl
                                 ${LUA_LIBRARY}
                                 ${OPENGL_LIBRARY}
-                                ${SDL_LIBRARY}
-                                ${SDLMIXER_LIBRARY}
-                                ${SDLNET_LIBRARY}
-                                ${SDLIMAGE_LIBRARY}
-                                ${SDLTTF_LIBRARY}
+                                ${SDL2_LIBRARY}
+                                ${SDL2_MIXER_LIBRARY}
+                                ${SDL2_NET_LIBRARY}
+                                ${SDL2_IMAGE_LIBRARY}
+                                ${SDL2_TTF_LIBRARY}
                                 ${GLEW_LIBRARY}
                                 physfs
                                 physlayer
--- a/project_files/hwc/rtl/fpcrtl.h	Wed Nov 11 21:59:06 2015 +0100
+++ b/project_files/hwc/rtl/fpcrtl.h	Wed Nov 11 23:29:49 2015 +0100
@@ -110,6 +110,7 @@
 #define sdlh_Mix_VolumeMusic                stub_Mix_VolumeMusic
 #endif
 
+#define sdlh_SDL_free                       SDL_free
 #define sdlh_SDL_ConvertSurface             SDL_ConvertSurface
 #define sdlh_SDL_CreateRGBSurface           SDL_CreateRGBSurface
 #define sdlh_SDL_CreateThread               SDL_CreateThread
@@ -120,7 +121,7 @@
 #define sdlh_SDL_FreeSurface                SDL_FreeSurface
 #define sdlh_SDL_GetError                   SDL_GetError
 #define sdlh_SDL_GetKeyName                 SDL_GetKeyName
-#define sdlh_SDL_GetKeyState                SDL_GetKeyState
+#define sdlh_SDL_GetKeyboardState           SDL_GetKeyboardState
 #define sdlh_SDL_GetMouseState              SDL_GetMouseState
 #define sdlh_SDL_GetRGBA                    SDL_GetRGBA
 #define sdlh_SDL_GetTicks                   SDL_GetTicks
@@ -148,8 +149,8 @@
 #define sdlh_SDL_WaitThread                 SDL_WaitThread
 #define sdlh_SDL_CreateMutex                SDL_CreateMutex
 #define sdlh_SDL_DestroyMutex               SDL_DestroyMutex
-#define SDL_LockMutex                       SDL_mutexP
-#define SDL_UnlockMutex                     SDL_mutexV
+#define sdlh_SDL_LockMutex                  SDL_LockMutex
+#define sdlh_SDL_UnlockMutex                SDL_UnlockMutex
 #ifndef EMSCRIPTEN
 #define sdlh_SDL_ShowCursor                 SDL_ShowCursor
 #else