1
0
Fork 0

Add INSTALL file, split MSVC instructions from README.cmake

into separate README.msvc file.
This commit is contained in:
ThorstenB 2012-06-08 13:14:52 +02:00
parent 1575fad886
commit 9167dac5d5
3 changed files with 162 additions and 79 deletions

33
INSTALL Normal file
View file

@ -0,0 +1,33 @@
How to build FlightGear
=======================
FlightGear uses the CMake build system to generate a platform-specific
build environment. CMake reads the CMakeLists.txt files that you'll
find throughout the source directories, checks for installed
dependencies and then generates the appropriate build system.
If you don't already have CMake installed on your system you can grab
it from http://www.cmake.org, use version 2.6.4 or later.
Under unices (i.e. Linux, Solaris, Free-BSD, HP-Ux, OSX) use the cmake
or ccmake command-line utils. Preferably, create an out-of-source
build directory and run cmake or ccmake from there. The advantage to
this approach is that the temporary files created by CMake won't
clutter the source directory, and also makes it possible to have
multiple independent build targets by creating multiple build
directories. In a directory alongside the FlightGear source directory
use:
mkdir fgbuild
cd fgbuild
cmake ../flightgear -DCMAKE_BUILD_TYPE=Release
make
sudo make install
For detailed instructions see:
* README.cmake for Linux, OSX, ...
* README.msvc for Windows / Visual Studio
For further information see:
* http://wiki.flightgear.org/Building_Flightgear

View file

