[geos-devel] Compiling geos with mingw64

David Burken dburken at comcast.net
Fri Feb 15 06:48:59 PST 2013


Hi,

I'm attempting a 64 bit windows build with the mingw cross compiler on 
linux.  Here's my hacks to get geos to compile if anyone's interested.  
See below.

Take care,
Dave

// My cmake script:
#!/bin/sh

# ---
# File: geos-cmake-config.sh
# ---

build_dir="/work/mingw"

mingw64-cmake -G "Unix Makefiles" \
-DGNU_HOST=x86_64-w64-mingw32 \
-DCMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/x86_64-w64-mingw32-g++ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${build_dir}/sandbox \
-DCMAKE_MODULE_PATH=${build_dir}/geos/geos-svn/cmake/modules \
../geos-svn

// Files touched:
$ svn status
?       geos_svn_revision.h
M       include/geos/inline.h
M       include/geos/platform.h.cmake
M       include/geos/profiler.h
M       include/geos/timeval.h

// Fixe "multiple defines" in dot.inl files:
$ svn diff include/geos/inline.h
Index: include/geos/inline.h
===================================================================
--- include/geos/inline.h    (revision 3765)
+++ include/geos/inline.h    (working copy)
@@ -18,7 +18,7 @@
  #ifdef GEOS_INLINE
  # define INLINE inline
  #else
-# define INLINE
+# define INLINE inline
  #endif

  // isnan is in std namespace (hack):
$ svn diff include/geos/platform.h.cmake
Index: include/geos/platform.h.cmake
===================================================================
--- include/geos/platform.h.cmake    (revision 3765)
+++ include/geos/platform.h.cmake    (working copy)
@@ -123,6 +123,7 @@
  # endif
  #endif

+#define HAVE_STD_ISNAN 1
  #if defined(HAVE_STD_ISNAN)
  # define ISNAN(x) (std::isnan)(x)
  #elif defined(HAVE_INLINE_ISNAND_XCODE)

// No config.h and gettimeofday call is ambiguous:
$ svn diff include/geos/profiler.h
Index: include/geos/profiler.h
===================================================================
--- include/geos/profiler.h    (revision 3765)
+++ include/geos/profiler.h    (working copy)
@@ -20,7 +20,7 @@
  /* For MingW builds with __STRICT_ANSI__ (-ansi) */
  #if defined(__MINGW32__)
  /* Allow us to check for presence of gettimeofday in MingW */
-#include <config.h>
+// #include <config.h>

  #include <sys/time.h>
  extern "C" {
@@ -71,13 +71,13 @@

      /** \brief start a new timer */
      void start() {
-        gettimeofday(&starttime, NULL);
+           gettimeofday(&starttime, (void*)NULL);
      }

      /** \brief stop current timer */
      void stop()
      {
-        gettimeofday(&stoptime, NULL);
+           gettimeofday(&stoptime, (void*)NULL);
          double elapsed = 1000000*(stoptime.tv_sec-starttime.tv_sec)+
              (stoptime.tv_usec-starttime.tv_usec);


// timezone struct defined in time.h
$ svn diff include/geos/timeval.h
Index: include/geos/timeval.h
===================================================================
--- include/geos/timeval.h    (revision 3765)
+++ include/geos/timeval.h    (working copy)
@@ -31,10 +31,12 @@
  #define EPOCHFILETIME (116444736000000000LL)
  #endif

+#if 0 /* tmp drb */
  struct timezone {
      int tz_minuteswest; /* minutes W of Greenwich */
      int tz_dsttime;     /* type of dst correction */
  };
+#endif





More information about the geos-devel mailing list