I am installing Spatialite for use in GeoDjango on a Windwos 10 64 bit system. Previously I tried using the spatialite binaries, but django complains that the function lwgeom_version can not be found, so I’m trying to install from source now. I have already installed GEOS, PROJ, and GDAL from source in my command prompt. As spatialite requires using nmake on windows, I am using the Visual Studio 2017 command prompt to build it, however, in the README for libspatialite 4.2.0 it states that
> cd c:\libspatialite-3.1.0
> nmake /f makefile.vc
> nmake /f makefile.vc install
Please note: standard definitions in 'makefile.vc' assumes:
- enabling PROJ
- disabling GEOS
If you want to alter the default behaviour then make modifications in
'makefile.vc'. Also note that 'libspatialite-geos.def' contains those external
symbols to be exported from the DLL when you build GEOS.
as I am using GeoDjango for geographic queries I think that GEOS will be necessary. How can I enable GEOS in the makefile.vc? It doesn’t seem clear to me how to do that. For convenience, here is the full makefile.vc below.
# $Id: $
#
# NMAKE Makefile to build libspatialite on Windows
#
!INCLUDE nmake.opt
LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \
src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \
src\gaiageo\gg_endian.obj src\gaiageo\gg_ewkt.obj \
src\gaiageo\gg_geodesic.obj src\gaiageo\gg_geoJSON.obj \
src\gaiageo\gg_geometries.obj src\gaiageo\gg_geoscvt.obj \
src\gaiageo\gg_gml.obj src\gaiageo\gg_kml.obj \
src\gaiageo\gg_relations.obj src\gaiageo\gg_shape.obj \
src\gaiageo\gg_transform.obj src\gaiageo\gg_vanuatu.obj \
src\gaiageo\gg_wkb.obj src\gaiageo\gg_wkt.obj \
src\gaiageo\gg_extras.obj src\gaiageo\gg_xml.obj \
src\gaiageo\gg_relations_ext.obj src/connection_cache/alloc_cache.obj \
src\spatialite\mbrcache.obj src\shapefiles\shapefiles.obj \
src\spatialite\spatialite.obj src\spatialite\virtualdbf.obj \
src\spatialite\virtualfdo.obj src\spatialite\virtualnetwork.obj \
src\spatialite\virtualshape.obj src\spatialite\virtualspatialindex.obj \
src\spatialite\statistics.obj src\spatialite\metatables.obj \
src\spatialite\virtualXL.obj src\spatialite\extra_tables.obj \
src\spatialite\virtualxpath.obj src\spatialite\virtualbbox.obj \
src\spatialite\spatialite_init.obj src\gaiageo\gg_voronoj.obj \
src\wfs\wfs_in.obj src\srsinit\srs_init.obj \
src\dxf\dxf_parser.obj src\dxf\dxf_loader.obj src\dxf\dxf_writer.obj \
src\dxf\dxf_load_distinct.obj src\dxf\dxf_load_mixed.obj \
src\shapefiles\validator.obj src\md5\md5.obj src\md5\gaia_md5.obj \
src\srsinit\epsg_inlined_00.obj src\srsinit\epsg_inlined_01.obj \
src\srsinit\epsg_inlined_02.obj src\srsinit\epsg_inlined_03.obj \
src\srsinit\epsg_inlined_04.obj src\srsinit\epsg_inlined_05.obj \
src\srsinit\epsg_inlined_06.obj src\srsinit\epsg_inlined_07.obj \
src\srsinit\epsg_inlined_08.obj src\srsinit\epsg_inlined_09.obj \
src\srsinit\epsg_inlined_10.obj src\srsinit\epsg_inlined_11.obj \
src\srsinit\epsg_inlined_12.obj src\srsinit\epsg_inlined_13.obj \
src\srsinit\epsg_inlined_14.obj src\srsinit\epsg_inlined_15.obj \
src\srsinit\epsg_inlined_16.obj src\srsinit\epsg_inlined_17.obj \
src\srsinit\epsg_inlined_18.obj src\srsinit\epsg_inlined_19.obj \
src\srsinit\epsg_inlined_20.obj src\srsinit\epsg_inlined_21.obj \
src\srsinit\epsg_inlined_22.obj src\srsinit\epsg_inlined_23.obj \
src\srsinit\epsg_inlined_24.obj src\srsinit\epsg_inlined_25.obj \
src\srsinit\epsg_inlined_26.obj src\srsinit\epsg_inlined_27.obj \
src\srsinit\epsg_inlined_28.obj src\srsinit\epsg_inlined_29.obj \
src\srsinit\epsg_inlined_30.obj src\srsinit\epsg_inlined_31.obj \
src\srsinit\epsg_inlined_32.obj src\srsinit\epsg_inlined_33.obj \
src\srsinit\epsg_inlined_34.obj src\srsinit\epsg_inlined_35.obj \
src\srsinit\epsg_inlined_36.obj src\srsinit\epsg_inlined_37.obj \
src\srsinit\epsg_inlined_38.obj src\srsinit\epsg_inlined_39.obj \
src\srsinit\epsg_inlined_40.obj src\srsinit\epsg_inlined_41.obj \
src\srsinit\epsg_inlined_42.obj src\srsinit\epsg_inlined_43.obj \
src\srsinit\epsg_inlined_44.obj src\srsinit\epsg_inlined_45.obj \
src\srsinit\epsg_inlined_extra.obj \
src\srsinit\epsg_inlined_prussian.obj \
src\srsinit\epsg_inlined_wgs84_00.obj src\srsinit\epsg_inlined_wgs84_01.obj \
src\versioninfo\version.obj src\virtualtext\virtualtext.obj
SPATIALITE_DLL = spatialite$(VERSION).dll
CFLAGS = /nologo -I.\src\headers -I. -IC:\OSGeo4W\include $(OPTFLAGS)
default: all
all: spatialite.lib spatialite_i.lib
#$(EXIF_LOADER_EXE)
spatialite.lib: $(LIBOBJ)
if exist spatialite.lib del spatialite.lib
lib /out:spatialite.lib $(LIBOBJ)
$(SPATIALITE_DLL): spatialite_i.lib
spatialite_i.lib: $(LIBOBJ)
link /debug /dll /out:$(SPATIALITE_DLL) \
/implib:spatialite_i.lib $(LIBOBJ) \
C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \
C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \
C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \
C:\OSGeo4W\lib\libxml2.lib
if exist $(SPATIALITE_DLL).manifest mt -manifest \
$(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2
.c.obj:
$(CC) $(CFLAGS) /c $*.c /Fo$@
clean:
del *.dll
del *.exp
del *.manifest
del *.lib
del src\gaiaaux\*.obj
del src\gaiaexif\*.obj
del src\gaiageo\*.obj
del src\spatialite\*.obj
del src\srsinit\*.obj
del src\versioninfo\*.obj
del src\virtualtext\*.obj
del src\wfs\*.obj
del src\dxf\*.obj
del src\md5\*.obj
del *.pdb
install: all
-mkdir $(INSTDIR)
-mkdir $(INSTDIR)\bin
-mkdir $(INSTDIR)\lib
-mkdir $(INSTDIR)\include
-mkdir $(INSTDIR)\include\spatialite
copy *.dll $(INSTDIR)\bin
copy *.lib $(INSTDIR)\lib
copy src\headers\spatialite.h $(INSTDIR)\include
copy src\headers\spatialite\*.h $(INSTDIR)\include\spatialite