@ -1,6 +1,7 @@
Getting started with CMake Getting started with CMake
==========================
[Windows instructions at the end of this document] [For Windows build instructions see README.msvc]
(These instructions apply to Unix-like systems, including Cygwin and Mac. To (These instructions apply to Unix-like systems, including Cygwin and Mac. To
build using Visual Studio or some other IDE supported by CMake, most of the build using Visual Studio or some other IDE supported by CMake, most of the
@ -11,7 +12,7 @@ code (eg, from Git) is at /home/curt/projects/flightgear, you might create
/home/curt/projects/fgbuild. Change into the new directory, and run /home/curt/projects/fgbuild. Change into the new directory, and run
cmake ../flightgear cmake ../flightgear
To generate standard Unix Makefiles in fgbuild. To generate standard Unix Makefiles in fgbuild.
Probably you want to specify an install prefix: Probably you want to specify an install prefix:
@ -39,7 +40,7 @@ usually simpler.
By default, we select a release build. To create a debug build, use By default, we select a release build. To create a debug build, use
cmake ../flightgear -DCMAKE_BUILD_TYPE=Debug cmake ../flightgear -DCMAKE_BUILD_TYPE=Debug
(or MinSizeRel, or RelWithDbg) (or MinSizeRel, or RelWithDbg)
Debug builds will automatically use corresponding debug builds of required Debug builds will automatically use corresponding debug builds of required
@ -64,21 +65,23 @@ configurations, eg
To set an optional feature, do To set an optional feature, do
cmake ../flightgear -DFEATURE_NAME=ON cmake ../flightgear -DFEATURE_NAME=ON
(or 'OFF' to disable ) (or 'OFF' to disable )
To see the variables that can be configured / are currently defined, you can To see the variables that can be configured / are currently defined, you can
run one of the GUI front ends, or the following command: run one of the GUI front ends, or the following command:
cmake ../flighgear -L cmake ../flightgear -L
Add 'A' to see all the options (including advanced options), or 'H' to see Add 'A' to see all the options (including advanced options), or 'H' to see
the help for each option (similar to running configure --help under autoconf): the help for each option (similar to running configure --help under autoconf):
cmake ../flightgear -LH cmake ../flightgear -LH
Build Targets Build Targets
=============
For a Unix makefile build, 'make dist', 'make uninstall' and 'make test' are For a Unix makefile build, 'make dist', 'make uninstall' and 'make test' are
all available and should work as expected. 'make clean' is also as normal, all available and should work as expected. 'make clean' is also as normal,
@ -95,7 +98,7 @@ For target conditional files, you can append to the SOURCES or HEADERS lists
inside an if() test, for example: inside an if() test, for example:
if(APPLE) if(APPLE)
list(APPEND SOURCES extraFile1.cxx extraFile2.cxx) list(APPEND SOURCES extraFile1.cxx extraFile2.cxx)
endif() endif()
Setting include directories Setting include directories
@ -113,11 +116,11 @@ Use set_target_property(), for example
set_target_property(fgfs PROPERTIES set_target_property(fgfs PROPERTIES
COMPILE_DEFINITIONS FOO BAR=1) COMPILE_DEFINITIONS FOO BAR=1)
You can set a property on an individual source file: You can set a property on an individual source file:
set_property(SOURCE myfile.cxx PROPERTY COMPILE_FLAGS "-Wno-unsigned-compare") set_property(SOURCE myfile.cxx PROPERTY COMPILE_FLAGS "-Wno-unsigned-compare")
Detecting Features / Libraries Detecting Features / Libraries
For most standard libraries (Gtk, wxWidget, Python, GDAL, Qt, libXml, Boost), For most standard libraries (Gtk, wxWidget, Python, GDAL, Qt, libXml, Boost),
@ -128,7 +131,7 @@ cmake provides a standard helper. To see the available modules, run:
In the root CMakeLists file, use a statement like: In the root CMakeLists file, use a statement like:
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
Each package helper sets various variables such aaa_FOUND, aaa_INCLUDE_DIR, Each package helper sets various variables such aaa_FOUND, aaa_INCLUDE_DIR,
and aaa_LIBRARY. Depending on the complexity of the package, these variables and aaa_LIBRARY. Depending on the complexity of the package, these variables
might have different names (eg, OPENSCENEGRAPH_LIBRARIES). might have different names (eg, OPENSCENEGRAPH_LIBRARIES).
@ -140,86 +143,19 @@ directory, eg /usr/share/cmake/modules on Unix systems.
Note libraries support by pkg-config can be handled directly, with no need Note libraries support by pkg-config can be handled directly, with no need
to create a custom FindABC helper. to create a custom FindABC helper.
Adding a new executable target Adding a new executable target
add_executable(myexecutable ${SOURCES} ${HEADERS}) add_executable(myexecutable ${SOURCES} ${HEADERS})
target_link_libraries(myexecutable .... libraries ... ) target_link_libraries(myexecutable .... libraries ... )
install(TARGETS myexecutable RUNTIME DESTINATION bin) install(TARGETS myexecutable RUNTIME DESTINATION bin)
(If the executable should not be installed, omit the final line above) (If the executable should not be installed, omit the final line above)
If you add an additional line If you add an additional line
add_test(testname ${EXECUTABLE_OUTPUT_PATH}/myexecutable) add_test(testname ${EXECUTABLE_OUTPUT_PATH}/myexecutable)
Then running 'make test' will run your executable as a unit test. The Then running 'make test' will run your executable as a unit test. The
executable should return either a success or failure result code. executable should return either a success or failure result code.
SPECIAL INSTRUCTIONS TO BUILD UNDER WINDOWS WITH VISUAL STUDIO
==============================================================
On Windows, assumptions on the directory structure are made to automate the discovery of dependencies.
This recommended directory structure is described below:
${MSVC_3RDPARTY_ROOT} /
3rdParty / ( includes plib, fltk, zlib, libpng, libjpeg, libtiff, freetype, libsvn, gdal, ...
bin /
include /
lib /
3rdParty.x64 / ( 64 bit version )
...
boost_1_44_0 /
boost /
install /
msvc100 / ( for VS2010 32 bits, or msvc90, msvc90-64 or msvc100-64 for VS2008 32, VS2008 64 and VS2010 64 )
OpenSceneGraph / ( OSG CMake install
bin /
include /
lib /
SimGear /
include /
lib /
If you do not use the recommended structure you will need to enter paths by hand. Source and build directories can be located anywhere.
The suggested inputs to cmake are :
MSVC_3RDPARTY_ROOT : location of the above directory structure
CMAKE_INSTALL_PREFIX : ${MSVC_3RDPARTY_ROOT}/install/msvc100/FlightGear (or any variation for the compiler version described above )
1. Set up a work directory as described above.
2. Open the Cmake gui.
3. Set "Where is the source code" to wherever you put the FlightGear sources (from the released tarball or the git repository).
4. Set "Where to build the binaries" to an empty directory.
5. Press the "Configure" button. The first time that the project is configured, Cmake will bring up a window asking which compiler you wish to use. Normally just accept Cmakes suggestion, and press Finish. Cmake will now do a check on your system and will produce a preliminary build configuration.
6. Cmake adds new configuration variables in red. Some have a value ending with -NOTFOUND. These variables should receive your attention. Some errors will prevent FlightGear to build and others will simply invalidate some options without provoking build errors. First check the MSVC_3RDPARTY_ROOT variable. If it is not set, chances are that there will be a lot of -NOTFOUND errors. Instead of trying to fix every error individually, set that variable and press the "Configure" button again.
7. Also check the lines with a checkbox. These are build options and may impact the feature set of the built program.
8. Change the CMAKE_INSTALL_PREFIX to ${MSVC_3RDPARTY_ROOT}/install/msvc100/FlightGear because C:\Program Files is likely unwritable to ordinary Windows users and will integrate better with the above directory structure (this is mandatory for SimGear if you don't want to solve errors by hand).
10. Repeat the process until the "Generate" button is enabled.
11. Press the "Generate" button.
12. Start Visual Studio 2010 and load the FlightGear solution (FlightGear.sln) located in "Where to build the binaries" (point 4.)
13. Choose the "Release" build in the VS2010 "Generation" toolbar
14. Generate the solution.
15. If there are build errors, return to Cmake, clear remaining errors, "Configure" and "Generate"
16. When Visual Studio is able to build everything without errors, build the INSTALL project to put the product files in ${CMAKE_INSTALL_PREFIX}
17. Enjoy!
PS: When updating the source from git, it is usually unnecessary to restart Cmake as the solution is able to reconfigure itself when Cmake files are changed. Simply rebuild the solution from Visual Studio and accept the reload of updated projects. It also possible to edit CMakeList.txt files directly in Visual Studio as they also appear in the solution, and projects will be reconfigured on the next generation. To change build options or directory path, it is mandatory to use the Cmake Gui. In case of problems, locate the CMakeCache.txt in "Where to build the binaries directory and delete it to reconfigure from scratch or use the menu item File->Delete Cache.

114
README.msvc Normal file
View file

@ -0,0 +1,114 @@
WINDOWS / VISUAL STUDIO BUILD INSTRUCTIONS
==========================================
[For Linux/Unix/OSX/... instructions see README.cmake]
Directory Structure
===================
On Windows, assumptions on the directory structure are made to automate
the discovery of dependencies.
This recommended directory structure is described below:
${MSVC_3RDPARTY_ROOT} /
3rdParty / ( includes plib, fltk, zlib, libpng,
libjpeg, libtiff, freetype, libsvn,
gdal, ... )
bin /
include /
lib /
3rdParty.x64 / ( 64 bit version )
...
boost_1_44_0 /
boost /
install /
msvc100 / ( for VS2010 32 bits, or msvc90,
msvc90-64 or msvc100-64 for VS2008 32,
VS2008 64 and VS2010 64 )
OpenSceneGraph / ( OSG CMake install )
bin /
include /
lib /
SimGear /
include /
lib /
If you do not use the recommended structure you will need to enter paths
by hand. Source and build directories can be located anywhere.
Running CMake GUI
=================
The suggested inputs to cmake are :
MSVC_3RDPARTY_ROOT : location of the above directory structure
CMAKE_INSTALL_PREFIX : ${MSVC_3RDPARTY_ROOT}/install/msvc100/FlightGear
(or any variation for the compiler version described above)
1. Set up a work directory as described above.
2. Open the CMake gui.
3. Set "Where is the source code" to wherever you put the FlightGear
sources (from the released tarball or the git repository).
4. Set "Where to build the binaries" to an empty directory.
5. Press the "Configure" button. The first time that the project is
configured, CMake will bring up a window asking which compiler you wish
to use. Normally just accept Cmakes suggestion, and press Finish. CMake
will now do a check on your system and will produce a preliminary build
configuration.
6. CMake adds new configuration variables in red. Some have a value ending
with -NOTFOUND. These variables should receive your attention. Some
errors will prevent FlightGear to build and others will simply
invalidate some options without provoking build errors. First check the
MSVC_3RDPARTY_ROOT variable. If it is not set, chances are that there
will be a lot of -NOTFOUND errors. Instead of trying to fix every error
individually, set that variable and press the "Configure" button again.
7. Also check the lines with a checkbox. These are build options and may
impact the feature set of the built program.
8. Change the CMAKE_INSTALL_PREFIX to
${MSVC_3RDPARTY_ROOT}/install/msvc100/FlightGear because
C:\Program Files is likely unwritable to ordinary Windows users and
will integrate better with the above directory structure (this is
mandatory for SimGear if you don't want to solve errors by hand).
10. Repeat the process until the "Generate" button is enabled.
11. Press the "Generate" button.
12. Start Visual Studio 2010 and load the FlightGear solution
(FlightGear.sln) located in "Where to build the binaries" (point 4.)
13. Choose the "Release" build in the VS2010 "Generation" toolbar
14. Generate the solution.
15. If there are build errors, return to CMake, clear remaining errors,
"Configure" and "Generate"
16. When Visual Studio is able to build everything without errors, build
the INSTALL project to put the product files in ${CMAKE_INSTALL_PREFIX}
17. Enjoy!
Rebuilding Updated Sources
==========================
When updating the sources from Git, it is usually unnecessary to restart
CMake as the solution is able to reconfigure itself when CMake files are
changed. Simply rebuild the solution from Visual Studio and accept the
reload of updated projects. It also possible to edit CMakeList.txt files
directly in Visual Studio as they also appear in the solution, and projects
will be reconfigured on the next generation. To change build options or
directory path, it is mandatory to use the CMake Gui. In case of problems,
locate the CMakeCache.txt in "Where to build the binaries" directory and
delete it to reconfigure from scratch or use the menu item
File->Delete Cache.