Building osgEarth for Windows using vcpkg
admin
2023-04-06 03:03:06
0

vcpkg is an extremly useful C++ package manager. It works on Windows, Linux and MacOS but for this guide we’ll primarily focus on Windows.

First, download and bootstrap vcpkg following the instructions on the page.

Next install the dependencies required to build a fully functional osgearth

vcpkg install osg:x64-windows sqlite3:x64-windows protobuf:x64-windows poco:x64-windows

This will take awhile the first time you run it as this pulls down lots of dependencies, so go get a cup of coffee.

Once all the dependencies are built, you’ll need to actually build osgearth.

Get the source code

git clone https://github.com/gwaldron/osgearth.git

Create a directory for an out of source build

cd osgearth
mkdir build
cd build

Configure Cmake

vcpkg provides a Cmake toolchain file that helps osgEarth find all of it’s dependencies. You’ll need to specify a different build directory for Release and Debug and specify the build type using -DCMAKE_BUILD_TYPE. This is because some dependencies of osgEarth don’t pick up both debug and release versions without specifying the build type. This should be fixed in future cmake versions. This is for a release build


cmake .. -G "Visual Studio 15 2017 Win64" \
-DCMAKE_BUILD_TYPE=Release \
-DWIN32_USE_MP=ON \
-DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake

Build and install osgEarth

You can build and install osgEarth on the command line using cmake or you can open up the Visual Studio solution and build it from there.

cmake --build . --target INSTALL --config Release

Setting up your runtime environment

You’ll need to make sure that the vcpkg dependencies and osgEarth are in your path. So do something like this


set PATH=%PATH%;c:\vcpkg\installed\x64-windows\bin
set PATH=%PATH%;c:\vcpkg\installed\x64-windows\tools\osg
set PATH=%PATH%;c:\Program Files\osgEarth\bin

Note: If you don’t want to build osgEarth yourself for your application, you can actually install it using vcpkg as well. Just use

vcpkg install osgearth:x64-windows

相关内容

热门资讯

青海海南州再发生5.8级地震 中国地震台网正式测定:07月28日11时34分在青海海南州兴海县(北纬35.35度,东经99.58度...
风声丨支持率一夜狂跌,高市早苗... 作者丨郁风媒体评论员日本首相高市早苗,近日民调支持率突然迎来崩盘式下跌,从原本居高不下的六成左右下跌...
50年后再访唐山:经历过地震那... 澎湃新闻记者 高丹1976年7月28日,凌晨3时42分56秒,大地颠簸。一座百万人口的工业城市成为一...
上半年全国挽回税款1806亿元 国家税务总局副局长王道树7月28日在国新办新闻发布会上表示,今年上半年,全国依法查处各类涉税违法行为...
青海兴海县发生5.7级地震,震... 中国地震台网正式测定:07月28日11时16分在青海海南州兴海县(北纬35.35度,东经99.57度...
中国海警紧急救援越南籍遇险船舶 7月25日19时37分,中国海警接海南省海上搜救中心通报,1艘越南籍船舶在永暑礁以北38海里附近海域...
黄仁勋、马斯克同日发声,事关中... 据澎湃新闻7月26日报道,7月25日,马斯克在《经济学人》访谈中表示,未来某个时刻中国极有可能成为A...
森马,被成人装拖累? “人这一辈子真的不知道谁会旺自己。”近日,好莱坞明星、蜘蛛侠扮演者汤姆·赫兰德(中国粉丝常称“荷兰弟...
伊菲丹 × 成都尼依格罗酒店|... 今夏,法国奢护品牌伊菲丹EviDenS de Beauté携手成都尼依格罗酒店,于七夕...
特朗普下令不打了,美国的“余粮... 可以说戛然而止,快得让很多人都无法适应。前两周,每一天美国都要打击伊朗一通。就在7月24日白宫会议前...