MediaWiki has been updated to version 1.35.1. Please report any problems here.

Changes

Jump to navigation Jump to search
Line 45: Line 45:     
== Building ==
 
== Building ==
  −
=== GUI compilation ===
  −
# Set up a work directory as described above or to your own personal preference.
  −
# Having downloaded the sources into the Source directory, and all the prebuilt dependencies, continue below:
  −
# '''Building SimGear'''
  −
## Open the CMake gui.
  −
## Set <tt>"Where is the source code"</tt> to the Source/simgear-git directory.
  −
## Set <tt>"Where to build the binaries"</tt> to the empty directory <tt>simgear-build</tt> in the BuildDirs directory.
  −
## Press [[File:CMake GUI Configure.png]]. The first time that the project is configured, CMake will bring up a window asking you to "Specify the generator for this project" i.e. which compiler you wish to use. Select Visual Studio 16 2019 (or the respective version for your own copy of Visual Studio), and press Finish. CMake will now do a check on your system and will produce a preliminary build configuration. [[File:BuildCompilerSelection.png|thumb|Shows how to select compiler]]
  −
## CMake adds new configuration variables in red. Some have a value ending with <tt>-NOTFOUND</tt>. These variables do not necessarily need a value. Some errors will prevent SimGear from building and others will simply invalidate some options without causing build errors and thus can be ignored.
  −
### First check the <tt>MSVC_3RDPARTY_ROOT</tt> variable. If it is not set, chances are that there will be a lot of <tt>-NOTFOUND</tt> errors. Instead of trying to fix every error individually, set that variable to the location of the <tt>\Dependencies</tt> folder in the directory structure that is presented above. Then press [[File:CMake GUI Configure.png]] again. [[File:BuildMSVC 3DPartyRoot.png|thumb|Demonstrates how to set 3d party root in CMAKE gui]]
  −
### Set the  <tt>CMAKE_INSTALL_PREFIX</tt> variable to <tt>\install\Simgear</tt>
  −
### Set the <tt>Boost_INCLUDE_DIR</tt> variable to <tt>\Dependencies</tt>
  −
### To pick up Boost correctly, you must add a new Cache entry, using [[File:CMake GUI AddButton.png]] with name <tt>BOOST_ROOT</tt>, type <tt>PATH</tt>, and value <tt>\Dependencies</tt>. It is '''not''' required to set Boost_DIR to any value.[[File:BuildSettingBoost.png|thumb|Demonstrates how to add Boost in CMAKE GUI]]
  −
### Create a second cache entry, called <tt>CMAKE_PREFIX_PATH</tt>, type <tt>PATH</tt> and value <tt>\Dependencies\install\msvc140-64\OpenSceneGraph</tt>. This will allow OSG to be picked up automatically.
  −
### Also verify the lines with a checkbox. These are build options and may impact the feature set of the built program.
  −
### Default options, for anything else, should more or less be suitable. One exception is to ensure OSG_FSTREAM_EXPORT_FIXED is set to true for faster linking.
  −
## Repeat the process from step 5, until [[File:CMake GUI Generate.png]] is enabled.
  −
## Press [[File:CMake GUI Generate.png]].
  −
## Press [[File:CMake GUI OpenProject.png]].
  −
## Choose the <tt>"RelWithDebInfo"</tt> build in the toolbar. The right menu should read x64 for 64-bits. [[File:MVSC 2019 solution.PNG|right]]
  −
## Generate the solution with F7 key or right-click the top level "Solution SimGear" in the Solution Explorer and choose Build. It should take ~20 minutes on average hardware.
  −
## If there are build errors, return to CMake, clear remaining errors, [[File:CMake GUI Configure.png]] and [[File:CMake GUI Generate.png]].
  −
## When Visual Studio is able to build everything without errors, right-click on the <tt>INSTALL</tt> project (further down within the "Solution Simgear" solution) and choose Build, which will put the include and lib files in <tt>${CMAKE_INSTALL_PREFIX}</tt>. This should only take a few seconds as you have already compiled everything. [[File:BuildInstallProjectMSVC.png|thumb|Demonstrates building INSTALL project in MSVC]]
  −
# '''Building FlightGear'''
  −
#: Repeat the steps under Building Simgear, but change the <tt>SimGear</tt> paths to <tt>FlightGear</tt>.
  −
## Set CMAKE_INSTALL_PREFIX to <tt>\install\FlightGear</tt>
  −
## Link Simgear to FlightGear using <tt>Simgear_DIR</tt>, pointing to <tt>\install\Simgear\lib\cmake\SimGear</tt> [[File:BuildSimgear DIR.png|thumb|Demonstrates how to link Simgear to FlightGear]]
  −
## Notably, you will have to link QT5 to CMAKE_PREFIX_PATH ''in addition to'' OSG (as with Simgear). To do this, insert the directory values with a semi-colon to separate them. for instance <tt>QT5PATH;OSGPATH</tt>.
  −
### QT5: <tt>C:/Qt/5.15.0/msvc2019_64</tt> (adjust to match your QT installation).
  −
### My personal final path was: <tt>C:/Users/redpa/Documents/FlightGear/fg-from-scratch/fresh-build/Dependencies/install/msvc140 64/OpenSceneGraph;C:/Qt/5.15.0/msvc2019_64</tt>
  −
# '''Post-compilation steps:'''
  −
## Install QT5 using WinDeployQT: this program is contained within the QT installation. For me, I found it inside <tt>C:\Qt\5.15.0\msvc2019_64\bin</tt>. Run it in a cmd window, with the console options as required. This pulls in all the necessary QT files.
  −
## Install .dlls:
  −
### either manually copy in to the <tt>install/FlightGear/bin/</tt> folder
  −
### or, preferrably, add the directories containing them to %PATH% environment variable.
  −
#### Dependencies\3rdParty.x64\bin
  −
#### Dependencies\install\msvc140-64\OpenSceneGraph\bin
  −
## Enjoy!
  −
   
=== Scripted Compilation ===
 
=== Scripted Compilation ===
 
This script will allow you to build SimGear and FlightGear automatically.
 
This script will allow you to build SimGear and FlightGear automatically.
810

edits

Navigation menu