reviewed the build system and parts of the previous merge, performed some code cleanup hedgeroid
authorkoda
Mon, 26 Sep 2011 00:03:14 +0200
branchhedgeroid
changeset 6025 cac1d5601d7c
parent 6023 a28be05b20bc
child 6027 302408e45052
reviewed the build system and parts of the previous merge, performed some code cleanup
CMakeLists.txt
QTfrontend/CMakeLists.txt
hedgewars/CMakeLists.txt
hedgewars/SDLh.pas
hedgewars/hwLibrary.pas
hedgewars/options.inc
hedgewars/uAI.pas
hedgewars/uLand.pas
hedgewars/uStore.pas
hedgewars/uTypes.pas
--- a/CMakeLists.txt	Sun Sep 25 18:24:01 2011 +0200
+++ b/CMakeLists.txt	Mon Sep 26 00:03:14 2011 +0200
@@ -192,8 +192,10 @@
 add_subdirectory(misc/liblua)
 add_subdirectory(hedgewars)
 
-#Xeli: Should if/endif this one too?
-add_subdirectory(project_files/Android-build)
+#run cmake -DBUILD_ANDROID_PORT=1 to enable this
+if(BUILD_ANDROID_PORT)
+	add_subdirectory(project_files/Android-build)
+endif()
 
 if(NOT BUILD_ENGINE_LIBRARY)
 	add_subdirectory(bin)
@@ -267,7 +269,7 @@
 	"CMakeCache\\\\.txt$"
 #	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/libopenalbridge"
 #	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/libfreetype"
-#	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/liblua"
+	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/liblua"
 #	"^${CMAKE_CURRENT_SOURCE_DIR}/misc/libtremor"
 	"^${CMAKE_CURRENT_SOURCE_DIR}/project_files/HedgewarsMobile/"
 	"^${CMAKE_CURRENT_SOURCE_DIR}/bin/[a-z]"
--- a/QTfrontend/CMakeLists.txt	Sun Sep 25 18:24:01 2011 +0200
+++ b/QTfrontend/CMakeLists.txt	Mon Sep 26 00:03:14 2011 +0200
@@ -1,5 +1,6 @@
 # Configure for Qt4
 set(QT_MIN_VERSION "4.5.0")
+include(CheckLibraryExists)
 
 set(QT_USE_QTCORE TRUE)
 set(QT_USE_QTGUI TRUE)
--- a/hedgewars/CMakeLists.txt	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/CMakeLists.txt	Mon Sep 26 00:03:14 2011 +0200
@@ -183,8 +183,10 @@
 
 
 add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
-add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
-add_dependencies(${engine_output_name} ENGINECLEAN)
+IF(NOT APPLE)
+    add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
+    add_dependencies(${engine_output_name} ENGINECLEAN)
+ENDIF()
 
 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
 
--- a/hedgewars/SDLh.pas	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/SDLh.pas	Mon Sep 26 00:03:14 2011 +0200
@@ -83,19 +83,11 @@
     SDL_ImageLibName = 'SDL_image';
     SDL_NetLibName = 'SDL_net';
   {$ELSE}
-    {$IFDEF ANDROID}
-        SDLLibName = 'SDL';
-	SDL_TTFLibName = 'libSDL_ttf.so';
-	SDL_MixerLibName = 'libSDL_mixer.so';
-	SDL_ImageLibName = 'libSDL_image.so';
-	SDL_NetLibName = 'libSDL_net.so';
-    {$ELSE}
-        SDLLibName = 'SDL';
-        SDL_TTFLibName = 'libSDL_ttf.so';
-        SDL_MixerLibName = 'libSDL_mixer.so';
-	SDL_ImageLibName = 'libSDL_image.so';
-	SDL_NetLibName = 'libSDL_net.so';
-    {$ENDIF}
+    SDLLibName = 'SDL';
+    SDL_TTFLibName = 'libSDL_ttf.so';
+    SDL_MixerLibName = 'libSDL_mixer.so';
+    SDL_ImageLibName = 'libSDL_image.so';
+    SDL_NetLibName = 'libSDL_net.so';
   {$ENDIF}
 {$ENDIF}
 
--- a/hedgewars/hwLibrary.pas	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/hwLibrary.pas	Mon Sep 26 00:03:14 2011 +0200
@@ -18,14 +18,6 @@
 
 Library hwLibrary;
 
-{$IFDEF fpc}
-{$MODE delphi}
-{$ENDIF}
-
-{$IFDEF ANDROID}
-    {$MACRO ON}
-    {$DEFINE Java_Prefix := 'Java_org_hedgewars_mobile_EngineProtocol_PascalExports_'}
-{$ENDIF}
 
 // Add all your Pascal units to the "uses" clause below to add them to the program.
 // Mark all Pascal procedures/functions that you wish to call from C/C++/Objective-C code using
