some updates to the crossbuild system for mac
most notably it chooses a single default architecture with more precision
--- 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)
--- a/QTfrontend/CMakeLists.txt Fri Apr 29 02:42:46 2011 +0200
+++ b/QTfrontend/CMakeLists.txt Fri Apr 29 03:31:50 2011 +0200
@@ -36,6 +36,10 @@
else()
set(HEDGEWARS_DATADIR ${CMAKE_INSTALL_PREFIX}/share/)
endif()
+ #only the cocoa version of qt supports building 64 bit apps
+ if(APPLE AND (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64*") AND (NOT QT_MAC_USE_COCOA))
+ message(FATAL_ERROR "Building the 64 bit version of Hedgewars *requires* the Cocoa variant of QT on Mac OS X")
+ endif()
endif()
--- a/hedgewars/CMakeLists.txt Fri Apr 29 02:42:46 2011 +0200
+++ b/hedgewars/CMakeLists.txt Fri Apr 29 03:31:50 2011 +0200
@@ -10,7 +10,6 @@
configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
#SOURCE AND PROGRAMS SECTION
-set(fpc_tryexe fpc)
set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
set(engine_output_name "hwengine")
@@ -81,16 +80,16 @@
endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
# due to compiling/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail
- if(APPLE AND current_macosx_version MATCHES "10.6")
+ if(APPLE AND current_macosx_version GREATER "10.5")
set(pascal_compiler_flags_cmn "-k-no_order_inits" ${pascal_compiler_flags_cmn})
- endif(APPLE AND current_macosx_version MATCHES "10.6")
+ endif()
if (APPLE)
set(engine_output_name "hwengine.dylib")
endif (APPLE)
endif(BUILD_ENGINE_LIBRARY)
-find_program(fpc_executable ${fpc_tryexe})
+find_program(fpc_executable fpc)
if(fpc_executable)
exec_program(${fpc_executable} ARGS "-iV" OUTPUT_VARIABLE fpc_output)
@@ -134,7 +133,7 @@
if(fpc_ver LESS "020200")
message(FATAL_ERROR "Minimum required version of FreePascal is 2.2.0")
elseif(APPLE AND x86_64_build AND (fpc_ver LESS "020400"))
- message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications on Mac OS X!")
+ message(FATAL_ERROR "Minimum required version of FreePascal is 2.4.0 for building 64 bit applications on Mac OS X")
endif()
else()
message(FATAL_ERROR "No Pascal compiler found!")
--- a/share/Info.plist.in Fri Apr 29 02:42:46 2011 +0200
+++ b/share/Info.plist.in Fri Apr 29 03:31:50 2011 +0200
@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>LSApplicationCategoryType</key>
+ <string>public.app-category.strategy-games</string>
<key>CFBundleName</key>
<string>Hedgewars</string>
<key>CFBundleExecutable</key>
@@ -21,7 +23,7 @@
<key>CFBundleShortVersionString</key>
<string>${HEDGEWARS_VERSION}</string>
<key>NSHumanReadableCopyright</key>
- <string>© 2004-2011 Hedgewars Project</string>
+ <string>Copyright © 2004-2011, Hedgewars Project</string>
<key>NSAppleScriptEnabled</key>
<false/>
<key>LSRequiresNativeExecution</key>
@@ -45,7 +47,5 @@
<string>${minimum_macosx}</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
- <key>LSApplicationCategoryType</key>
- <string>public.app-category.strategy-games</string>
</dict>
</plist>
--- a/tools/CMakeLists.txt Fri Apr 29 02:42:46 2011 +0200
+++ b/tools/CMakeLists.txt Fri Apr 29 03:31:50 2011 +0200
@@ -17,6 +17,12 @@
if(NOT NOAUTOUPDATE)
#needed for SPARKLE_FOUND variable
find_package(Sparkle QUIET)
+ #needed because the 'if' clause in the script prints silly policy warnings
+ if(${SPARKLE_FOUND})
+ set(SPARKLE_FOUND 1)
+ else()
+ set(SPARKLE_FOUND 0)
+ endif()
endif()
#use the associated tool from the libraries we've selected