cmake_modules/platform.cmake
branch0.9.20
changeset 9858 343d12172070
parent 9673 5be4de0eb4b0
child 9860 d419ff107e15
equal deleted inserted replaced
9856:891eb7fcc26c 9858:343d12172070
    29     #if nothing is set, we deploy only for the current system
    29     #if nothing is set, we deploy only for the current system
    30     if(NOT minimum_macosx_version)
    30     if(NOT minimum_macosx_version)
    31         set(minimum_macosx_version ${current_macosx_version})
    31         set(minimum_macosx_version ${current_macosx_version})
    32     endif()
    32     endif()
    33 
    33 
    34     #lower systems don't have enough processing power anyway
    34     #10.3 systems don't have enough processing power anyway
    35     if (minimum_macosx_version VERSION_LESS "10.4")
    35     #10.4 does not have @rpath support (which SDL uses)
    36         message(FATAL_ERROR "Hedgewars is not supported on Mac OS X pre-10.4")
    36     if(minimum_macosx_version VERSION_LESS "10.5")
    37     endif()
    37         message(FATAL_ERROR "Hedgewars is not supported on your version of Mac OS X")
    38 
       
    39     #workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
       
    40     if(current_macosx_version VERSION_EQUAL "10.4")
       
    41         find_package(SDL_mixer REQUIRED)
       
    42         set(DYLIB_SMPEG "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg")
       
    43         set(DYLIB_MIKMOD "-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
       
    44         add_flag_append(CMAKE_C_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
       
    45         add_flag_append(CMAKE_CXX_FLAGS "${DYLIB_SMPEG} ${DYLIB_MIKMOD}")
       
    46         add_flag_append(CMAKE_Pascal_FLAGS "-k${DYLIB_SMPEG} -k${DYLIB_MIKMOD}")
       
    47     endif()
    38     endif()
    48 
    39 
    49     if(NOT CMAKE_OSX_ARCHITECTURES)
    40     if(NOT CMAKE_OSX_ARCHITECTURES)
    50         if(current_macosx_version VERSION_LESS "10.6")
    41         if(current_macosx_version VERSION_LESS "10.6")
    51             #SDL is only 32 bit on lower OS
    42             #SDL is only 32 bit on older OS version
    52             if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*")
    43             if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*")
    53                 set(CMAKE_OSX_ARCHITECTURES "ppc7400")
    44                 set(CMAKE_OSX_ARCHITECTURES "ppc7400")
    54             else()
    45             else()
    55                 set(CMAKE_OSX_ARCHITECTURES "i386")
    46                 set(CMAKE_OSX_ARCHITECTURES "i386")
    56             endif()
    47             endif()
    81     endif()
    72     endif()
    82 
    73 
    83     #CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on
    74     #CMAKE_OSX_SYSROOT is set at the system version we are supposed to build on
    84     #we need to provide the correct one when host and target differ
    75     #we need to provide the correct one when host and target differ
    85     if(NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version})
    76     if(NOT ${minimum_macosx_version} VERSION_EQUAL ${current_macosx_version})
    86         if(minimum_macosx_version VERSION_EQUAL "10.4")
    77         string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version})
    87             set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
    78         set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
    88             set(CMAKE_C_COMPILER "/Developer/usr/bin/gcc-4.0")
       
    89             set(CMAKE_CXX_COMPILER "/Developer/usr/bin/g++-4.0")
       
    90         else()
       
    91             string(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version})
       
    92             set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
       
    93         endif()
       
    94         add_flag_append(CMAKE_Pascal_FLAGS "-XR${CMAKE_OSX_SYSROOT}")
    79         add_flag_append(CMAKE_Pascal_FLAGS "-XR${CMAKE_OSX_SYSROOT}")
    95         add_flag_append(CMAKE_Pascal_FLAGS "-k-macosx_version_min -k${minimum_macosx_version}")
    80         add_flag_append(CMAKE_Pascal_FLAGS "-k-macosx_version_min -k${minimum_macosx_version}")
    96     endif()
    81     endif()
    97 
    82 
    98     #add user framework directory
    83     #add user framework directory