updated build files for macosx and optimization system
authorkoda
Fri, 06 Nov 2009 18:59:43 +0000
changeset 2606 ed687a8d081f
parent 2605 a40a7c90ffd8
child 2607 dbeaba78e676
updated build files for macosx and optimization system
CMakeLists.txt
QTfrontend/M3InstallController.h
QTfrontend/M3InstallController.m
cmake_modules/FindOggVorbis.cmake
gameServer/CMakeLists.txt
hedgewars/CMakeLists.txt
hedgewars/SDLh.pas
hedgewars/uKeys.pas
--- a/CMakeLists.txt	Fri Nov 06 18:24:55 2009 +0000
+++ b/CMakeLists.txt	Fri Nov 06 18:59:43 2009 +0000
@@ -12,43 +12,79 @@
 set(CPACK_PACKAGE_VERSION_MINOR "9")
 set(CPACK_PACKAGE_VERSION_PATCH "13-dev")
 
-set(universal_build false)
 
 if(APPLE)
-set(bundle_name Hedgewars.app)
-set(CMAKE_INSTALL_PREFIX ${bundle_name}/Contents/MacOS/) 
-set(DATA_INSTALL_DIR "../Resources/")
-set(target_dir ".")
-
-if(UNIVERSAL)
-	set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")
+	set(CMAKE_FIND_FRAMEWORK "FIRST")
 	set(universal_build true)
-	message(STATUS "Building a Universal Application")
-else(UNIVERSAL)
-	if(UNIVERSAL64)
-		set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400;x86_64")
-		set(universal_build true)
-		message(STATUS "Building a Universal 64 bits Application")
-	endif(UNIVERSAL64)
-endif(UNIVERSAL)
 
+	#paths for creating the bundle
+	set(bundle_name Hedgewars.app)
+	set(CMAKE_INSTALL_PREFIX ${bundle_name}/Contents/MacOS/) 
+	set(DATA_INSTALL_DIR "../Resources/")
+	set(target_dir ".")
+	
+	#build architecture / os version
+	set(MacVersion $ENV{MACOSX_DEPLOYMENT_TARGET})
+	if(MacVersion MATCHES "10.4")
+		message(STATUS "Target: Mac OS X 10.4 i386/ppc")	
+		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk/")
+		set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")		
+	endif()
+	if(MacVersion MATCHES "10.5")
+		message(STATUS "Target: Mac OS X 10.5 i386/ppc")
+		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk/")
+		set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")		
+	endif()
+	if(MacVersion MATCHES "10.6")
+		message(STATUS "Target: Mac OS X 10.6 i386/ppc/x86_64")	
+		set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk/")	
+		set(CMAKE_OSX_ARCHITECTURES "i386;x86_64;ppc7400")
+	endif()
+	#else use the default sysroot with default archs
 else(APPLE)
-set(target_dir "bin")
+	set(target_dir "bin")
 endif(APPLE)
 
 
