[GDAL]GEOS和Proj4编译

1.下载源码

geos-3.4.2.tar.bz2  http://trac.osgeo.org/geos/

proj-4.8.0.zip     http://trac.osgeo.org/proj/wiki/WikiStart#Download

启动VS2010 x64兼容命令提示符

2.首先编译GEOS,进入Geos目录后

 autogen.bat
nmake /f makefile.vc

编译debug版本

nmake /f makefile.vc BUILD_DEBUG=YES

说明F:\gdal\geos-3.4.2文件夹下的makefile.vc

# This makefile.vc delegates making targets to src\makefile.vc
# so it's just a thin wrapper.

 #
# NMAKE Makefile to build GEOS on Windows
###############################################################################
# This makefile.vc delegates making targets to src\makefile.vc
# so it's just a thin wrapper.
#
# Building on Win32 with Visual Studio
# ------------------------------------
#
# ) Requires Visual C++ or later
# ) Build running command "nmake /f makefile.vc" in top-level directory
#
# Produces:
# src\geos.dll: DLL - only exports the C API
# src\geos_i.lib: Stub library to link against for use of geos.dll.
# src\geos.lib: static library for use of C or C++ API.
###############################################################################
GEOS_ROOT=.
!INCLUDE $(GEOS_ROOT)\nmake.opt default: src_dir src_dir:
cd src
$(MAKE) /f makefile.vc
cd .. clean:
cd src
$(MAKE) /f makefile.vc clean
cd ..

3.接着编译Proj4

nmake /f makefile.vc install-all

4.最后编译GDAL

首先说明下我的文件目录F:\gdal文件夹下将gdal-1.10.0、geos-3.4.2和proj-4.8.0放在一起

[GDAL]GEOS和Proj4编译

使用记事本或者其他的文本编辑器打开GDAL源代码目录下的nmake.opt文件,找到“# Uncomment for GEOS support”这句,大概在490行左右,将下面三行代码:

#GEOS_DIR=C:/warmerda/geos

#GEOS_CFLAGS =-I$(GEOS_DIR)/capi -I$(GEOS_DIR)/source/headers -DHAVE_GEOS

#GEOS_LIB     =$(GEOS_DIR)/source/geos_c_i.lib

修改为:

GEOS_DIR=F:\gdal\geos-3.4.2
GEOS_CFLAGS = -I$(GEOS_DIR)/capi -I$(GEOS_DIR)/include -DHAVE_GEOS
GEOS_LIB     = $(GEOS_DIR)/src/geos_c_i.lib

GEOS_DIR是geos-3.4.2编译后的文件夹路径:F:\gdal\geos-3.4.2。头文件主要在capi和include文件夹。

找到下面三行代码:

#PROJ_FLAGS =-DPROJ_STATIC

#PROJ_INCLUDE =-Id:\projects\proj.4\src

#PROJ_LIBRARY =d:\projects\proj.4\src\proj_i.lib

修改为:

#PROJ_FLAGS = -DPROJ_STATIC
PROJ_INCLUDE = -IF:\gdal\proj-4.8.0\src
PROJ_LIBRARY = F:\gdal\proj-4.8.0\src\proj_i.lib

不知道是不是我之前用中文路径的原因,开始编译时出了找不到geos_c.h的错误,然后我就改成现在的路径。

接下来的修改和编译按照http://www.cnblogs.com/yhlx125/p/3550957.html执行就可以了。

上一篇:ISP与DSP的区别【转】


下一篇:[SAM4N学习笔记]按键程序(查询方式)