wow windows works too with minor changes cmake_pascal
authorkoda
Tue, 19 Mar 2013 14:14:40 +0100
branchcmake_pascal
changeset 8798 03d113d51062
parent 8796 8ab4ef8b70f6
child 8800 5e837e6d8f94
wow windows works too with minor changes
CMakeLists.txt
cmake_modules/CMakePascalInformation.cmake
hedgewars/CMakeLists.txt
tools/build_windows.bat
--- a/CMakeLists.txt	Tue Mar 19 13:39:38 2013 +0100
+++ b/CMakeLists.txt	Tue Mar 19 14:14:40 2013 +0100
@@ -17,7 +17,7 @@
 
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
 include(${CMAKE_MODULE_PATH}/utils.cmake)
-
+message("prefix ${CMAKE_PREFIX_PATH}")
 #possible cmake configuration
 option(NOSERVER "Disable gameServer build (off)]" OFF)
 option(NOPNG "Disable screenshoot compression (off)" OFF)
--- a/cmake_modules/CMakePascalInformation.cmake	Tue Mar 19 13:39:38 2013 +0100
+++ b/cmake_modules/CMakePascalInformation.cmake	Tue Mar 19 14:14:40 2013 +0100
@@ -159,21 +159,28 @@
 # compile a Pascal file into an object file
 IF(NOT CMAKE_Pascal_COMPILE_OBJECT)
     #when you have multiple ld installation make sure you get the one bundled with the system C compiler
-  get_filename_component(CMAKE_C_COMPILER_DIR ${CMAKE_C_COMPILER} PATH)
-  if(APPLE)
-    #add user framework directory
-    set(CMAKE_Pascal_OSX_FLAGS "-Ff~/Library/Frameworks")
-    if(CMAKE_OSX_SYSROOT)
-        set(CMAKE_Pascal_OSX_FLAGS "-XD${CMAKE_OSX_SYSROOT} ${CMAKE_Pascal_OSX_FLAGS}")
-    endif(CMAKE_OSX_SYSROOT)
-  endif(APPLE)
+  if(UNIX)
+    get_filename_component(CMAKE_C_COMPILER_DIR ${CMAKE_C_COMPILER} PATH)
+    set(CMAKE_Pascal_UNIX_FLAGS "-FD${CMAKE_C_COMPILER_DIR}")
+    if(APPLE)
+      #add user framework directory
+      set(CMAKE_Pascal_UNIX_FLAGS "-Ff~/Library/Frameworks ${CMAKE_Pascal_UNIX_FLAGS}")
+      if(CMAKE_OSX_SYSROOT)
+        set(CMAKE_Pascal_UNIX_FLAGS "-XD${CMAKE_OSX_SYSROOT} ${CMAKE_Pascal_UNIX_FLAGS}")
+      endif(CMAKE_OSX_SYSROOT)
+    endif(APPLE)
+  endif(UNIX)
     SET(CMAKE_Pascal_COMPILE_OBJECT
-      "<CMAKE_Pascal_COMPILER> -Cn -FE${EXECUTABLE_OUTPUT_PATH} -FU${CMAKE_CURRENT_BINARY_DIR}/<OBJECT_DIR> -Fi${CMAKE_CURRENT_BINARY_DIR} -FD${CMAKE_C_COMPILER_DIR} ${CMAKE_Pascal_OSX_FLAGS} <FLAGS> <SOURCE>")
+      "<CMAKE_Pascal_COMPILER> -Cn -FE${EXECUTABLE_OUTPUT_PATH} -FU${CMAKE_CURRENT_BINARY_DIR}/<OBJECT_DIR> -Fi${CMAKE_CURRENT_BINARY_DIR}  ${CMAKE_Pascal_UNIX_FLAGS} <FLAGS> <SOURCE>")
 ENDIF(NOT CMAKE_Pascal_COMPILE_OBJECT)
 
 # link Pascal objects in a single executable
 IF(NOT CMAKE_Pascal_LINK_EXECUTABLE)
+  if(WIN32)
+    set(CMAKE_Pascal_LINK_EXECUTABLE "${EXECUTABLE_OUTPUT_PATH}/ppas.bat")
+  else(WIN32)
     set(CMAKE_Pascal_LINK_EXECUTABLE "${EXECUTABLE_OUTPUT_PATH}/ppas.sh")
+  endif(WIN32)
 #  SET(CMAKE_Pascal_LINK_EXECUTABLE "${CMAKE_Pascal_COMPILER} <CMAKE_Pascal_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE>.adb -cargs <FLAGS> -largs <LINK_LIBRARIES>")
 ENDIF(NOT CMAKE_Pascal_LINK_EXECUTABLE)
 
--- a/hedgewars/CMakeLists.txt	Tue Mar 19 13:39:38 2013 +0100
+++ b/hedgewars/CMakeLists.txt	Tue Mar 19 14:14:40 2013 +0100
@@ -21,13 +21,12 @@
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
 
 #SOURCE AND PROGRAMS SECTION
-#if(${BUILD_ENGINE_LIBRARY})
-#    set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
-#    set(hwengine_project hwLibrary.pas)
-#else()
-#    set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}")
-#    set(hwengine_project hwengine.pas)
-#endif()
+if(${BUILD_ENGINE_LIBRARY})
+    set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
+    set(hwengine_project hwLibrary.pas)
+else()
+    set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}")
+endif()
 
 if (APPLE)
     set(required_fpc_version 2.6)
@@ -176,8 +175,11 @@
 endif()
 
 if(NOT LUA_FOUND)
+    add_flag_append(CMAKE_Pascal_FLAGS -k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a)
     #linking with liblua.a requires system readline
-    add_flag_append(CMAKE_Pascal_FLAGS "-k${EXECUTABLE_OUTPUT_PATH}/lib${LUA_LIBRARY}.a -k-lreadline")
+    if(UNIX)
+        add_flag_append(CMAKE_Pascal_FLAGS -k-lreadline)
+    endif(UNIX)
 endif()
 
 if(NOT PHYSFS_FOUND)
@@ -223,4 +225,4 @@
 #    add_dependencies(hwengine ENGINECLEAN)
 #endif()
 
-install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine" DESTINATION ${destination_dir})
+install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${destination_dir})
--- a/tools/build_windows.bat	Tue Mar 19 13:39:38 2013 +0100
+++ b/tools/build_windows.bat	Tue Mar 19 14:14:40 2013 +0100
@@ -39,7 +39,7 @@
 
 echo Running cmake...
 set ERRORLEVEL=
-cmake . -G "MinGW Makefiles" -DCMAKE_PREFIX_PATH="%CD%\misc\winutils\" -DPNG_LIBRARY="%CD%\misc\winutils\bin\libpng13.dll" -DCMAKE_BUILD_TYPE="%BUILD_TYPE%"
+cmake . -G "MinGW Makefiles" -DCMAKE_PREFIX_PATH="%CD%\misc\winutils" -DPNG_LIBRARY="%CD%\misc\winutils\bin\libpng13.dll" -DCMAKE_BUILD_TYPE="%BUILD_TYPE%"
 
 if %ERRORLEVEL% NEQ 0 goto exitpoint