Osgearth compilation needs OSG and some third-party plug-in library, I mainly refer to the cnblogs on a blog post, but also not enough detail, and I have compiled a good OSG the situation to compile Osgearth, so the period also encountered some problems, I explained in detail below:
- Note: First you need to compile all the plugins and OSG, as well as Osgearth to use the same VS platform, the following compilation is done in VS2008 SP1 environment
- Preparation (refer to Bindings City Prodigal blog)
The required plugins and libraries for download include:
Download: http://osgearth.org/wiki/Downloads
CURL (curl-7.21.7.tar.gz): http://curl.haxx.se/download.html
GDAL (gdal-1.8.0.tar.gz): Http://trac.osgeo.org/gdal/wiki/DownloadSource
GEOS (geos-3.2.2.tar.bz2): http://trac.osgeo.org/geos/
EXE file: Http://files.cnblogs.com/eaglezhao/expat-win32bin-2.0.1.rar
Libzip (libzip-windows.zip): code:http://nih.at/libzip/
The compiled package is available for download:
Vs2008:http://wush.net/trac/osgearth/raw-attachment/wiki/downloads/libzip-windows.zip
VS2010:
Http://files.cnblogs.com/eaglezhao/libzip (VS10). rar
Osgearth (SVN download): Svn:http://svn.github.com/gwaldron/osgearth.git (currently the latest version is Osgearth 2.0)
- Installation:
- CURL
Note that you download if the source version, directly compiled with VS2008, you can also download the precompiled version, but there is missing a debug library file.
After compiling the directory under the Include/curl file copy to E:\OSG\3rdparty\include\curl, to cover
After compiling the directory under the Lib Libcurl.dll file copied to E:\OSG\3rdparty\bin, to cover
- GDAL
After downloading Gdal's source code, you also need to run Makegdal_gen.bat this file first, and then open X:\Program Files\Microsoft Visual Studio\vc98\bin\vcvars32. Bat,x represents your VS installation disk. Switch to your Gdal directory with the CD command after opening, nmake/f Makefile.vc msvc_ver=1500 Build_debug=yes, where 1500 represents vs version 2008, Of course you can also enter NMAKE configuration file modification.
Gdal compiled files are stored in C:\warmerda\bld, including file Include,lib,data,bin, which can be copied to the Gdal folder and placed under the OSG directory. Finally, the following work is done:
Copy the. h file under the ALG, Gcore, OGR, and port folders to the include, the generated LIB, DLL includes: Gdal_i.lib gdal.lib cpl.lib (under the port directory) ogr.lib (ogr directory), and Gdal18.dll
Copy to D:\OSG\GDAL\lib
- GEOS
Compile the GEOS by compiling the Gdal consent method. Copy the generated geosd.lib,geos.lib, Geos_c_i.lib, Geosd_c_i.lib to D:\OSG\geos\lib, geos-3.2.2\source\ Copy the GeoS folder under headers to the include.
The final file structure:
Note that the inside of the expat I did not use, may have been included in other libraries.
OSG is already compiled, and the OSG environment variable has been set, then CMake will automatically find your OSG
The path of the.
- Compiling Osgearth
Use CMake to open Osgearth cmakeLIsts.txt
Change Dynamic_osgearth (bool variable) on
Osg_dir (PATH) x:/osg/openscenegraph
Specific cmake inside the setting reference:
The final thing is to delete the contents of the NotFound items, that is, empty.
Then build vs solution, enter vs after the inside to set the Include file and library file
After the build is complete, run the install project to build.
Note to generate debug and release two versions, like OSG, Debug and release version to correspond, otherwise it will be wrong, the corresponding debug command and library files are set separately, otherwise you may not find plug-ins or other problems.
- Environment variable Configuration
Copy the files under the D:\OSG\OSGEARTH\lib\Debug and release folders to the Debug and release folders under D:\OSG\OSGEARTH\bin, and then run the. exe, which is missing a. dll, and the search is copied in ( Gdal18.dll under the Gdal folder).
environment variable Settings
osg_file_path:D: \osg\osgearth\data;d:\osg\gdal\data;
PATH: e:\osg\3rdparty\bin;d:\osg\osgearth\bin\debug; D:\OSG\OSGEARTH\bin\Release;
Finally you go from CMD to the tests folder of the source directory to test whether the installation was successful.
A textured Earth appears, indicating that it has been installed successfully. Otherwise, there is a mistake. Most of the time, the plugin compiles the issue.