# $Id: Makefile.vc 1820 2006-09-06 16:54:23Z mloskot $
#
# 	Building on Win32 with Visual Studio
# 	------------------------------------
#
# 1) Requires at least Visual Studio 2002. 
# 2) You will need to manually copy capi/geos_c.h.in to 
#    capi/geos_c.h and edit in version information (or copy from unix).
# 3) build in geos\source directory with the command "nmake /f makefile.vc"
# 
# Produces:
#  geos.lib: static library for use of C or C++ API.
#  geos.dll: DLL - only exports the C API
#  geos_i.lib: Stub library to link against for use of geos.dll. 
#
# This makefile mostly maintained by Frank Warmerdam <warmerdam@pobox.com>
#
# $Log$
# Revision 1.15  2006/06/03 22:31:22  hobu
# update to track latest removals
#
# Revision 1.14  2006/05/03 16:22:40  hobu
# tweak clean target
#
# Revision 1.13  2006/05/03 16:21:18  hobu
# Build the C API and shared lib separate from the normal lib
# Add missing files
#
# Revision 1.12  2006/05/03 15:49:12  hobu
# add additional files and change names where necessary
#
# Revision 1.11  2006/04/04 01:54:31  hobu
# Add in changes/missing from previous rearranging.
#
# Revision 1.10  2006/04/04 01:28:44  hobu
# remove objects that no longer exist
# default to MSVC_VER=1310
#
# Revision 1.9  2006/03/10 10:48:28  strk
# Bug #58 - Patch to makefile.vc after big refactoring commit
#
# Revision 1.8  2006/03/01 16:42:47  strk
# Fixed include name (Bug#41)
#
# Revision 1.7  2006/03/01 11:47:51  strk
# Applied patch by Mateusz Loskot (Bug #39)
#
# Revision 1.6  2006/01/31 21:42:01  strk
# Added DepthSegment object
#
# Revision 1.5  2005/10/21 02:44:31  frank
# added a wee readme
#
# Revision 1.4  2005/10/21 02:41:25  frank
# added DLL building, and geostest.exe
#
# Revision 1.3  2005/10/21 01:57:08  frank
# updated for 3.0.0 and added C API
#
# Revision 1.2  2004/12/04 01:20:20  frank
# removed dll delete
#
# Revision 1.1  2004/12/03 16:25:47  frank
# New
#
!INCLUDE dirlist.mk

# Check compiler version given in command line
# nmake -f makefile.vc MSVC_VER=xxxx
#
!IFNDEF MSVC_VER
#assume msvc 7.1
MSVC_VER=1310
!ENDIF

!IF $(MSVC_VER) == 1400
MSVC_CPPFLAGS = /EHs /D "_CRT_SECURE_NO_DEPRECATE"
!ELSE
MSVC_CPPFLAGS = /GX
!ENDIF

#CFLAGS = -Iheaders /GX /MD /GR /Zi /nologo
#CFLAGS = -Iheaders /GX /MD /GR /O1 /D "NDEBUG" /nologo
CFLAGS = -Iheaders /MD /GR /O2 /D "NDEBUG" /nologo \
     	 /D "NOMINMAX" /D "WIN32_LEAN_AND_MEAN" /D "NOGDI" \
	 $(MSVC_CPPFLAGS)


LIBNAME =	geos.lib
DLLNAME = 	geos.dll
CDLLNAME =  geos_c.dll
CLIBNAME =  geos_c_i.lib
SLIBNAME =	geos_i.lib

