Skip to content

Commit

Permalink
Make Erlgeom compile on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
vmx committed Jul 5, 2012
1 parent bed955f commit ec2bab8
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 6 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions rebar.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
setlocal
set rebarscript=%~f0
escript.exe "%rebarscript:.cmd=%" %*
29 changes: 26 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
]}.
29 changes: 26 additions & 3 deletions rebar_makecheck.config
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
]}.

0 comments on commit ec2bab8

Please sign in to comment.