User:Legoboyvdlp/Building using CMake - Windows: Difference between revisions

Jump to navigation Jump to search
Line 85: Line 85:


=== Scripted Compilation ===
=== Scripted Compilation ===
These scripts will allow you to build SimGear and FlightGear automatically.  
This script will allow you to build SimGear and FlightGear automatically.
{{collapsible script
| type  = Windows batch file
| title  = The <code>build.bat</code> script for configuring and compiling OSG, SG, and FG
| lang  = batch
| script = REM Configure.
SET PATH=%PATH%;%ProgramFiles%\CMake\bin
SET QT5SDK64=C:\Qt\5.15.0\msvc2019_64
SET CMAKE_TOOLCHAIN="Visual Studio 16 2019"
SET ROOT_DIR=C:\Users\redpa\Documents\FlightGear\fg-from-scratch\FlightGearBuild


==== Post-installation ====
md osg-build
md simgear-build
md flightgear-build


Open FlightGear.sln. You can then perform all your development / debugging directly in VS. You normally only need to run build.bat again, if you update SimGear or OSG.  
cd %ROOT_DIR%\osg-build
 
cmake  %ROOT_DIR%\osg -G  %CMAKE_TOOLCHAIN% -A x64 ^
                -DACTUAL_3RDPARTY_DIR=%ROOT_DIR%\windows-3rd-party/msvc140/3rdParty.x64 ^
-DCMAKE_RELWITHDEBINFO_POSTFIX:STRING= ^
-DOSG_USE_UTF8_FILENAME:BOOL=ON ^
-DWIN32_USE_MP:BOOL=ON ^
-DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
cmake --build . --config RelWithDebInfo --target INSTALL
 
cd %ROOT_DIR%\simgear-build
cmake  %ROOT_DIR%\simgear -G  %CMAKE_TOOLCHAIN% -A x64 ^
                -DMSVC_3RDPARTY_ROOT=%ROOT_DIR%\windows-3rd-party\msvc140 ^
                -DOSG_FSTREAM_EXPORT_FIXED:BOOL=ON ^
                -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
cmake --build . --config RelWithDebInfo --target INSTALL
 
cd %ROOT_DIR%\flightgear-build
cmake  %ROOT_DIR%\flightgear -G  %CMAKE_TOOLCHAIN% -A x64 ^
                    -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install ^
                    -DCMAKE_PREFIX_PATH=%QT5SDK64% ^
                    -DOSG_FSTREAM_EXPORT_FIXED:BOOL=ON ^
                    -DENABLE_COMPOSITOR:BOOL=OFF
                   
cmake --build . --config RelWithDebInfo --target INSTALL
| show  = 1
}}
 
Before starting to use the script, you need to:
1. Set the path to CMAKE
2. Set the path to the QT5 SDK
3. Set your toolchain, e.g. "Visual Studio 16 2019"
4. Set ROOT_DIR to the FlightgearBuild folder you created (the above directory structure)
 
==== Post-compilation ====
 
Open flightgear-build/FlightGear.sln. You can then perform all your development / debugging directly in VS. You normally only need to run build.bat again, if you update SimGear or OSG.  


To launch FlightGear from Visual Studio, you can  
To launch FlightGear from Visual Studio, you can  
842

edits

Navigation menu