Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make Erlgeom compile on Windows

  • Loading branch information...
commit ec2bab8cbdcf506f96601bf4ec4e188912cda192 1 parent bed955f
@vmx authored
Showing with 74 additions and 6 deletions.
  1. +18 −0 README.md
  2. +4 −0 rebar.cmd
  3. +26 −3 rebar.config
  4. +26 −3 rebar_makecheck.config
View
18 README.md
@@ -27,3 +27,21 @@ more examples.
5> erlgeom:disjoint(Geom1, Geom3).
true
6>
+
+
+On Windows
+----------
+
+You need to have GEOS installed, let's say it was installed to `C:\cygwin\opt\couchbase`.
+
+Open a shell which has all compilers and the MSVC environment set up (e.g. the Windows SDK 7.1 Command Prompt).
+
+Now set it up so that GEOS and Erlang can be found:
+
+ SET INCLUDE=%INCLUDE%;C:\cygwin\opt\couchbase\include
+ SET LIB=%LIB%;C:\cygwin\opt\couchbase\lib
+ SET PATH=%PATH%;C:\cygwin\opt\couchbase\bin;C:\erl5.9.1\bin
+
+And finally compile the whole thing:
+
+ rebar compile
View
4 rebar.cmd
@@ -0,0 +1,4 @@
+@echo off
+setlocal
+set rebarscript=%~f0
+escript.exe "%rebarscript:.cmd=%" %*
View
29 rebar.config
@@ -5,7 +5,30 @@
]}.
{port_env, [
- %{"(linux|solaris|darwin)", "CFLAGS", "$CFLAGS -g -Wall"},
- % Link the GEOS C binding
- {"(linux|solaris|darwin)", "LDFLAGS", "$LDFLAGS -lgeos_c"}
+ %% add MS Visual C++ support to rebar on Windows
+ {"win32", "CC", "cl.exe"},
+ {"win32", "CXX", "cl.exe"},
+ {"win32", "LINKER", "link.exe"},
+ %% DRV_* and EXE_* Templates are identical
+ {"win32", "DRV_CXX_TEMPLATE",
+ "$CXX /c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "DRV_CC_TEMPLATE",
+ "$CC /c $CFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "DRV_LINK_TEMPLATE",
+ "$LINKER $PORT_IN_FILES $LDFLAGS $DRV_LDFLAGS /OUT:$PORT_OUT_FILE"},
+ %% DRV_* and EXE_* Templates are identical
+ {"win32", "EXE_CXX_TEMPLATE",
+ "$CXX /c $CXXFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "EXE_CC_TEMPLATE",
+ "$CC /c $CFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "EXE_LINK_TEMPLATE",
+ "$LINKER $PORT_IN_FILES $LDFLAGS $EXE_LDFLAGS /OUT:$PORT_OUT_FILE"},
+ %% ERL_CFLAGS are ok as -I even though strictly it should be /I
+ {"win32", "ERL_LDFLAGS", " /LIBPATH:$ERL_EI_LIBDIR erl_interface.lib ei.lib"},
+ {"win32", "DRV_CFLAGS", "/Zi /Wall $ERL_CFLAGS"},
+ {"win32", "DRV_LDFLAGS", "/DLL $ERL_LDFLAGS"},
+
+ % GEOS specifc settings
+ {"(linux|solaris|darwin)", "LDFLAGS", "$LDFLAGS -lgeos_c"},
+ {"win32", "DRV_LDFLAGS", "$DRV_LDFLAGS geos_c.lib"}
]}.
View
29 rebar_makecheck.config
@@ -6,7 +6,30 @@
]}.
{port_env, [
- %{"(linux|solaris|darwin)", "CFLAGS", "$CFLAGS -g -Wall"},
- % Link the GEOS C binding
- {"(linux|solaris|darwin)", "LDFLAGS", "$LDFLAGS -lgeos_c"}
+ %% add MS Visual C++ support to rebar on Windows
+ {"win32", "CC", "cl.exe"},
+ {"win32", "CXX", "cl.exe"},
+ {"win32", "LINKER", "link.exe"},
+ %% DRV_* and EXE_* Templates are identical
+ {"win32", "DRV_CXX_TEMPLATE",
+ "$CXX /c $CXXFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "DRV_CC_TEMPLATE",
+ "$CC /c $CFLAGS $DRV_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "DRV_LINK_TEMPLATE",
+ "$LINKER $PORT_IN_FILES $LDFLAGS $DRV_LDFLAGS /OUT:$PORT_OUT_FILE"},
+ %% DRV_* and EXE_* Templates are identical
+ {"win32", "EXE_CXX_TEMPLATE",
+ "$CXX /c $CXXFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "EXE_CC_TEMPLATE",
+ "$CC /c $CFLAGS $EXE_CFLAGS $PORT_IN_FILES /Fo$PORT_OUT_FILE"},
+ {"win32", "EXE_LINK_TEMPLATE",
+ "$LINKER $PORT_IN_FILES $LDFLAGS $EXE_LDFLAGS /OUT:$PORT_OUT_FILE"},
+ %% ERL_CFLAGS are ok as -I even though strictly it should be /I
+ {"win32", "ERL_LDFLAGS", " /LIBPATH:$ERL_EI_LIBDIR erl_interface.lib ei.lib"},
+ {"win32", "DRV_CFLAGS", "/Zi /Wall $ERL_CFLAGS"},
+ {"win32", "DRV_LDFLAGS", "/DLL $ERL_LDFLAGS"},
+
+ % GEOS specifc settings
+ {"(linux|solaris|darwin)", "LDFLAGS", "$LDFLAGS -lgeos_c"},
+ {"win32", "DRV_LDFLAGS", "$DRV_LDFLAGS geos_c.lib"}
]}.
Please sign in to comment.
Something went wrong with that request. Please try again.