OBJ = 	algorithm\CentroidArea.obj \
	algorithm\CentroidLine.obj \
	algorithm\CentroidPoint.obj \
	algorithm\CGAlgorithms.obj \
	algorithm\ConvexHull.obj \
	algorithm\HCoordinate.obj \
	algorithm\InteriorPointArea.obj \
	algorithm\InteriorPointLine.obj \
	algorithm\InteriorPointPoint.obj \
	algorithm\LineIntersector.obj \
	algorithm\MCPointInRing.obj \
	algorithm\MinimumDiameter.obj \
	algorithm\NotRepresentableException.obj \
	algorithm\PointLocator.obj \
	algorithm\RobustDeterminant.obj \
	algorithm\SimplePointInAreaLocator.obj \
	algorithm\SimplePointInRing.obj \
	algorithm\SIRtreePointInRing.obj \
	geom\Coordinate.obj \
	geom\CoordinateArraySequence.obj \
	geom\CoordinateArraySequenceFactory.obj \
	geom\CoordinateSequence.obj \
	geom\CoordinateSequenceFactory.obj \
	geom\Dimension.obj \
	geom\Envelope.obj \
	geom\Geometry.obj \
	geom\GeometryCollection.obj \
	geom\GeometryComponentFilter.obj \
	geom\GeometryFactory.obj \
	geom\IntersectionMatrix.obj \
	geom\LinearRing.obj \
	geom\LineSegment.obj \
	geom\LineString.obj \
	geom\Location.obj \
	geom\MultiLineString.obj \
	geom\MultiPoint.obj \
	geom\MultiPolygon.obj \
	geom\Point.obj \
	geom\Polygon.obj \
	geom\PrecisionModel.obj \
	geom\Triangle.obj \
	geom\util\CoordinateOperation.obj \
	geom\util\GeometryEditor.obj \
	geom\util\GeometryTransformer.obj \
	geom\util\LinearComponentExtracter.obj \
	geom\util\PointExtracter.obj \
	geom\util\PolygonExtracter.obj \
	geom\util\ShortCircuitedGeometryVisitor.obj \
	geomgraph\Depth.obj \
	geomgraph\DirectedEdge.obj \
	geomgraph\DirectedEdgeStar.obj \
	geomgraph\Edge.obj \
	geomgraph\EdgeEnd.obj \
	geomgraph\EdgeEndStar.obj \
	geomgraph\EdgeIntersection.obj \
	geomgraph\EdgeIntersectionList.obj \
	geomgraph\EdgeList.obj \
	geomgraph\EdgeNodingValidator.obj \
	geomgraph\EdgeRing.obj \
	geomgraph\GeometryGraph.obj \
	geomgraph\GraphComponent.obj \
	geomgraph\Label.obj \
	geomgraph\Node.obj \
	geomgraph\NodeFactory.obj \
	geomgraph\NodeMap.obj \
	geomgraph\PlanarGraph.obj \
	geomgraph\Position.obj \
	geomgraph\Quadrant.obj \
	geomgraph\TopologyLocation.obj \
	geomgraph\index\MonotoneChainEdge.obj \
	geomgraph\index\MonotoneChainIndexer.obj \
	geomgraph\index\SegmentIntersector.obj \
	geomgraph\index\SimpleEdgeSetIntersector.obj \
	geomgraph\index\SimpleMCSweepLineIntersector.obj \
	geomgraph\index\SimpleSweepLineIntersector.obj \
	geomgraph\index\SweepLineEvent.obj \
	geomgraph\index\SweepLineSegment.obj \
	index\bintree\Bintree.obj \
	index\bintree\Interval.obj \
	index\bintree\Key.obj \
	index\bintree\Node.obj \
	index\bintree\NodeBase.obj \
	index\bintree\Root.obj \
	index\chain\MonotoneChain.obj \
	index\chain\MonotoneChainBuilder.obj \
	index\chain\MonotoneChainOverlapAction.obj \
	index\chain\MonotoneChainSelectAction.obj \
	index\quadtree\DoubleBits.obj \
	index\quadtree\IntervalSize.obj \
	index\quadtree\Key.obj \
	index\quadtree\Node.obj \
	index\quadtree\NodeBase.obj \
	index\quadtree\Root.obj \
	index\quadtree\Quadtree.obj \
	index\strtree\AbstractNode.obj \
	index\strtree\AbstractSTRtree.obj \
	index\strtree\Interval.obj \
	index\strtree\ItemBoundable.obj \
	index\strtree\SIRtree.obj \
	index\strtree\STRtree.obj \
	index\sweepline\SweepLineEvent.obj \
	index\sweepline\SweepLineIndex.obj \
	index\sweepline\SweepLineInterval.obj \
	io\ByteOrderDataInStream.obj \
	io\ByteOrderValues.obj \
	io\ParseException.obj \
	io\StringTokenizer.obj \
	io\Unload.obj \
	io\WKBReader.obj \
	io\WKBWriter.obj \
	io\WKTReader.obj \
	io\WKTWriter.obj \
	io\Writer.obj \
	noding\IntersectionAdder.obj \
	noding\IntersectionFinderAdder.obj \
	noding\IteratedNoder.obj \
	noding\MCIndexNoder.obj \
	noding\NodingValidator.obj \
	noding\Octant.obj \
	noding\ScaledNoder.obj \
	noding\SegmentNode.obj \
	noding\SegmentNodeList.obj \
	noding\SegmentString.obj \
	noding\SimpleNoder.obj \
	noding\snapround\HotPixel.obj \
	noding\snapround\MCIndexPointSnapper.obj \
	noding\snapround\MCIndexSnapRounder.obj \
	noding\snapround\SimpleSnapRounder.obj \
	operation\buffer\BufferBuilder.obj \
	operation\buffer\BufferOp.obj \
	operation\buffer\BufferSubgraph.obj \
	operation\buffer\OffsetCurveBuilder.obj \
	operation\buffer\OffsetCurveSetBuilder.obj \
	operation\buffer\RightmostEdgeFinder.obj \
	operation\buffer\SubgraphDepthLocater.obj \
	operation\distance\ConnectedElementLocationFilter.obj \
	operation\distance\ConnectedElementPointFilter.obj \
	operation\distance\DistanceOp.obj \
	operation\distance\GeometryLocation.obj \
	operation\GeometryGraphOperation.obj \
	operation\IsSimpleOp.obj \
	operation\linemerge\EdgeString.obj \
	operation\linemerge\LineMergeDirectedEdge.obj \
	operation\linemerge\LineMergeEdge.obj \
	operation\linemerge\LineMergeGraph.obj \
	operation\linemerge\LineMerger.obj \
	operation\linemerge\LineSequencer.obj \
	operation\overlay\EdgeSetNoder.obj \
	operation\overlay\ElevationMatrix.obj \
	operation\overlay\ElevationMatrixCell.obj \
	operation\overlay\LineBuilder.obj \
	operation\overlay\MaximalEdgeRing.obj \
	operation\overlay\MinimalEdgeRing.obj \
	operation\overlay\OverlayNodeFactory.obj \
	operation\overlay\OverlayOp.obj \
	operation\overlay\PointBuilder.obj \
	operation\overlay\PolygonBuilder.obj \
	operation\polygonize\PolygonizeDirectedEdge.obj \
	operation\polygonize\PolygonizeEdge.obj \
	operation\polygonize\EdgeRing.obj \
	operation\polygonize\PolygonizeGraph.obj \
	operation\polygonize\Polygonizer.obj \
	operation\predicate\RectangleContains.obj \
	operation\predicate\RectangleIntersects.obj \
	operation\predicate\SegmentIntersectionTester.obj \
	operation\relate\EdgeEndBuilder.obj \
	operation\relate\EdgeEndBundle.obj \
	operation\relate\EdgeEndBundleStar.obj \
	operation\relate\RelateComputer.obj \
	operation\relate\RelateNode.obj \
	operation\relate\RelateNodeFactory.obj \
	operation\relate\RelateNodeGraph.obj \
	operation\relate\RelateOp.obj \
	operation\valid\ConnectedInteriorTester.obj \
	operation\valid\ConsistentAreaTester.obj \
	operation\valid\IsValidOp.obj \
	operation\valid\QuadtreeNestedRingTester.obj \
	operation\valid\RepeatedPointTester.obj \
	operation\valid\SimpleNestedRingTester.obj \
	operation\valid\SweeplineNestedRingTester.obj \
	operation\valid\TopologyValidationError.obj \
	planargraph\DirectedEdge.obj \
	planargraph\DirectedEdgeStar.obj \
	planargraph\Edge.obj \
	planargraph\Node.obj \
	planargraph\NodeMap.obj \
	planargraph\PlanarGraph.obj \
	planargraph\Subgraph.obj \
	planargraph\algorithm\ConnectedSubgraphFinder.obj \
	precision\CommonBits.obj \
	precision\CommonBitsOp.obj \
	precision\CommonBitsRemover.obj \
	precision\EnhancedPrecisionOp.obj \
	precision\GeometrySnapper.obj \
	precision\LineStringSnapper.obj \
	precision\SimpleGeometryPrecisionReducer.obj \
	simplify\DouglasPeuckerLineSimplifier.obj \
	simplify\DouglasPeuckerSimplifier.obj \
	simplify\LineSegmentIndex.obj \
	simplify\TaggedLineSegment.obj \
	simplify\TaggedLinesSimplifier.obj \
	simplify\TaggedLineString.obj \
	simplify\TaggedLineStringSimplifier.obj \
	simplify\TopologyPreservingSimplifier.obj \
	util\Assert.obj \
	util\AssertionFailedException.obj \
	util\GeometricShapeFactory.obj \
	util\IllegalArgumentException.obj \
	util\math.obj \
	util\Profiler.obj \
	util\UnsupportedOperationException.obj \
	..\capi\geos_c.obj \
	inlines.obj

