--- a/CMakeLists.txt Fri Apr 29 02:42:46 2011 +0200
+++ b/CMakeLists.txt Fri Apr 29 03:31:50 2011 +0200
@@ -46,6 +46,7 @@
IF(NOT BUILD_ENGINE_LIBRARY)
SET(BUILD_ENGINE_LIBRARY 0)
ENDIF(NOT BUILD_ENGINE_LIBRARY)
+set(target_dir "bin")
if(APPLE)
@@ -59,57 +60,65 @@
set(target_dir ".")
#what system are we building for
- set(minimum_macosx $ENV{MACOSX_DEPLOYMENT_TARGET})
+ set(minimum_macosx_version $ENV{MACOSX_DEPLOYMENT_TARGET})
#detect on which system are we
EXEC_PROGRAM("/usr/bin/sw_vers" ARGS "-productVersion" OUTPUT_VARIABLE current_macosx_version)
STRING(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" current_macosx_version ${current_macosx_version})
#if nothing is set, we deploy only for the current system
- if(NOT minimum_macosx)
- set(minimum_macosx ${current_macosx_version})
+ if(NOT minimum_macosx_version)
+ set(minimum_macosx_version ${current_macosx_version})
endif()
- if (minimum_macosx LESS "10.4")
- set(FATAL "Hedgewars is not supported for pre-10.4 systems")
+ #who uses them anyway?
+ if (minimum_macosx_version LESS "10.4")
+ message(FATAL_ERROR "Hedgewars is not supported on Mac OS X pre-10.4")
endif()
#this variable needs to be set for frapascal universal binary
if(NOT CMAKE_OSX_ARCHITECTURES)
- if(current_macosx_version MATCHES "10.6")
- set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
+ if(current_macosx_version LESS "10.6")
+ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "powerpc*")
+ set(CMAKE_OSX_ARCHITECTURES "ppc7400")
+ else()
+ set(CMAKE_OSX_ARCHITECTURES "i386")
+ endif()
else()
- set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")
+ set(CMAKE_OSX_ARCHITECTURES "x86_64")
endif()
endif()
- message(STATUS "Build system: Mac OS X ${current_macosx_version} - Target ${minimum_macosx} ${CMAKE_OSX_ARCHITECTURES}")
-
#be sure to select ppc-compatible toolchains just in case
- if(NOT minimum_macosx MATCHES "10.6")
+ if(minimum_macosx_version LESS "10.6")
set(CMAKE_C_COMPILER "gcc-4.0")
set(CMAKE_CXX_COMPILER "g++-4.0")
endif()
- if(minimum_macosx MATCHES "10.4")
+ if(minimum_macosx_version MATCHES "10.4")
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
+ #workaround for http://playcontrol.net/ewing/jibberjabber/big_behind-the-scenes_chang.html#SDL_mixer (Update 2)
if(current_macosx_version MATCHES "10.4")
find_package(SDL_mixer REQUIRED)
set(pascal_compiler_flags_cmn "-k-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg" "-k-dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod" ${pascal_compiler_flags_cmn})
set(CMAKE_C_FLAGS "-dylib_file @loader_path/Frameworks/smpeg.framework/Versions/A/smpeg:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/smpeg.framework/Versions/A/smpeg -dylib_file @loader_path/Frameworks/mikmod.framework/Versions/A/mikmod:${SDLMIXER_LIBRARY}/Versions/A/Frameworks/mikmod.framework/Versions/A/mikmod")
endif()
else()
- set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${minimum_macosx}.sdk/")
+ STRING(REGEX REPLACE "([0-9]+.[0-9]+).[0-9]+" "\\1" sdk_version ${minimum_macosx_version})
+ set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX${sdk_version}.sdk/")
endif()
- #1.set deployment target; 2.link with libsdlmain.a (when building an executable); 3.link with liblua.a (which requires readline)
- set(pascal_compiler_flags_cmn "-k-macosx_version_min" "-k${minimum_macosx}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_compiler_flags_cmn})
+ #set deployment target
+ set(pascal_compiler_flags_cmn "-k-macosx_version_min" "-k${minimum_macosx_version}" "-XR${CMAKE_OSX_SYSROOT}" ${pascal_compiler_flags_cmn})
+ #link with liblua.a (which requires readline)
+ set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_compiler_flags_cmn})
+ #link with libsdlmain.a (when building an executable)
if(NOT BUILD_ENGINE_LIBRARY)
set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/libSDLmain.a" ${pascal_compiler_flags_cmn})
endif()
- set(pascal_compiler_flags_cmn "-k${CMAKE_BINARY_DIR}/bin/liblua.a" "-k-lreadline" ${pascal_compiler_flags_cmn})
-else(APPLE)
- set(target_dir "bin")
+
+ message(STATUS "Build system: Mac OS X ${current_macosx_version} with GCC:${CMAKE_C_COMPILER}")
+ message(STATUS "Target system: Mac OS X ${minimum_macosx_version} for architecture(s):${CMAKE_OSX_ARCHITECTURES}")
endif(APPLE)