Author Topic: FreeBSD Patches for using cmake  (Read 1721 times)

m0ellemeister

  • Guest
FreeBSD Patches for using cmake
« on: 20 January 2011, 23:27:01 »
Here are the needed patches for using cmake to compile MG on FreeBSD:

Code: [Select]
Index: source/glest_map_editor/CMakeLists.txt
===================================================================
--- source/glest_map_editor/CMakeLists.txt      (Revision 1583)
+++ source/glest_map_editor/CMakeLists.txt      (Arbeitskopie)
@@ -12,6 +12,11 @@
 
 IF(NOT WIN32)
        # It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'.
+       IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+               SET(wxWidgets_CONFIG_OPTIONS --prefix=/usr/local)
+               MESSAGE(STATUS "Detected FreeBSD.....")
+       ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+
        FIND_PACKAGE(wxWidgets COMPONENTS core base gl REQUIRED)
 
        # wxWidgets include (this will do all the magic to configure everything)

Code: [Select]
Index: source/shared_lib/sources/feathery_ftp/ftpTargetPosix.c
===================================================================
--- source/shared_lib/sources/feathery_ftp/ftpTargetPosix.c     (Revision 1583)
+++ source/shared_lib/sources/feathery_ftp/ftpTargetPosix.c     (Arbeitskopie)
@@ -26,7 +26,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
-#include <sys/sendfile.h>
+#ifdef __FreeBSD__
+    #include <sys/uio.h>
+#else
+    #include <sys/sendfile.h>
+#endif
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>

Code: [Select]
Index: mk/cmake/Modules/FindLUA.cmake
===================================================================
--- mk/cmake/Modules/FindLUA.cmake      (Revision 1583)
+++ mk/cmake/Modules/FindLUA.cmake      (Arbeitskopie)
@@ -13,19 +13,29 @@
 # a generic (version-independent) include directory for LUA...
 
 IF(LUA_INCLUDE_DIR AND LUA_LIBRARIES)
-       SET(LUA_FIND_QUIETLY TRUE)
+       # SET(LUA_FIND_QUIETLY TRUE)
 ENDIF(LUA_INCLUDE_DIR AND LUA_LIBRARIES)
 
 FIND_PATH(LUA_INCLUDE_DIR NAMES lua.hpp
                PATHS   /usr/include
                                /usr/include/lua
                                /usr/include/lua5.1
+                       IF(FreeBSD)
+                               SET(PATHS "/usr/local/include/lua51")
+                       ENDIF()
                                $ENV{LUA_HOME}
                )
 
 FIND_LIBRARY(LUA_LIBRARIES NAMES lua5.1 lua
-               PATHS   $ENV{LUA_HOME})
+               PATHS
+               IF(FreeBSD)
+                       SET(PATHS "/usr/local/lib/lua51")
+               ENDIF()
+               $ENV{LUA_HOME})
 
+MESSAGE(STATUS "LUA_INC: ${LUA_INCLUDE_DIR}")
+MESSAGE(STATUS "LUA_LIB: ${LUA_LIBRARIES}")
+
 IF(LUA_INCLUDE_DIR AND LUA_LIBRARIES)
        SET(LUA_FOUND TRUE)
        INCLUDE(CheckLibraryExists)

@Core developers

Please review it and apply it to the upstream code, if possible. Many Thx!

m0ellemeister

  • Guest
Re: FreeBSD Patches for using cmake
« Reply #1 on: 20 January 2011, 23:37:08 »
Here's another patch which makes it possible to build the glest editor too:

Code: [Select]
Index: source/tools/glexemel/CMakeLists.txt
===================================================================
--- source/tools/glexemel/CMakeLists.txt        (Revision 1583)
+++ source/tools/glexemel/CMakeLists.txt        (Arbeitskopie)
@@ -3,9 +3,13 @@
 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/source/tools/glexemel)
 add_executable(g2xml g2xml.c g3dv4.h)
 
+IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+     SET(CMAKE_INCLUDE_PATH /usr/local/include)
+ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+
 find_package(LibXml2)
 IF(LIBXML2_FOUND)
-  include_directories(${LIBXML2_INCLUDE_DIR}) 
+  include_directories(${CMAKE_INCLUDE_PATH} ${LIBXML2_INCLUDE_DIR}) 
   add_executable(xml2g xml2g.c g3dv4.h)
   target_link_libraries(xml2g ${LIBXML2_LIBRARIES})
 ELSE()

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: FreeBSD Patches for using cmake
« Reply #2 on: 21 January 2011, 00:26:11 »
Patch applied in svn

 

anything