-if(NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "Release")
-	set(CMAKE_BUILD_TYPE "Release")
-	set(OPTIMIZATIONS true)
-	message(STATUS "Building Release")
+#this snippet sets "Release" mode by default
+if (NOT CMAKE_BUILD_TYPE)
+	set (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Choose the type of build, options are: None Debug Release." FORCE)
+endif (NOT CMAKE_BUILD_TYPE)
+
+if(CMAKE_BUILD_TYPE MATCHES RELEASE OR CMAKE_BUILD_TYPE MATCHES "Release")
+	message(STATUS "Building Release")	
+	set(Optz true)
 else()
-	set(CMAKE_BUILD_TYPE "Debug")
-	set(OPTIMIZATIONS false)
+	message(STATUS "Building Debug")	
 	set(CMAKE_VERBOSE_MAKEFILE true)
-	message(STATUS "Building Debug")	
+	set(Optz false)
 endif()
 
 
+#set default flags values for all the project
+set(CMAKE_C_FLAGS "-Wall -pipe")
+set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer")
+set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG")
+set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
+set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
+set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+
+set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi")
+
+if(Optz)
+	set(pascal_compiler_flags_cmn "-O2" "-Xs" "-Nu" "-Si" ${pascal_compiler_flags_cmn})
+	set(haskell_compiler_flags_cmn "-w" "-O2")
+	if(APPLE AND NOT universal_build)
+		set(CMAKE_C_FLAGS_RELEASE "-fPIC -msse2 ${CMAKE_C_FLAGS_RELEASE}")
+		set(CMAKE_CXX_FLAGS_RELEASE "-fPIC -msse2 ${CMAKE_CXX_FLAGS_RELEASE}")
+		set(pascal_compiler_flags_cmn "-fPIC" "-CfSSE2" ${pascal_compiler_flags_cmn}) #-CF7400 for ppc
+	endif()
+else(Optz)
+	set(pascal_compiler_flags_cmn "-O-" "-gl" "-dDEBUGFILE" "-pg" "-vv" ${pascal_compiler_flags_cmn})
+	set(haskell_compiler_flags_cmn "-Wall" "-debug" "-dcore-lint")
+endif(Optz)
+
+
 if(DEFINED DATA_INSTALL_DIR)
 	set(SHAREPATH ${DATA_INSTALL_DIR}/hedgewars/)
 else(DEFINED DATA_INSTALL_DIR)
@@ -66,17 +102,6 @@
 	set(HAVE_NETSERVER false)
 endif(WITH_SERVER)
 
-#set default flags values for all the project
-set(CMAKE_C_FLAGS "-Wall -pipe")
-set(CMAKE_C_FLAGS_RELEASE "-w -O2 -fomit-frame-pointer")
-set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG")
-if(APPLE AND NOT universal_build)
-	set(CMAKE_C_FLAGS_RELEASE "-msse2 ${CMAKE_C_FLAGS_RELEASE}")
-endif()
-set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
-set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
-set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
-
 
 add_subdirectory(bin)
 #add_subdirectory(openalbridge)
--- a/QTfrontend/M3InstallController.h	Fri Nov 06 18:24:55 2009 +0000
+++ b/QTfrontend/M3InstallController.h	Fri Nov 06 18:59:43 2009 +0000
@@ -29,9 +29,9 @@
  *****************************************************************/
 
 #import <Cocoa/Cocoa.h>
+#import <AvailabilityMacros.h>
 
-#include <AvailabilityMacros.h>
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+//#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
 #if __LP64__ || NS_BUILD_32_LIKE_64
 typedef long NSInteger;
 typedef unsigned long NSUInteger;
@@ -39,7 +39,7 @@
 typedef int NSInteger;
 typedef unsigned int NSUInteger;
 #endif
-#endif
+//#endif
 
 
 @interface M3InstallController : NSObject {
--- a/QTfrontend/M3InstallController.m	Fri Nov 06 18:24:55 2009 +0000
+++ b/QTfrontend/M3InstallController.m	Fri Nov 06 18:59:43 2009 +0000
@@ -32,7 +32,6 @@
 #import "NSWorkspace_RBAdditions.h"
 
 #import <Foundation/Foundation.h>
-#import <Foundation/NSObjCRuntime.h>
 
 @implementation M3InstallController
 
--- a/cmake_modules/FindOggVorbis.cmake	Fri Nov 06 18:24:55 2009 +0000
+++ b/cmake_modules/FindOggVorbis.cmake	Fri Nov 06 18:59:43 2009 +0000
@@ -19,9 +19,7 @@
 include (CheckLibraryExists)
 find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
 #  [koda] (for Hedgewars) added libraries with capital names for compatibility with Mac frameworks
-if(APPLE)
-set(CMAKE_FIND_FRAMEWORK "FIRST")
-endif(APPLE)
+
 find_library(OGG_LIBRARY NAMES ogg Ogg)
 find_library(VORBIS_LIBRARY NAMES vorbis Vorbis)
 find_library(VORBISFILE_LIBRARY NAMES vorbisfile Vorbis)
--- a/gameServer/CMakeLists.txt	Fri Nov 06 18:24:55 2009 +0000
+++ b/gameServer/CMakeLists.txt	Fri Nov 06 18:59:43 2009 +0000
@@ -30,20 +30,7 @@
 	-odir ${CMAKE_CURRENT_BINARY_DIR}
 	-hidir ${CMAKE_CURRENT_BINARY_DIR})
 
-if(OPTIMIZATIONS)
-set(ghc_flags
-	-w
-	-O2
-	${ghc_flags}
-)
-else(OPTIMIZATIONS)
-set(ghc_flags
-	-Wall
-	-debug
-	-dcore-lint
-	${ghc_flags}
-)
-endif(OPTIMIZATIONS)
+set(ghc_flags ${haskell_compiler_flags_cmn} ${ghc_flags})
 
 add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}"
 		COMMAND "${ghc_executable}"
