fix issue 185 :|
authorkoda
Sun, 06 Feb 2011 13:19:00 +0100
changeset 4930 5d59bb58c365
parent 4929 3dca560e6510
child 4931 da43c36a6e92
fix issue #185 :| also fix compilation & universal binary stuff for hwlib under macosx
hedgewars/CMakeLists.txt
hedgewars/hwLibrary.pas
misc/wrapper.c
--- a/hedgewars/CMakeLists.txt	Sun Feb 06 11:39:11 2011 +0100
+++ b/hedgewars/CMakeLists.txt	Sun Feb 06 13:19:00 2011 +0100
@@ -34,6 +34,7 @@
 #SOURCE AND PROGRAMS SECTION
 set(fpc_tryexe fpc)
 set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas)
+set(engine_output_name "hwengine")
 
 set(engine_sources
     ${hwengine_project}
@@ -104,6 +105,10 @@
     if(APPLE AND current_macosx_version MATCHES "10.6")
         set(pascal_compiler_flags_cmn "-k-no_order_inits" ${pascal_compiler_flags_cmn})
     endif(APPLE AND current_macosx_version MATCHES "10.6")
+
+    if (APPLE)
+        set(engine_output_name "hwengine.dylib")
+    endif (APPLE)
 endif(BUILD_ENGINE_LIBRARY)
 
 find_program(fpc_executable ${fpc_tryexe})
@@ -161,9 +166,9 @@
 
 
 #DEPENDECIES AND EXECUTABLES SECTION
-IF(NOT APPLE OR BUILD_ENGINE_LIBRARY)
+IF(NOT APPLE)
     #here is the command for standard executables or for shared library
-    add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}"
+    add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
         COMMAND "${pascal_compiler}"
         ARGS ${pascal_compiler_flags}
         MAIN_DEPENDENCY ${hwengine_project}
@@ -191,15 +196,15 @@
         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
     endforeach()
 
-    add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine"
+    add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}"
         COMMAND "lipo"
-        ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/hwengine
+        ARGS ${lipo_args_list} -create -output ${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}
         DEPENDS ${lipo_args_list}
         )
 ENDIF()
 
 
-add_custom_target(hwengine ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
+add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
 
-install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
+install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
 
--- a/hedgewars/hwLibrary.pas	Sun Feb 06 11:39:11 2011 +0100
+++ b/hedgewars/hwLibrary.pas	Sun Feb 06 13:19:00 2011 +0100
@@ -1,12 +1,24 @@
-//  fptest
-//
-//  Created by Vittorio on 08/01/10.
-//  Copyright __MyCompanyName__ 2010. All rights reserved.
+(*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *)
 
 Library hwLibrary;
 
 // 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
 // "cdecl; export;" (see the fpclogo.pas unit for an example), and then add C-declarations for
 // these procedures/functions to the PascalImports.h file (also in the "Pascal Sources" group)
--- a/misc/wrapper.c	Sun Feb 06 11:39:11 2011 +0100
+++ b/misc/wrapper.c	Sun Feb 06 13:19:00 2011 +0100
@@ -6,7 +6,7 @@
  - this executable expect a save file "Save.hws" and the data folder "Data" to be in the same launching directory
  */
 
-#import <stdlib.h>
+#include <stdlib.h>
 
 extern void Game (const char **);