TEST_EXE =	TestSweepLineSpeed.exe

default:	$(LIBNAME) $(DLLNAME) $(CDLLNAME)

$(LIBNAME):	headers/geos/platform.h headers/geos/version.h capi/geos_c.h $(OBJ)
	if exist $(LIBNAME) del $(LIBNAME)
	lib /out:$(LIBNAME) $(OBJ)

$(DLLNAME):	$(OBJ)
	link /dll /debug $(OBJ) /out:$(DLLNAME) /implib:$(SLIBNAME)

$(CDLLNAME): ..\capi\geos_c.obj $(DLLNAME)
	link /dll /debug ..\capi\geos_c.obj $(LIBNAME) /out:$(CDLLNAME) /implib:$(CLIBNAME)
  
headers/geos/platform.h: headers/geos/platform.h.vc
	copy headers\geos\platform.h.vc headers\geos\platform.h

headers/geos/version.h: headers/geos/version.h.vc
    copy headers\geos\version.h.vc headers\geos\version.h

capi/geos_c.h: ../capi/geos_c.h.vc
	copy ..\capi\geos_c.h.vc ..\capi\geos_c.h
   
.cpp.obj:
	$(CC) $(CFLAGS) /c $*.cpp /Fo$@

.c.obj:
	$(CC) $(CFLAGS) /c $*.c /Fo$@

clean:
	del $(LIBNAME)
	del $(SLIBNAME)
	del $(DLLNAME)
	del $(SLIBNAME)
	del $(CLIBNAME)
	del ..\capi\*.obj
	del *.exe
	del *.exp
	del *.ilk
	del *.pdb
	for %d in ( $(GEOS_DIRLIST) ) do \
		del %d\*.obj 
	

TestSweepLineSpeed.exe:	$(LIBNAME) \
		bigtest\GeometryTestFactory.obj \
		bigtest\TestSweepLineSpeed.obj
	link /debug /out:TestSweepLineSpeed.exe \
		bigtest\TestSweepLineSpeed.obj \
		bigtest\GeometryTestFactory.obj \
		$(LIBNAME)

geostest.exe: $(DLLNAME) ..\capi\geostest.obj
	link /debug ..\capi\geostest.obj $(SLIBNAME)