@@ -33,8 +25,8 @@
 // these procedures/functions to the PascalImports.h file (also in the "Pascal Sources" group)
 // to make these functions available in the C/C++/Objective-C source files
 // (add "#include PascalImports.h" near the top of these files if it's not there yet)
-uses PascalExports, hwengine{$IFDEF ANDROID},jni{$ENDIF};
-exports Game{$IFNDEF ANDROID}, HW_versionInfo{$ENDIF};
+uses PascalExports, hwengine{$IFDEF ANDROID}, jni{$ENDIF};
+exports Game, HW_versionInfo;
 
 function JNI_HW_versionInfoNet(env: PJNIEnv; obj: JObject):JInt;cdecl;
 begin
@@ -48,7 +40,7 @@
 
 
 {$IFDEF ANDROID}
-    exports
+exports
     JNI_HW_versionInfoNet name Java_Prefix+'HWversionInfoNetProto', 
     JNI_HW_versionInfoVersion name Java_Prefix+'HWversionInfoVersion', 
     GenLandPreview name Java_Prefix + 'GenLandPreview',
--- a/hedgewars/options.inc	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/options.inc	Mon Sep 26 00:03:14 2011 +0200
@@ -28,12 +28,13 @@
 {$DEFINE GLunit:=GL}
 
 {$IFDEF ANDROID}
+  {$MODE delphi}
   {$DEFINE SDL13}
   {$DEFINE HWLIBRARY}
   {$DEFINE S3D_DISABLED}
   {$DEFINE GLunit:=gles11}
-  {$DEFINE DEBUGFILE}
   {$DEFINE MOBILE}
+  {$DEFINE Java_Prefix := 'Java_org_hedgewars_mobile_EngineProtocol_PascalExports_'}
 {$ENDIF}
 
 {$IFDEF IPHONEOS}
@@ -42,10 +43,10 @@
   {$DEFINE S3D_DISABLED}
   {$DEFINE GLunit:=gles11}
   {$DEFINE MOBILE}
+{$ELSE}
+  {$DEFINE DEBUGFILE}
+  //{$DEFINE TRACEAIACTIONS}
+  //{$DEFINE COUNTTICKS}
 {$ENDIF}
 
-{$DEFINE DEBUGFILE}
-//{$DEFINE TRACEAIACTIONS}
-//{$DEFINE COUNTTICKS}
-
 //also available LUA_DISABLED
--- a/hedgewars/uAI.pas	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/uAI.pas	Mon Sep 26 00:03:14 2011 +0200
@@ -31,7 +31,7 @@
 implementation
 uses uConsts, SDLh, uAIMisc, uAIAmmoTests, uAIActions,
      uAmmos, SysUtils{$IFDEF UNIX}{$IFNDEF ANDROID}, cthreads{$ENDIF}{$ENDIF}, uTypes,
-     uVariables, uCommands, uUtils, uDebug, uConsole;
+     uVariables, uCommands, uUtils, uDebug;
 
 var BestActions: TActions;
     CanUseAmmo: array [TAmmoType] of boolean;
@@ -353,6 +353,7 @@
 procedure initModule;
 begin
     hasThread:= 0;
+    ThinkThread:= ThinkThread;
 end;
 
 procedure freeModule;
--- a/hedgewars/uLand.pas	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/uLand.pas	Mon Sep 26 00:03:14 2011 +0200
@@ -1414,7 +1414,10 @@
     if digest = '' then
         digest:= s
     else
-//        TryDo(s = digest, 'Different maps generated, sorry', true);
+{$IFNDEF ANDROID}
+{TODO: Xeli can you re-enable this? it is a very important check}
+        TryDo(s = digest, 'Different maps generated, sorry', true);
+{$ENDIF}
 end;
 
 procedure chSendLandDigest(var s: shortstring);
--- a/hedgewars/uStore.pas	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/uStore.pas	Mon Sep 26 00:03:14 2011 +0200
@@ -290,7 +290,7 @@
            ((vobCount > 0) or (ii <> sprFlake)) then
         begin
             if AltPath = ptNone then
-                if ii in [sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR, sprChunk] then // FIXME: hack
+                if ii in [sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR, sprChunk, sprFireButton] then // FIXME: hack
                     begin
                     if not reload then
                         begin
--- a/hedgewars/uTypes.pas	Sun Sep 25 18:24:01 2011 +0200
+++ b/hedgewars/uTypes.pas	Mon Sep 26 00:03:14 2011 +0200
@@ -82,7 +82,8 @@
             sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
             sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
             sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
-            sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis, sprFireButton
+            sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
+            sprFireButton
             );
 
     // Gears that interact with other Gears and/or Land