前题条件
完成osg 3.0的编译
Step 1 下载osgEarth 2.1.1
https://github.com/gwaldron/osgearth/downloads------------》https://github.com/gwaldron/osgearth/releases/tag/osgearth-2.5

                          ------------》http://osgearth.org/
Step 2 下载gdal 1.8.1并编译
下载地址:http://trac.osgeo.org/gdal/wiki/DownloadSource
编译方法:
运行vcvar32.bat
在gdal1.8.1的当前目录运行nmake /f makefile.vc MSVC_VER=1600
nmake /f makefile.vc install
nmake /f makefile.vc devinstall
最终结果在c:\warmerda下
Step 3 下载geos 3.3.2 并编译
下载地址:http://trac.osgeo.org/geos/
编译方法:
运行vcvar32.bat
双击运行autogen.bat
nmake /f makefile.vc MSVC_VER=1600
最终结果在c:\warmerda下

Step 4 下载SQLite 3.7.10
下载地址 :http://www.sqlite.org/download.html
建立一个静态链接工程,加入sqlite3开头的三个文件
建立一个exe工程,加入shell.c
将静态结果更名为sqlited.lib和sqlite.lib,分别表示debug和release版本
Step5 下载libzip的编译结果
下载地址:http://files.cnblogs.com/eaglezhao/libzip(vs10).rar
Step6 下载zlib并编译
下载地址:http://www.winimage.com/zLibDll/minizip.html
进入contrib\vstudio\vc10目录,双击工程进行编译。
step7 下载并编译proj 4
下载地址:http://trac.osgeo.org/proj/
编译方法
运行vcvar32.bat
nmake /f makefile.vc install
nmake /f makefile.vc install-all
step 8 使用cmake编译osgEarth
step 9 测试编译结果

详细编译步骤:

(1)将来自step1 下载的osgearth源文件解压到"019.Earth\builder\code\osgearth2.1.1\src"

(2)  将"019.Earth\builder\code\osg3.0\src"中3rdparty 拷贝到"019.Earth\builder\code\osgearth2.1.1”中

创建“019.Earth\builder\code\osgearth2.1.1\vc”文件夹

(3)编译"geos" 编译方法与GDAL编译方法相似,

  将vcvar32.bat拖进cmd窗口中

cd 进入到geos-3.3.2目录中

autogen.bat

  nmake /f makefile.vc MSVC_VER=1600

执行上述语句后

----------->如果是geos3.3.2版本将会报错"BufferOp.cpp<97> error c2668",新的版本不会报错

-----------》所要修改的内容是BufferOp.cpp 97 行 std::log(10)改为 std::log(10.0)

  提示编译成功,结果文件存放在"geos-3.3.2\src"中  -->geos.dll

                          -->geos.lib

                          -->geos_c_i.lib

                          -->geos_i.lib

                          -->geos_c.dll

将上述文件拷贝到"019.Earth\builder\runtime\geos3.3.2\bin“中

  将"geos-3.3.2\include"中文件拷贝到 "019.Earth\builder\runtime\geos3.3.2\include“中

   path 中添加 "builder->runtime->geos3.3.2->bin"

(4)编译SQLite 下载源文件(详细路径见step 4 )sqlite-amalgamation-3071000.zip

a.     解压下载的压缩文件(shell.c    sqlite3.c   sqlite3.h   sqlite3ext.h)到"*\sqlite-amalgamation-3071000\"目录

