OSGEarth环境搭建

1.下载OsgEaarth2.8源码

https://codeload.github.com/gwaldron/osgearth/legacy.zip/osgearth-2.8

2.下载perl

编译CURL需要perl

http://downloads.activestate.com/ActivePerl/releases/5.24.1.2402/ActivePerl-5.24.1.2402-MSWin32-x64-401627.exe

3.下载CURL源码

https://codeload.github.com/bingxueyouwu/curl/zip/master

4.下载ZLIB源码

http://124.205.69.163/files/523900000520E796/www.zlib.net/zlib-1.2.11.tar.gz

5.下载GDAL源码

  http://124.205.69.132/files/9063000005336BEB/download.osgeo.org/gdal/2.1.3/gdal213.zip

  编译GDAL,打开“VS2015 开发人员命令提示",

    

  进入GDAL-2.1.3的目录,

  编译32位版本命令  

    nmake /f makefile.vc

    nmake /f makefile.vc install    

    nmake /f makefile.vc devinstall 

  编译64位版本命令    

   nmake /f makefile.vc MSVC_VER=1900 WIN64=YES

   nmake /f makefile.vc install MSVC_VER=1900 WIN64=YES

   nmake /f makefile.vc devinstall MSVC_VER=1900 WIN64=YES    

   其中 MSVC_VER 和VS版本关系如下

    # nmake -f makefile.vc MSVC_VER=xxxx
    # where xxxx is one of following:
    # 1900 = 14.0(2015)
    # 1800 = 12.0(2013)
    # 1700 = 11.0(2012)
    # 1600 = 10.0(2010)
    # 1500 = 9.0 (2008)
    # 1400 = 8.0 (2005) 
    # 1310 = 7.1 (2003)
    # 1300 = 7.0 (2002)
    # 1200 = 6.0

   可参考  http://www.cnblogs.com/geospatial/p/5634033.html

    

 

编译geos

>VCVARS32.BAT
>cd d:geos350
>atuogen.bat
>nmake /f makefile.vc

geos编译出现错误时参考   http://blog.sina.com.cn/s/blog_48ff6e140102x7gg.html 

                                    http://blog.csdn.net/csxiaoshui/article/details/51800955

osgearth 暂不支持geos 3.6.1 详见,请使用3.5.1及以前版本

5.下载protobuf 

  https://github.com/google/protobuf

 编译protobuf

  https://github.com/google/protobuf/blob/master/cmake/README.md

     cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../install ../..
     cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=../../../install ../..
     Compiling nmake
     Install nmake install

编译OSGEarth中出现的问题:

1.OSGEarth/QuadTree.h中   找不到META_Shape这个预定义方法,进而产生一系列的错误

解决过程:首先,这QuadTree.h这个文件中看到有<osg/Shape>和<osg/Geometry>两个引用,推断META_Shape这个预定义方法有可能定义在OSG中。

     接着在OPENSCENEGRAPH工程搜索META_Shape,果然在<osg/KdTree>中发现了这个预定义方法,心想是不是OSGEarth工程的引用目录中

     没有添加OSG_INCLUE_PATH,添加之后,依然报错。再次检查了QuadTree.h的引用头文件和命名空间,发现引用命名空间中没有osg,怀疑是

     未引命名空间导致项目找不到KdTree这个头文件,依此思中,在QuadTree.h和QuadTree.cpp中添加 【   using namespace osg;    】后,错

       误消失。

2.提示找不到这个   osg::Referenced::setThreadSafeReferenceCounting  成员方法

解决过程:这个问题相对简单一些,这个方法已经被移除掉了,可参见giuhub上的回答


原文地址:https://www.cnblogs.com/jinlun/p/6688271.html