OSG+VS2010+WIN7 Environment Building---osgearth compilation

Source: Internet
Author: User

OSG+VS2010+WIN7 Environment Building---osgearth compilation

Ext.: http://www.cnblogs.com/hnfxs/p/3161261.html

OSG+VS2010 Environment Construction under Win7

A Related preparations

A) OSG source code

Current Latest version: OpenSceneGraph 3.0.0.zip

Download Link:

Http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-3.0/source/OpenSceneGraph-3.0.0.zip

b) OSG Third Party Library

3rdparty_vc10_x86_x64.zip

Http://members.iinet.net.au/~bchrist/3rdParty_VC10_x86_x64.zip

c) Data Packets

Current Latest Version: Openscenegraph-data-3.0.0.zip

Download Link:

Http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-3.0/data/OpenSceneGraph-Data-3.0.0.zip

d) Installing the Source Code tool

Cmake-2.8.4-win32-x86.exe.

Second, compile preparation

In order for the compilation to proceed smoothly, the downloaded file is organized as follows:

Set up a OSG folder in the C drive, and then the other files are placed as follows:

D:\OSG\OpenSceneGraph: Source extracted after the release of this

D:\OSG\3rdParty: Third-party dependent libraries are decompressed and placed in this

D:\OSG\OpenScenGraph-Data-3.0.0.zip: The packet is extracted and placed here.

Three Install Source code

A) After installing CMake, open Cmake-gui.exe

b) Source Openscenegraph-3.0.0.zip decompression, the inside of the CmakeLists.txt, dragged to the CMake interface.

c) Click Configure, select Visual Studio (x86), and make the relevant settings after finish:

Actual_3rdparty_dir value D:/osg/3rdparty;

build_osg_examples : On

Cmake_install_prefix : d:/osg/openscenegraph/;

Such as:

e) After clicking Configure, set advanced to tick, build_mfc_ example to on, and then the last configure configuration.

f) Click on the Generate, since this construction is complete.

Four Compile phase

A) Open OpenSceneGraph.sln with VS2010 (this file is under D:\OSG\OpenSceneGraph),

Build-Batch generation, build for All_build, select (Debug and release two versions), this compilation time is very long, estimated 4-5 hours.

b) After the completion of the 1th step, the install will also generate the corresponding compilation. The time will be shorter.

Five Data transfer

New OSG folder in C drive

Copy the Bin,include,lib folder under the D:\OSG\OpenSceneGraph to C:\OSG and copy the data under D:\OSG\OpenSceneGraph-Data-3.0.0 to C:\OSG\data These files are needed by OSG.

Six environment variable Settings

Set the system variable as follows:

Osg_file_path:c:\osg\data

Path:c:\osg\bin;

You can test osgversion,osglogo,osgviewer cow.osg at the command line.

Seven New OSG Project Test

A) Create a new WIN32 console program under VS2010

b) Add a CPP

c) Enter the following code:

#include <osgViewer/Viewer>

#include <osgDB/ReadFile>

int main (int argc, char **argv)

{

Osgviewer::viewer Viewer;

Viewer.setscenedata (Osgdb::readnodefile ("COW.OSG"));

return Viewer.run ();

}

d) Right-click the project, select "Properties", select "VC + + directory" in the Include directory to add: C:\OSG\include

Add: C:\OSG\lib in library directory.

e) Open the project properties of the linker, input, additional dependencies plus:

OpenThreadsd.lib

Osgd.lib

OsgDBd.lib

OsgUtild.lib

OsgGAd.lib

OsgViewerd.lib

OsgTextd.lib

f) operation, effect such as:

Osgearth compiling

Osgearth compile process Online There are many, at present I met the biggest problem is compiling Gdal source code, always appear problems, this seems to be the source code has a problem, can not directly open the SLN compilation, need to use command line compilation. Here's a solution to a Web page:

Http://www.cnblogs.com/carfield/archive/2012/02/27/2370472.html

The original content is as follows:

First of all, it is necessary to explain the introduction of gdal some knowledge, in Mr. Li Minhu's blog http://blog.csdn.net/liminlu0314/article/list/1?viewmode=contents has a better description of the , here, I cite his blog post, on his basis, to do something consistent with their own experience of the changes.

Here, I use the source code to compile the DLL static files that C # can use.

First, simple compilation 1, simple understanding

First enter the Gdal source code directory, you can see a few sln for the suffix of the file name, such as Makegdal10.sln,makegdal80.sln,makegdal71.sln,makegdal90.sln. These files are VisualStudio's engineering files, the following numbers correspond to the version number of VS, 71 represents the vs2003,80 representation of vs2005,90 VS2008, and 10 means VS2010, etc. Depending on your computer's installed VS version, open the corresponding file as shown (using the VS2008SP1 version, open the Makegdal90.sln file):

2. Compile with cmd command line

Before the operation, it is necessary to point out that the Gdal source code at least 1.7.0 before the error occurred

Modify the Bug,source files\leveller\levellerdataset.cpp file in Gdal 171 line

{"?, kpi/180.0, Unitlabel_degree}, will" "?" Modify to ""? " ", save;

There is no such problem with 1.9.0.

1) using cmd command-line compilation, first in "Start menu \ All Programs \microsoft Visual Studio 2008\visual Studio tools\ Visual Studio 2008 Command Prompt", click "Visual Studio 2008 Command Prompt "will pop up the following interface:

2) then use the CD command to switch to the Gdal source directory, as shown in:

3) After switching to the source code directory of the Gdal, enter the command line below and wait until the compilation is finished.

Nmake-f MAKEFILE.VC

Nmake-f MAKEFILE.VC Install

Nmake-f MAKEFILE.VC Devinstall

There are also other commands, such as:

Nmake-f MAKEFILE.VC Clean

Nmake-f MAKEFILE.VC Msvc_ver=1400clean

Nmake-f MAKEFILE.VC msvc_ver=1400debug=1

These three commands can be used without a tube.

The command meaning of the above six lines is in turn:

Compiling the Gdal library

Compile the Gdal library and install it (this means to copy the generated Dll,exe and other files to the C:\warmerda\bld directory).

Compile the Gdal library and install the developer mode (the installation means that the developer mode means to copy the header and Lib files from the development include folder to the C:\warmerda\bld directory, which will be in C:\warmerda\ BLD directory of more than two folders, respectively, include and Lib, respectively, is the gdal of the header and Lib files, used to call the Gdal library use).

Cleans up the Gdal library and removes the temporary files generated by the compiled Gdal Library, which acts as a cleanup command in the VS environment.

function as above, but added a msvc_ver=1400 that means compile with VS2005.

Compile Gdal library debug mode, can be used to debug Gdal source code.

4) After this

Type "CD C:\gdal-1.5.0\swig\csharp" to enter the folder where the C # source files are located. Of course, if your folder location is not here, you will need to change the address.

Type "nmake/f makefile.vc" and build 8 DLL files after compiling, together with a total of nine DLL can be found in the C disk before generating Warmerda\bld\bin.

At this point, all nine DLLs appear.

OSG+VS2010+WIN7 Environment Building---osgearth compilation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.