cmake_modules/FindSDL_Extras.cmake
author koda
Fri, 21 Sep 2012 01:07:56 +0200
changeset 7698 cd73d1ddde28
parent 6613 c7bf3b7c49dd
child 7707 e7e7b2082f44
permissions -rw-r--r--
nicer debug log visuals on ios
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5019
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
     1
#if the headers are not installed, the newer apis won't be activated
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
     2
6613
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
     3
##find which version of SDL we are building against
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
     4
#find_file(sdl_h SDL_version.h ${SDL_INCLUDE_DIR})
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
     5
#if(sdl_h)
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
     6
#    file(STRINGS ${sdl_h} sdl_majorversion_tmp REGEX "SDL_MAJOR_VERSION[\t' ']+[0-9]+")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
     7
#    file(STRINGS ${sdl_h} sdl_minorversion_tmp REGEX "SDL_MINOR_VERSION[\t' ']+[0-9]+")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
     8
#    file(STRINGS ${sdl_h} sdl_patchversion_tmp REGEX "SDL_PATCHLEVEL[\t' ']+[0-9]+")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
     9
#    string(REGEX MATCH ".([0-9]+)" sdl_majorversion "${sdl_majorversion_tmp}")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    10
#    string(REGEX MATCH ".([0-9]+)" sdl_minorversion "${sdl_minorversion_tmp}")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    11
#    string(REGEX MATCH ".([0-9]+)" sdl_patchversion "${sdl_patchversion_tmp}")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    12
#    math(EXPR sdl_version "${sdl_majorversion}*10000 + ${sdl_minorversion}*100 + ${sdl_patchversion}")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    13
#
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    14
#    if(NOT (sdl_version LESS "010300"))
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    15
#        message(STATUS "Enabling SDL-1.3+ calls")
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    16
#        set(pascal_compiler_flags_cmn "-dSDL13" ${pascal_compiler_flags_cmn})
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    17
#    endif()
c7bf3b7c49dd disabling the discovery of SDL13+ on desktop. SDL13 has become SDL2 with a completely different ABI and will require a new FindSDL2 module for Cmake to be found; for current sdl development installations, hedgewars will either use the compatibility layer (present in sdl1.3 but not in sdl2) or just fail to build (in case sdl2 is installed but sdl1.2.* is not). whew
koda
parents: 5019
diff changeset
    18
#endif()
5019
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    19
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    20
#find which version of SDL_mixer we have (for Mix_Init)
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    21
find_file(sdlmixer_h SDL_mixer.h ${SDLMIXER_INCLUDE_DIR})
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    22
if(sdlmixer_h)
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    23
    file(STRINGS ${sdlmixer_h} sdlmixer_majorversion_tmp REGEX "SDL_MIXER_MAJOR_VERSION[\t' ']+[0-9]+")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    24
    file(STRINGS ${sdlmixer_h} sdlmixer_minorversion_tmp REGEX "SDL_MIXER_MINOR_VERSION[\t' ']+[0-9]+")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    25
    file(STRINGS ${sdlmixer_h} sdlmixer_patchversion_tmp REGEX "SDL_MIXER_PATCHLEVEL[\t' ']+[0-9]+")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    26
    string(REGEX MATCH ".([0-9]+)" sdlmixer_majorversion "${sdlmixer_majorversion_tmp}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    27
    string(REGEX MATCH ".([0-9]+)" sdlmixer_minorversion "${sdlmixer_minorversion_tmp}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    28
    string(REGEX MATCH ".([0-9]+)" sdlmixer_patchversion "${sdlmixer_patchversion_tmp}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    29
    math(EXPR sdlmixer_version "${sdlmixer_majorversion}*10000 + ${sdlmixer_minorversion}*100 + ${sdlmixer_patchversion}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    30
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    31
    if(sdlmixer_version GREATER "10209")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    32
        message(STATUS "Enabling enhanced SDL_Mixer calls")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    33
        set(pascal_compiler_flags_cmn "-dSDL_MIXER_NEWER" ${pascal_compiler_flags_cmn})
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    34
    endif()
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    35
endif()
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    36
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    37
#find which version of SDL_image we have (for IMG_Init)
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    38
find_file(sdlimage_h SDL_image.h ${SDLIMAGE_INCLUDE_DIR})
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    39
if(sdlimage_h)
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    40
    file(STRINGS ${sdlimage_h} sdlimage_majorversion_tmp REGEX "SDL_IMAGE_MAJOR_VERSION[\t' ']+[0-9]+")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    41
    file(STRINGS ${sdlimage_h} sdlimage_minorversion_tmp REGEX "SDL_IMAGE_MINOR_VERSION[\t' ']+[0-9]+")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    42
    file(STRINGS ${sdlimage_h} sdlimage_patchversion_tmp REGEX "SDL_IMAGE_PATCHLEVEL[\t' ']+[0-9]+")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    43
    string(REGEX MATCH ".([0-9]+)" sdlimage_majorversion "${sdlimage_majorversion_tmp}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    44
    string(REGEX MATCH ".([0-9]+)" sdlimage_minorversion "${sdlimage_minorversion_tmp}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    45
    string(REGEX MATCH ".([0-9]+)" sdlimage_patchversion "${sdlimage_patchversion_tmp}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    46
    math(EXPR sdlimage_version "${sdlimage_majorversion}*10000 + ${sdlimage_minorversion}*100 + ${sdlimage_patchversion}")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    47
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    48
    if(sdlimage_version GREATER "010207")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    49
        message(STATUS "Enabling enhanced SDL_Image calls")
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    50
        set(pascal_compiler_flags_cmn "-dSDL_IMAGE_NEWER" ${pascal_compiler_flags_cmn})
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    51
    endif()
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    52
endif()
e38d1720a0ff allows for building hedgewars with SDL-1.3
koda
parents:
diff changeset
    53