[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目錄后

1 autogen.bat 2 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.

 1 #
 2 # NMAKE Makefile to build GEOS on Windows
 3 ###############################################################################
 4 # This makefile.vc delegates making targets to src\makefile.vc
 5 # so it's just a thin wrapper.
 6 #
 7 #     Building on Win32 with Visual Studio
 8 #     ------------------------------------
 9 #
10 # 1) Requires Visual C++ 2002 or later
11 # 2) Build running command "nmake /f makefile.vc" in top-level directory
12 #
13 # Produces:
14 #  src\geos.dll: DLL - only exports the C API
15 #  src\geos_i.lib: Stub library to link against for use of geos.dll. 
16 #  src\geos.lib: static library for use of C or C++ API.
17 ###############################################################################
18 GEOS_ROOT=.
19 !INCLUDE $(GEOS_ROOT)\nmake.opt
20 
21 default: src_dir
22 
23 src_dir:
24     cd src
25     $(MAKE) /f makefile.vc
26     cd ..
27 
28 clean:    
29     cd src
30     $(MAKE) /f makefile.vc clean
31     cd ..
View Code

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源代碼目錄下的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執行就可以了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM