找回密码
 加入FG

QQ登录

只需一步,快速开始

搜索
查看: 13743|回复: 12

VS2008 Express 下编译 FlightGear 2.4.0 教程

[复制链接]
发表于 2011-11-6 20:17:47 | 显示全部楼层 |阅读模式
本帖最后由 jinchengde 于 2011-11-7 11:52 编辑

VS2008 Express 下编译 FlightGear 2.4.0 教程
jinchengde

教程主要参考了FlightGear/docs-mini/README.MSCV,添加了x86_32下面的部分注释,

Use FlightGear.sln to compile fgfs executable for Win32 or x64 architectures with Visual Studio 2008.
Previous versions of Visual Studio are not officially supported anymore.
Precompiled librairies and headers for compiling Win32 executables with VS2008 :
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20110801.zip
jinchengde:最新的应该是
Precompiled librairies and headers for compiling x64 executables with VS2008 :
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20110801.zip
These two archives only contain 'release' versions of librairies and executables. In addition,
the archives below contain 'debug' version of libraries and should be dezipped over the previous one.
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-win32-VS90-3rdParty+OSG-20110801-debug.zip
ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/MSVC/fgfs-x64-VS90-3rdParty+OSG-20110801-debug.zip
The VS2008 / v9.0 project files assume the directory layout below :
Win32 build :
* any_directory_on_any_drive /
      3rdParty /                 ( includes plib, fltk, zlib, libpng, libjpeg, libtiff, freetype, libsvn, gdal, ...
         bin /
         include /
         lib /
      boost_1_44_0 /
         boost /
         lib /
      source /   jinchengde:通过Git获取后目录名应该是FlightGear      ( Flightgear CVS directory - It can also be renamed FlightGear or anything else

         src /
         projects /
            VC90 /
               Win32 /           ( generated at build time
                  Debug /        ( Debug executable
                  Release /      ( Release executable
               FlightGear.sln    ( Main solution
         utils /
      install /
         msvc90 /
            OpenSceneGraph /     ( OSG CMake install
               bin /
               include /
               lib /
      SimGear /                  ( SimGear CVS directory
         simgear /
         projects /
            VC90 /
3rdParty, boost_1_44_0 and install/msvc90 are included in the Win32 3rdParty archive.
x64 build :
* any_directory_on_any_drive /
      3rdParty.x64 /             ( includes plib, fltk, zlib, libpng, libjpeg, libtiff, freetype, ...
         bin /
         include /
         lib /
      boost_1_44_0 /
         boost /
         lib64 /
      source /                   ( Flightgear CVS directory - It can also be renamed FlightGear or anything else
         src /
         projects /
            VC90 /
               x64 /             ( generated at build time
                  Debug /        ( Debug executable
                  Release /      ( Release executable
               FlightGear.sln    ( Main solution
         utils /
      install /
         msvc90-64 /
            OpenSceneGraph /     ( OSG CMake install
               bin /
               include /
               lib /
      SimGear /                  ( SimGear CVS directory
         simgear /
         projects /
            VC90 /
3rdParty.x64, boost_1_44_0 and install/msvc90-64 are included in the x64 3rdParty archive.
Typical setup should decompose into the following steps :
  1. Install Visual Studio 2008 Express (http://msdn.microsoft.com/fr-fr/express/aa975050.aspx)
  2. Install msysGit (http://code.google.com/p/msysgit/)
jinchengde:强烈建议通过Git获取源代码,官方网站打包好的代码编译的时候问题很多,如果不会使用Git,可以直接从http://gitorious.org/fg/flightgear/trees/nexthttp://gitorious.org/fg/simgear/trees/next下载源码
  3. Create a new directory, say D:\FGFSDevel (or anything else)
  4. Unzip precompiled Win32 3rd party archive in it
  5. Open a Git Bash session and cd to the new directory ( cd /d/FGFSDevel )
  6. Get SimGear sources from Gitorious : git clone git://gitorious.org/fg/simgear.git SimGear
  7. Get FlightGear source from Gitorious : git clone git://gitorious.org/fg/flightgear.git FlightGear
  8. Go to D:\FGFSDevel\FlightGear\projects\VC90 and double-click on FlightGear.sln
  9. Select the "Release" configuration
10. Open file D:\FGFSDevel\SimGear\simgear\version.h.in and change @VERSION@ into "2.0.0" or any current version
jinchengde:这一步很重要,改成2.4.0即可
11. Save file as version.h in the same directory
12. Start build (usually F7)
13. Get the data from Gitorious too : git clone git://gitorious.org/fg/fgdata.git fgdata
14. Wait...
15. Add <any_directory_on_any_drive>/install/msvc90/OpenSceneGraph/bin and <any_directory_on_any_drive>/3rdParty/bin to your PATH environment variable
jinchengde:环境变量别忘了,添加过后记得重启机器
16. Enjoy - programs are in D:\FGFSDevel\FlightGear\projects\VC90\Win32\Release
It is also possible to compile a Debug version. This is only useful when hacking the code because
a Debug version is way slower than the Release one.
The 64bit build is only available to people having the Professional edition of Visual Studio 2008. In that case, 15. above should be :
15. Add <any_directory_on_any_drive>/install/msvc90-64/OpenSceneGraph/bin and <any_directory_on_any_drive>/3rdParty.x64/bin to your PATH environment variable
When the manual build works, it is possible to start it from the command line. This is useful
when setting up a build server or automating the process of retrieving the code and building
it in a scheduled task. To do that :
1. open a command line window
2. execute "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat"
     or "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat" in a
     64bit environment (Vista 64-bit or Windows7 64-bit)
     You should see : "Setting environment for using Microsoft Visual Studio 2008 x86 tools."
     printed in the console
     ( To start 64-bit build, the right environment is set with :
       "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" amd64
     )
3. cd to the FlightGear project directory :
     D:
     cd \FGFSDevel\FlightGear\projects\VC90  (for example)
4. start the build with the command line below :
     msbuild FlightGear.sln /p:Configuration=Release /m
    or
     msbuild FlightGear.sln /p:Configuration=Debug /m
That's all...
Note: you may experience the error below running the msbuild command :
FlightGear\projects\VC90\FlightGear.sln : error MSB4018: The "ResolveVCProjectOutput" task failed unexpectedly.
...(lots of additionnal messages)
In that case, remove the /m switch from the command line.

发表于 2011-11-6 20:33:53 | 显示全部楼层
我先按照楼主的方法试一下,对于楼主的辛勤劳动表示强烈的感谢!
回复

使用道具 举报

发表于 2011-11-21 10:48:45 | 显示全部楼层
感谢LZ的分享啊!!!谢谢哇!
回复

使用道具 举报

发表于 2011-11-23 17:17:20 | 显示全部楼层
感谢LZ的分享!谢谢
回复

使用道具 举报

发表于 2011-11-25 13:08:35 | 显示全部楼层
有没有人用VS2008成功编译过64位的?缺少库。但是上面的ftp下载需要账户和密码。。。
回复

使用道具 举报

发表于 2011-11-30 19:07:58 | 显示全部楼层
非常謝謝樓主了.~~
回复

使用道具 举报

发表于 2012-1-2 10:15:02 | 显示全部楼层

不知道行不行啊!
回复

使用道具 举报

发表于 2012-1-4 21:15:28 | 显示全部楼层
Flightgear 2.4在VC2005下面能编译吗?谢谢
回复

使用道具 举报

发表于 2012-1-4 21:24:02 | 显示全部楼层
本帖最后由 许松(小瞎说) 于 2012-1-5 11:58 编辑
brightma 发表于 2012-1-4 21:15
Flightgear 2.4在VC2005下面能编译吗?谢谢

我试过 vc2005不行的 源代码使用了vc2008的新增语法了
糟糕的是vc2010也不行 语法还是不兼容
回复

使用道具 举报

发表于 2012-3-4 15:55:55 | 显示全部楼层
收藏了回去好好研究
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入FG

本版积分规则

QQ|小黑屋|手机版|联系我们|FlightGear ( 吉ICP备19002044号-7 )

GMT+8, 2025-8-11 14:14

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表