--- a/hedgewars/CMakeLists.txt	Fri Nov 06 18:24:55 2009 +0000
+++ b/hedgewars/CMakeLists.txt	Fri Nov 06 18:59:43 2009 +0000
@@ -92,27 +92,12 @@
 endif (NOT pascal_compiler)
 
 
-#PASCAL FLAG SECTION
-set(pascal_compiler_flags ${noexecstack_flags} "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi" ${hwengine_project})
-
-if(OPTIMIZATIONS)
-	set(pascal_compiler_flags "-O2" "-Xs" "-Nu" "-Si" ${pascal_compiler_flags})
-	if(APPLE AND NOT universal_build)
-		set(pascal_compiler_flags "-fPIC" "-CfSSE2" ${pascal_compiler_flags})	#instruction set for ppc is 7400
-	endif()			
-else(OPTIMIZATIONS)
-	set(pascal_compiler_flags "-O-" "-gl" "-dDEBUGFILE" "-pg" "-vv" ${pascal_compiler_flags})
-endif(OPTIMIZATIONS)
+set(pascal_compiler_flags ${noexecstack_flags} ${pascal_compiler_flags_cmn} ${hwengine_project})
 
 if(LOWRES)
 	set(pascal_compiler_flags "-dLOWRES" ${pascal_compiler_flags} ${hwengine_project})
 endif(LOWRES)
 
-#special handling of MSVC compiler (no static linking)
-if(MSVC)
-	set(pascal_compiler_flags "-dMSVC" ${pascal_compiler_flags})
-endif(MSVC)
-
 
 #DEPENDECIES AND EXECUTABLES SECTION
 IF(APPLE)
@@ -122,6 +107,11 @@
 	set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
 	include_directories(${SDL_INCLUDE_DIR})
 	link_libraries(${SDL_LIBRARY})
+	
+	if(universal_build)
+		#apparently this variable is not exported here
+		set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")		
+	endif()
 
 	add_library (SDLmain STATIC SDLMain.m)
 	set(engine_sources SDLmain ${engine_sources})
--- a/hedgewars/SDLh.pas	Fri Nov 06 18:24:55 2009 +0000
+++ b/hedgewars/SDLh.pas	Fri Nov 06 18:59:43 2009 +0000
@@ -37,6 +37,8 @@
 
 {$IFDEF FPC}
   {$PACKRECORDS C}
+{$ELSE}
+  {$DEFINE cdecl attribute(cdecl)}
 {$ENDIF}
 
 {$IFDEF DARWIN}
--- a/hedgewars/uKeys.pas	Fri Nov 06 18:24:55 2009 +0000
+++ b/hedgewars/uKeys.pas	Fri Nov 06 18:59:43 2009 +0000
@@ -368,6 +368,10 @@
 DefaultBinds[ 96]:= 'history';
 DefaultBinds[127]:= 'rotmask';
 
+//numpad
+//DefaultBinds[265]:= '+volup';
+//DefaultBinds[256]:= '+voldown';
+
 DefaultBinds[KeyNameToCode('0')]:= '+volup';
 DefaultBinds[KeyNameToCode('9')]:= '+voldown';
 DefaultBinds[KeyNameToCode('c')]:= 'capture';
@@ -388,7 +392,7 @@
 
 procedure SetBinds(var binds: TBinds);
 begin
-CurrentBinds:= binds
+CurrentBinds:= binds;
 end;
 
 procedure SetDefaultBinds;