b.     需要建立两个工程,

      (b1)---------->VS2010->File->new->project->visual C++->win32 console application->Name( 输入 "sqlite" )->Location(输入"*\sqlite-amalgamation-3071000\")->点击"OK"->application settings选择"empty project" ->点击"Finish"

(b2)"Solution 'sqlit/1project'"右键->Add"New Project"->win32 console application->Name( 输入 "shell" )->OK->"Application Settings"(选中"Empty project")->"Finish"

(b3)修改"sqlite"项目类型:右键"Properties"->"Congiguration Properties"->"Configuration Type"(改为 "Static library(.lib)")->"Target Extension"(改为 ".lib")->点击"应用"            -----》注:debug release 两个版本都需要修改

(b4)Build->Batch Build->   shell Debug Win32 ->Build

shell Release Win32

sqlite Debug Win32

sqlite Debug Win32

(b5)shell->"source files"->add->Existing Item->"*\sqlite-amalgamation-3071000\shell.c"

(b6)sqlite->"source files"->add->Existing Item->"*\sqlite-amalgamation-3071000\sqlite3.c"

                             ->"*\sqlite-amalgamation-3071000\sqlite3.h"

                             ->"*\sqlite-amalgamation-3071000\sqlite3ext.h"

(b7)重复b4步骤

(b8)因为shell编译的时候需要链接到sqlite.lib,所以报错

(b9)"\sqlite-amalgamation-3071000\(shell.c    sqlite3.c   sqlite3.h   sqlite3ext.h)"   四个文件全部都拷贝到   "019.Earth\builder\runtime\sqlite3\include“

            "*\sqlite-amalgamation-3071000\sqlite\Debug\sqlite.lib"   拷贝到  "019.Earth\builder\runtime\sqlite3\bin“中并重命名为"sqlited.lib"

"*\sqlite-amalgamation-3071000\sqlite\release\sqlite.lib"   拷贝到  "019.Earth\builder\runtime\sqlite3\bin“

(b10)对shell工程进行链接:shell-》右键-》property pages->Linker->input->"Additional dependencies"->点击"Edit"---

          ->添加"019.Earth\builder\runtime\sqlite3\bin\sqlited.lib"(debug版)

->添加"019.Earth\builder\runtime\sqlite3\bin\sqlite.lib"(release版)

      (b11)Build->Batch Build->   shell Debug Win32 ->Build

shell Release Win32

(b12)进行shell工程生成的文件的拷贝:

        "*\sqlite-amalgamation-3071000\sqlite\Debug\shell.exe"   拷贝到  "019.Earth\builder\runtime\sqlite3\bin“中并重命名为"shelld.exe"

"*\sqlite-amalgamation-3071000\sqlite\Release\shell.exe"   拷贝到  "019.Earth\builder\runtime\sqlite3\bin“中

(b13)设置环境变量

path添加"019.Earth\builder\runtime\sqlite3\bin“

(5)MiniZip的编译:a.zlib:第三方库中"3rdparty/lib"包括"zlib1.lib zlib1d.lib"

b.libzip:可以通过step5下载到编译好的vs2010的版本(libzip(vs10).rar),将其解压,

将解压后的"libzip\(bin include lib man)"四个全部的文件夹 放到“3rdparty”文件夹中

(6)proj 4的编译:a.通过step7进行下载,下载结果为"proj-4.7.0.zip",进行解压,解压后文件夹为"proj-4.7.0";

b.cd 到  文件夹"proj-4.7.0"中,方法同编译GDAL

          nmake /f makefile.vc  MSVC_VER=1600

nmake /f makefile.vc install

          nmake /f makefile.vc install-all

                    c.最后的编译结果存放在"C:\PROJ"

将"C:\PROJ"拷贝到“019.Earth\builder\runtime\”  并将“PROJ”文件夹重命名为“PROJ4”

d.将“019.Earth\builder\runtime\PROJ4\bin” 添加到 path目录

(7)编译osgearth:  a.点击"cmake"            “where is the source code”->"019.Earth\builder\code\osgearth2.1.1\src"

"where to build the binaries"->“019.Earth\builder\code\osgearth2.1.1\vc”

         b.点击"Configure"按钮, 选择"Advanced","Specify the generatro for this project " 对话框中选择"Visual Studio 10" "Use default native compilers" 后点击"Finish"  弹出错误“Error in configuration process,project files may be invalid” ,点击"OK"

c.修复相关错误:

CURL_INCLUDE_DIR->"019.Earth/builder/code/osgearth2.1.1/3rdparty/include"

CURL_LIBRARY->"019.Earth/builder/code/osgearth2.1.1/3rdparty/lib/curllib.lib"

CURL_LIBRARY_DEBUG->"019.Earth/builder/code/osgearth2.1.1/3rdparty/lib/curllibd.lib"

GDAL_INCLUDE_DIR-> "019.Earth/builder/runtime/GDAL1.8.1/include"

GDAL_LIBRARY-> "019.Earth/builder/runtime/GDAL1.8.1/lib/gdal_i.lib"

GEOS_INCLUDE_DIR-> "019.Earth/builder/runtime/geos3.3.2/include"

GEOS_LIBRATY-> "019.Earth/builder/runtime/geos3.3.2/bin/geos.lib"

           GEOS_LIBRATY_DEBUG-> "019.Earth/builder/runtime/geos3.3.2/bin/geos_i.lib"

LIBZIP_INCLUDE_DIR->"019.Earth/builder/code/osgearth2.1.1/3rdparty/include"

LIBZIP_LIBRARY->"019.Earth/builder/code/osgearth2.1.1/3rdparty/lib/zip.lib"

OSG_INCLUDE_DIR->"019.Earth/builder/runtime/osg3.0/include"

ZLIB_INCLUDE_DIR->"019.Earth/builder/code/osgearth2.1.1/3rdparty/include"

ZLIB_LIBRARY->"019.Earth/builder/code/osgearth2.1.1/3rdparty/lib/zlib1.lib"

SQLITE3_INCLUDE_DIR->"019.Earth/builder/runtime/sqlite3/include"

SQLITE3_LIBRARY->"019.Earth/builder/runtime/sqlite3/bin/sqlite.lib"

OSG_DIR->"019.Earth/builder/runtime/osg3.0"

OSG_GEN_INCLUDE_DIR->"019.Earth/builder/runtime/osg3.0"

再次点击"Configure" ,minizip报错(step6 zlib中可能包含minizip)

忽略minizip错误,再次点击"Configure",无错误,点击"Generate"

"generate"完成后,打开“019.Earth\builder\code\osgearth2.1.1\vc”文件夹,启动"OSGEARTH.sln"

"Build"->"Batch Build" : 构建"ALL_BUILD"   "Debug"  "Debug|Win32"

                     构建"ALL_BUILD"   "Release"  "Release|Win32"

点击"BUILD"

编译成功 124个全部完成,

进行环境变量配置.

将 “019.Earth\builder\code\osgearth2.1.1\”中3rdparty 文件夹 拷贝到  "019.Earth/builder/runtime/osgearth"中

然后将"019.Earth/builder/runtime/osgearth/3rdparty/bin"  路径添加到 path中

将 “019.Earth\builder\code\osgearth2.1.1\src\src”中所有文件 拷贝到  "019.Earth/builder/runtime/osgearth/include"中

将  “019.Earth\builder\code\osgearth2.1.1\vc\lib\release”中所有.lib .dll文件 拷贝到 "019.Earth/builder/runtime/osgearth/lib"中

将  “019.Earth\builder\code\osgearth2.1.1\vc\lib\debug”中所有.lib .dll文件 拷贝到 "019.Earth/builder/runtime/osgearth/lib"中

将  “019.Earth\builder\code\osgearth2.1.1\vc\bin\debug”中所有.exe文件 拷贝到 "019.Earth/builder/runtime/osgearth/bin"中

将  “019.Earth\builder\code\osgearth2.1.1\vc\bin\release”中所有.exe文件 拷贝到 "019.Earth/builder/runtime/osgearth/bin"中

将 "019.Earth/builder/runtime/osgearth/lib" 中所有.dll文件 拷贝到"019.Earth/builder/runtime/osgearth/bin"中

然后将"019.Earth/builder/runtime/osgearth/bin" 放入path中

将"019.Earth\builder\code\osgearth2.1.1\src" 中data文件夹和tests文件夹 拷贝到 "019.Earth/builder/runtime/osgearth“文件夹中

重启电脑(??设置环境变量后)

cd 进入到 "019.Earth/builder/runtime/osgearth/tests” 目录

cd osgearth_viewer boston_buildings.earth(存在于"019.Earth/builder/runtime/osgearth/tests文件夹中)

运行成功后 osgearth 编译完成 所有的bin目录都会被设置环境变量

第一讲(3)osgearth编译的更多相关文章

  1. 《ArcGIS Engine+C#实例开发教程》第一讲桌面GIS应用程序框架的建立

    原文:<ArcGIS Engine+C#实例开发教程>第一讲桌面GIS应用程序框架的建立 摘要:本讲主要是使用MapControl.PageLayoutControl.ToolbarCon ...

  2. 32位汇编第一讲x86和8086的区别,以及OllyDbg调试器的使用

    32位汇编第一讲x86和8086的区别,以及OllyDbg调试器的使用 一丶32位(x86也称为80386)与8086(16位)汇编的区别 1.寄存器的改变 AX 变为 EAX  可以这样想,16位通 ...

  3. C++反汇编第一讲,认识构造函数,析构函数,以及成员函数

    C++反汇编第一讲,认识构造函数,析构函数,以及成员函数 以前说过在C系列下的汇编,怎么认识函数.那么现在是C++了,隐含有构造和析构函数 一丶认识构造函数 高级代码: class MyTest { ...

  4. python学习第一讲,python简介

    目录 python学习第一讲,python简介 一丶python简介 1.解释型语言与编译型语言 2.python的特点 3.python的优缺点 二丶第一个python程序 1.python源程序概 ...

  5. OSGEarth编译

    解决OSGEarth编译时出现error LNK1181: 无法打开输入文件“optimized.lib的问题 以下方案受到了osg大神qq网名为“阿威.小号”的帮助. 在采用Cmake3.6.2创建 ...

  6. CS193P - 2016年秋 第一讲 课程简介

    Stanford 的 CS193P 课程可能是最好的 ios 入门开发视频了.iOS 更新很快,这个课程的最新内容也通常是一年以内发布的. 最新的课程发布于2016年春季.目前可以通过 iTunes ...

  7. OSG+VS2010+win7环境搭建---OsgEarth编译

    OSG+VS2010+win7环境搭建---OsgEarth编译 转:http://www.cnblogs.com/hnfxs/p/3161261.html Win7下 osg+vs2010环境搭建 ...

  8. POI教程之第一讲:创建新工作簿, Sheet 页,创建单元格

    第一讲 Poi 简介 Apache POI 是Apache 软件基金会的开放源码函数库,Poi提供API给java程序对Microsoft Office格式档案读和写的功能. 1.创建新工作簿,并给工 ...

  9. osgEarth编译(转载)

    osgEarth编译 osgEarth的编译需要osg和一些第三方插件库,我主要参考了cnblogs上的一篇博文,但是也不够详细,并且我是在已经编译好osg的情况下去编译osgEarth,所以期间也遇 ...

随机推荐

  1. SD--批量删除订单

    SD--批量删除订单 在sap应用中常常会需要批量删除一些错误录入的单据,为此开发了一个小程序.该程序为了安全,程序做了一下控制 1.限制用户只能删除自己的订单,不能删除别人输入的订单,如果需要修改一 ...

  2. web前端知识总结

    前言: 一直想着整理一下关于前端的知识体系和资料,工作忙了些,挤挤总会有的,资料很多,就看你能不能耐下心坚持去学了,要多学多敲多想,祝你进步~ 学习之前首先要大概了解什么是HTML ,CSS , JS ...

  3. RESTful 个人理解总结

    一.什么是RESTful 面向资源 简单的说:RESTful是一种架构的规范与约束.原则,符合这种规范的架构就是RESTful架构.   先看REST是什么意思,英文Representational ...

  4. JAVA关于泛型的笔记

    1.Java SE 5.0中增加泛型机制的主要原因是为了满足在1999年制定的最早的Java规范需求之一(JSR 14). 2.使用泛型机制编写的程序代码要比那些杂乱的使用Object变量,然后再进行 ...

  5. idea使用教程(2)

    目录: 1. open和import的区别 2.修改虚拟机配置信息 3.安装目录和设置目录 1. open和import的区别 open:如果本身就是idea项目,则可以直接open打开; impor ...

  6. Tp3.2 复合查询

    我们常常有这样的需求,比如搜索. 搜索出,标题,子标题,内容中包含某某关键字. 这就要and,or结合使用了. $where = ['is_show'=>1,'status'=>1]; / ...

  7. L2-021 点赞狂魔

    会set的基础用法就可以A了,虽然是L2题,但是不难,代码如下,很好理解,set在这里不解释了自己去网上查一下就明白了: #include<stdio.h> #include<str ...

  8. [转][osg]关于PagedLOD 加载卸载机制

    你的PagedLOD 为什么没有卸载 转自:http://bbs.osgchina.org/forum.php?mod=viewthread&tid=7612&highlight=Pa ...

  9. 认识flask框架

    1.框架的基本认识: 特点:用Python语言实现的轻量.简洁.扩展性强. 核心:werkzeug和Jinja2 2.虚拟环境: 创建:mkvirtualenv -p python3 名称 进入:wo ...

  10. JAVA基础知识总结:十五

    一.Set接口 Set集合不允许包含相同的元素,如果试图将两个相同的元素添加到一个集合中,使用add方法,添加失败,返回false 1.HashSet HashSet是Set集合的一个实现类,大多数情 ...