How to build OpenSceneGraph from source and third party dependencies?

荒凉一梦 提交于 2019-12-19 04:07:43

问题


How can I build OpenSceneGraph from source? What should I do to get the third party dependencies for OSG built?


回答1:


This is just an initial guide which will get basic OSG installed on your system. There are many other configuration changes and compilation with dependencies that you can do later (building third party libraries is specified after the first long dotted line).

  • Extract the OSG source code zip file to a folder
  • Download and install CMake from the CMake website
  • Run CMake
  • In CMake, set the source code folder as the equivalent of F:/ProgramFiles/OSG/OpenSceneGraph–3.1.1 and not as F:/ProgramFiles/OSG/OpenSceneGraph–3.1.1/src
  • Specify another folder for the OSG Binaries, like this: F:/ProgramFiles/OSG/OSG_3–1–1_Build
  • Click on 'Configure', select your compiler (VS2010 native compiler in my case)
  • Click on 'Generate'
  • If any problems happened during Configure or Generate, you can use the CMake menu options to delete the cache and try the whole process again.
  • Once generation is done, navigate to the Binaries folder (lets call it "build folder") and you'll see OpenSceneGraph.sln
  • Open the .sln file in Visual Studio, use solution explorer to find and build the ALL_BUILD project. It takes about 35–40 min for the build process on a dual core system with 2GB RAM. If you face any errors due to the compiler not finding any dependencies, just build the ALL_BUILD project again. Build; not re–build. Then, search for the INSTALL project in the same .sln file and build it.
  • That's it! you're ready to use OSG.

For the sake of uniformity, you can use these environment variables:
OSG_ROOT for specifying the location of the build folder
OSG_FILE_PATH for specifying the location of the sample models and images (The folder which you extract from OpenSceneGraph–Data–3.0.0.zip)
OSG_SOURCE for specifying the location of the source files which you just extracted from the zip file.
(Except for OSG_SOURCE, the rest were taken from the OSG tutorial/guide pdf's)

.....................................................................

Building third party libraries:
–––––––––––––––––––––––––––––––
Whether you've already done the above build process or not, you can reconfigure CMake to be able to build the third party libraries.
If you followed the above procedure, you might remember in the configuration process, it showed "Could not find libcurl" etc.
Now you're gonna show CMake where to find it.

  • Download the prebuilt third party libraries from http://openscenegraph.alphapixel.com/osg/downloads/openscenegraph–third–party–library–downloads
  • Select the version appropriate to you – VS2010, x86, debug or whatever and create a folder next to your OSG build folder, named ThirdPartyLibraries. Make a subfolder inside it, like debug_vs10_x86 or whatever you like.
  • Create an environment variable OSG_3RDPARTY_DIR and point it to this subfolder you created.

Lets say you're configuring for the curl library.
* Click 'configure' in CMake and in the CMake gui, you'll find that the CMake gui has a search field. Search for 'curl' and it'll show you two parameters to be set for curl. Replace the right side parameters (which will be something like CURL–INCLUDE–NOT–FOUND), to the include path of your third party library where curl's header is located.
* Same way, for what would be something like CURL–LIB–NOT–FOUND, replace it with the path to the lib file and at the end of the path, type the name of the lib file too. Eg: F:\ProgramFiles\OSG\ThirdPartyLibraries\debug_vc10_x86\lib\curllib.lib
* Do a similar thing for other libraries like TIFF, ZLIB, PNG etc.
* Once you're done with all of them, click 'Configure' and then 'Generate'.
* Go to your OSG build folder, find OpenSceneGraph.sln and build it as I've mentioned above.
* That's it!

More info on building third party libraries is in: http://binglongx.wordpress.com/2011/07/27/building–openscenegraph–3–0–0–from–source–for–both–x86–and–x64/



来源:https://stackoverflow.com/questions/10779029/how-to-build-openscenegraph-from-source-and-third-party-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!