# HG changeset patch # User koda # Date 1262539420 0 # Node ID 0f1403bf267aa78cd7d08d11ab0eb1eec88f39ce # Parent 7e0f88013fe8fa980a064e93ca5a0b4f558981c8 check for sdl_image and sdl_mixer versions use revision number for hedgewars version diff -r 7e0f88013fe8 -r 0f1403bf267a CMakeLists.txt --- a/CMakeLists.txt Sun Jan 03 15:40:41 2010 +0000 +++ b/CMakeLists.txt Sun Jan 03 17:23:40 2010 +0000 @@ -6,11 +6,22 @@ cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy) +#detect subversion revision (if present) +set(version_suffix "-dev") #UNSET THIS VARIABLE AT RELEASE TIME +IF (version_suffix MATCHES "-dev" AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn) +FIND_PACKAGE(Subversion) +IF(Subversion_FOUND) + Subversion_WC_INFO(${CMAKE_HOME_DIRECTORY} Project) + MESSAGE(STATUS "Builing revision ${Project_WC_REVISION}") + set(version_suffix ".${Project_WC_REVISION}") +ENDIF(Subversion_FOUND) +ENDIF() + set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) set(CPACK_PACKAGE_VERSION_MAJOR "0") set(CPACK_PACKAGE_VERSION_MINOR "9") -set(CPACK_PACKAGE_VERSION_PATCH "13-dev") +set(CPACK_PACKAGE_VERSION_PATCH "13${version_suffix}") #forbid in-tree building #IF (${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR}) diff -r 7e0f88013fe8 -r 0f1403bf267a hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Sun Jan 03 15:40:41 2010 +0000 +++ b/hedgewars/CMakeLists.txt Sun Jan 03 17:23:40 2010 +0000 @@ -6,6 +6,25 @@ find_package(SDL_ttf) find_package(SDL_mixer) +#find which version of SDL_image and SDL_mixer we have (for IMG_Init and Mix_Init) +#if the headers are not installed, the newer apis won't be activated +find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_LIBRARY}) +file(STRINGS ${sdlmixer_h} sdlmixer_version_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+") +string(REGEX MATCH ".([0-9]+)" sdlmixer_version "${sdlmixer_version_tmp}") + +if(sdlmixer_version GREATER 9) +message(STATUS "Enabling enhanced SDL_Mixer calls") +set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn}) +endif() + +find_file(sdlimage_h SDL_image.h ${SDLIMAGE_LIBRARY}) +file(STRINGS ${sdlimage_h} sdlimage_version_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+") +string(REGEX MATCH ".([0-9]+)" sdlimage_version "${sdlimage_version_tmp}") + +if(sdlimage_version GREATER 7) +message(STATUS "Enabling enhanced SDL_Image calls") +set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn}) +endif() #SOURCE AND PROGRAMS SECTION set(fpc_tryexe fpc) diff -r 7e0f88013fe8 -r 0f1403bf267a hedgewars/options.inc --- a/hedgewars/options.inc Sun Jan 03 15:40:41 2010 +0000 +++ b/hedgewars/options.inc Sun Jan 03 17:23:40 2010 +0000 @@ -27,6 +27,7 @@ {$DEFINE GLES11} {$DEFINE TOUCHINPUT} {$DEFINE LOWRES} + {$UNDEF SDL_IMAGE_NEWER} {$ENDIF} {$IFNDEF DARWIN} diff -r 7e0f88013fe8 -r 0f1403bf267a hedgewars/uSound.pas --- a/hedgewars/uSound.pas Sun Jan 03 15:40:41 2010 +0000 +++ b/hedgewars/uSound.pas Sun Jan 03 17:23:40 2010 +0000 @@ -113,10 +113,12 @@ begin if not isSoundEnabled then exit; +{$IFDEF SDL_MIXER_NEWER} WriteToConsole('Init SDL_mixer... '); SDLTry(Mix_Init(MIX_INIT_OGG) <> 0, true); WriteLnToConsole(msgOK); - +{$ENDIF} + defVoicepack:= AskForVoicepack('Default'); for i:= Low(TSound) to High(TSound) do @@ -142,8 +144,9 @@ else WriteLnToConsole(msgOK) end; - +{$IFDEF SDL_MIXER_NEWER} Mix_Quit(); +{$ENDIF} end; procedure PlaySound(snd: TSound; infinite: boolean; voicepack: PVoicepack); diff -r 7e0f88013fe8 -r 0f1403bf267a hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sun Jan 03 15:40:41 2010 +0000 +++ b/hedgewars/uStore.pas Sun Jan 03 17:23:40 2010 +0000 @@ -353,8 +353,7 @@ {$ENDIF} AddProgress; -{$IFNDEF IPHONEOS} - // remove this ifndef when updating sdl_image +{$IFDEF SDL_IMAGE_NEWER} IMG_Quit(); {$ENDIF} end; @@ -1170,8 +1169,7 @@ begin if Step = 0 then begin - {$IFNDEF IPHONEOS} - // remove this ifndef when updating sdl_image + {$IFDEF SDL_IMAGE_NEWER} WriteToConsole('Init SDL_image... '); SDLTry(IMG_Init(IMG_INIT_PNG) <> 0, true); WriteLnToConsole(msgOK);