Howto talk:Using Ada in FlightGear

From FlightGear wiki
Jump to navigation Jump to search

Patch

WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
See history for the latest developments.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4808f9d..f8e7fdb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,10 +25,16 @@ if(APPLE)
 	SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
 endif()
 
-project(FlightGear)
+project(FlightGear C CXX)
 
 # We have some custom .cmake scripts not in the official distribution.
-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
+set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
+
+# Need to define CMAKE_PLATFORM_INFO_DIR for all CMake versions less than 2.8.10
+if(NOT CMAKE_PLATFORM_INFO_DIR)
+  set(CMAKE_PLATFORM_INFO_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+  message(STATUS "CMAKE_PLATFORM_INFO_DIR = ${CMAKE_PLATFORM_INFO_DIR}")
+endif(NOT CMAKE_PLATFORM_INFO_DIR)
 
 if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
     # use official include provided by latest CMake
@@ -194,6 +200,28 @@ option(ENABLE_TESTS      "Set to ON to build test applications (default)" ON)
 option(ENABLE_FGCOM      "Set to ON to build the FGCom application (default)" ON)
 option(ENABLE_FLITE      "Set to ON to build the Flite text-to-speech module" ON)
 option(ENABLE_QT         "Set to ON to build the internal Qt launcher" ON)
+option(ENABLE_ADA_MODULES"Set to ON to build FlightGear with optional Ada support" ON)
+
+if(ENABLE_ADA_MODULES)
+message(STATUS "Ada/gnat build enabled (still experimental)")
+# find_package(OpenCL)
+
+enable_language(Ada)
+if(NOT CMAKE_Ada_COMPILER_WORKS)
+  message(FATAL_ERROR "Required working Ada compiler not found.")
+endif(NOT CMAKE_Ada_COMPILER_WORKS)
+
+# Find the gnat version used in order to search for the right version of libgnat 
+execute_process(COMMAND ${CMAKE_Ada_COMPILER} --version OUTPUT_VARIABLE ADA_OUTPUT)
+string(REGEX MATCH "gcc [(][^)]*[)] ([0-9]*[.][0-9]*)[.][0-9]" ADA_OUTPUT_TRIM ${ADA_OUTPUT})
+set(GNATVERSION ${CMAKE_MATCH_1})
+message(STATUS "gnat version = ${GNATVERSION}")
+find_library(GNAT_LIB NAMES gnat gnat-${GNATVERSION})
+if(NOT GNAT_LIB)
+  message(FATAL_ERROR "Required gnat library not found.")
+endif(NOT GNAT_LIB)
+
+endif(ENABLE_ADA_MODULES)
 
 if(LOGGING)
     # nothing
@@ -325,7 +353,7 @@ check_include_file(windows.h  HAVE_WINDOWS_H)
 if(ENABLE_PROFILE)
     find_package(GooglePerfTools REQUIRED)
     set(FG_HAVE_GPERFTOOLS 1)
-    message(STATUS "Built-in profiler using gperftools available")
+    message(STATUS "Built-in fgcommand-based profiler using gperftools available (fgcommands: profiler-start/profiler-stop)")
 endif()
 
 if(ENABLE_RTI)
diff --git a/CMakeModules/CMakeAdaCompiler.cmake.in b/CMakeModules/CMakeAdaCompiler.cmake.in
new file mode 100644
index 0000000..f48ed07
--- /dev/null
+++ b/CMakeModules/CMakeAdaCompiler.cmake.in
@@ -0,0 +1,17 @@
+SET(CMAKE_Ada_COMPILER "@CMAKE_Ada_COMPILER@")
+SET(CMAKE_Ada_COMPILER_ARG1 "@CMAKE_Ada_COMPILER_ARG1@")
+SET(CMAKE_AR "@CMAKE_AR@")
+SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
+SET(CMAKE_Ada_COMPILER_LOADED 1)
+
+SET(CMAKE_Ada_COMPILER_ENV_VAR "ADA")
+
+SET(CMAKE_Ada_SOURCE_FILE_EXTENSIONS adb)
+SET(CMAKE_Ada_IGNORE_EXTENSIONS ads;h;H;o;O;obj;OBJ;def;DEF;rc;RC)
+SET(CMAKE_Ada_LINKER_PREFERENCE Preferred)
+IF(UNIX OR MINGW)
+  SET(CMAKE_Ada_OUTPUT_EXTENSION .o)
+ELSE(UNIX OR MINGW)
+  SET(CMAKE_Ada_OUTPUT_EXTENSION .obj)
+ENDIF(UNIX OR MINGW)
+SET(CMAKE_Ada_OUTPUT_EXTENSION_REPLACE 1)
diff --git a/CMakeModules/CMakeAdaInformation.cmake b/CMakeModules/CMakeAdaInformation.cmake
new file mode 100644
index 0000000..4d9a78a
--- /dev/null
+++ b/CMakeModules/CMakeAdaInformation.cmake
@@ -0,0 +1,256 @@
+# This file sets the basic flags for the Ada language in CMake.
+# It also loads the available platform file for the system-compiler
+# if it exists.
+
+GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_Ada_COMPILER} NAME_WE)
+SET(CMAKE_SYSTEM_AND_Ada_COMPILER_INFO_FILE
+  ${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
+INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
+
+# This should be included before the _INIT variables are
+# used to initialize the cache.  Since the rule variables 
+# have if blocks on them, users can still define them here.
+# But, it should still be after the platform file so changes can
+# be made to those values.
+
+IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
+   INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
+ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
+
+IF(CMAKE_USER_MAKE_RULES_OVERRIDE_Ada)
+   INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_Ada})
+ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_Ada)
+
+# Create a set of shared library variable specific to Ada
+# For 90% of the systems, these are the same flags as the C versions
+# so if these are not set just copy the flags from the c version
+
+IF(NOT CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS)
+  SET(CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS)
+
+IF(NOT CMAKE_Ada_COMPILE_OPTIONS_PIC)
+  SET(CMAKE_Ada_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
+ENDIF(NOT CMAKE_Ada_COMPILE_OPTIONS_PIC)
+
+IF(NOT CMAKE_Ada_COMPILE_OPTIONS_PIE)
+  SET(CMAKE_Ada_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
+ENDIF(NOT CMAKE_Ada_COMPILE_OPTIONS_PIE)
+
+IF(NOT CMAKE_Ada_COMPILE_OPTIONS_DLL)
+  SET(CMAKE_Ada_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
+ENDIF(NOT CMAKE_Ada_COMPILE_OPTIONS_DLL)
+
+IF(NOT CMAKE_SHARED_LIBRARY_Ada_FLAGS)
+  SET(CMAKE_SHARED_LIBRARY_Ada_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_Ada_FLAGS)
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_FLAGS)
+  SET(CMAKE_SHARED_LIBRARY_LINK_Ada_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
+ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_FLAGS)
+
+IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG)
+  SET(CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) 
+ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG)
+
+IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP)
+  SET(CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP)
+
+IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG)
+  SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG)
+
+# repeat for modules
+IF(NOT CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS)
+  SET(CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS)
+
+IF(NOT CMAKE_SHARED_MODULE_Ada_FLAGS)
+  SET(CMAKE_SHARED_MODULE_Ada_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
+ENDIF(NOT CMAKE_SHARED_MODULE_Ada_FLAGS)
+
+IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG)
+  SET(CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG}) 
+ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG)
+
+IF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG_SEP)
+  SET(CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP})
+ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_Ada_FLAG_SEP)
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG)
+  SET(CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG})
+ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG)
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG_SEP)
+  SET(CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Ada_FLAG_SEP})
+ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Ada_FLAG_SEP)
+
+IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Ada_FLAG)
+  SET(CMAKE_EXECUTABLE_RPATH_LINK_Ada_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Ada_FLAG})
+ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Ada_FLAG)
+
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_WITH_RUNTIME_PATH)
+  SET(CMAKE_SHARED_LIBRARY_LINK_Ada_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
+ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Ada_WITH_RUNTIME_PATH)
+
+IF(NOT CMAKE_INCLUDE_FLAG_Ada)
+  SET(CMAKE_INCLUDE_FLAG_Ada ${CMAKE_INCLUDE_FLAG_C})
+ENDIF(NOT CMAKE_INCLUDE_FLAG_Ada)
+
+IF(NOT CMAKE_INCLUDE_FLAG_SEP_Ada)
+  SET(CMAKE_INCLUDE_FLAG_SEP_Ada ${CMAKE_INCLUDE_FLAG_SEP_C})
+ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_Ada)
+
+# Copy C version of this flag which is normally determined in platform file.
+IF(NOT CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG)
+  SET(CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG})
+ENDIF(NOT CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG)
+
+SET(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make.  This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
+
+SET(CMAKE_Ada_FLAGS_INIT "$ENV{ADAFLAGS} ${CMAKE_Ada_FLAGS_INIT}")
+# avoid just having a space as the initial value for the cache 
+IF(CMAKE_Ada_FLAGS_INIT STREQUAL " ")
+  SET(CMAKE_Ada_FLAGS_INIT)
+ENDIF(CMAKE_Ada_FLAGS_INIT STREQUAL " ")
+SET (CMAKE_Ada_FLAGS "${CMAKE_Ada_FLAGS_INIT}" CACHE STRING
+     "Flags for Ada compiler.")
+
+INCLUDE(CMakeCommonLanguageInclude)
+
+# now define the following rule variables
+
+# CMAKE_Ada_CREATE_SHARED_LIBRARY
+# CMAKE_Ada_CREATE_SHARED_MODULE
+# CMAKE_Ada_CREATE_STATIC_LIBRARY
+# CMAKE_Ada_COMPILE_OBJECT
+# CMAKE_Ada_LINK_EXECUTABLE
+
+# variables supplied by the generator at use time
+# <TARGET>
+# <TARGET_BASE> the target without the suffix
+# <OBJECTS>
+# <OBJECT>
+# <LINK_LIBRARIES>
+# <FLAGS>
+# <LINK_FLAGS>
+
+# Ada compiler information
+# <CMAKE_Ada_COMPILER>  
+# <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS>
+# <CMAKE_SHARED_MODULE_CREATE_Ada_FLAGS>
+# <CMAKE_Ada_LINK_FLAGS>
+
+# Static library tools
+# <CMAKE_AR> 
+# <CMAKE_RANLIB>
+
+
+# create an Ada shared library
+IF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY)
+  IF(APPLE)
+    # Temporary fixup for one user's Ada/Mac OS X problems when using the
+    # the 4.2 version of the http://macada.org/ version of the GNAT compiler.
+    SET(CMAKE_Ada_CREATE_SHARED_LIBRARY
+    "<CMAKE_Ada_COMPILER> <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> -lgcc_s.1"
+    )
+  ELSE(APPLE)
+    SET(CMAKE_Ada_CREATE_SHARED_LIBRARY
+    "<CMAKE_Ada_COMPILER> <CMAKE_SHARED_LIBRARY_Ada_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Ada_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Ada_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+    )
+  ENDIF(APPLE)
+ENDIF(NOT CMAKE_Ada_CREATE_SHARED_LIBRARY)
+
+# create an Ada shared module just copy the shared library rule
+IF(NOT CMAKE_Ada_CREATE_SHARED_MODULE)
+  SET(CMAKE_Ada_CREATE_SHARED_MODULE ${CMAKE_Ada_CREATE_SHARED_LIBRARY})
+ENDIF(NOT CMAKE_Ada_CREATE_SHARED_MODULE)
+
+# create an Ada static library
+IF(NOT CMAKE_Ada_CREATE_STATIC_LIBRARY)
+  SET(CMAKE_Ada_CREATE_STATIC_LIBRARY
+      "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
+      "<CMAKE_RANLIB> <TARGET> ")
+ENDIF(NOT CMAKE_Ada_CREATE_STATIC_LIBRARY)
+
+# compile a Ada file into an object file
+IF(NOT CMAKE_Ada_COMPILE_OBJECT)
+  SET(CMAKE_Ada_COMPILE_OBJECT
+    "<CMAKE_Ada_COMPILER> <FLAGS> -c <SOURCE> -o <OBJECT>
+    ")
+ENDIF(NOT CMAKE_Ada_COMPILE_OBJECT)
+
+# Constraints:  GNAT_EXECUTABLE_BUILDER = gnatmake
+# is required to do the compile+bind+link of
+# Ada executables, and it requires a source file name which is constructed from
+# <TARGET>.adb.  The source file arguments of add_executable are
+# all compiled by the above rule (which must remain that form since it
+# is also used to compile objects for Ada libraries), but the results are
+# ignored since they are put in a different directory while gnatmake assumes
+# objects are located in the _current_ directory.  Thus, put in a minimal
+# source file (with correct .adb suffix to identify the Ada language)
+# to reduce this useless compilation to a minimum.  Usually, the main Ada
+# routine qualifies since it is normally small.  Thus, the normal usage is
+# add_executable(foo foo.adb), but  add_executable(foo path/minimal.adb) would
+# work as well so long as both path/minimal.adb existed and foo.adb existed.
+# Also, note there is no way to specify 
+# ${CMAKE_CURRENT_SOURCE_DIR}/<TARGET>.adb as the code for gnatmake to compile
+# because in this context ${CMAKE_CURRENT_SOURCE_DIR} is set to the top
+# of the source tree and not the expected sub-directory of the source tree.
+# Thus, LINK_FLAGS -aI${CMAKE_CURRENT_SOURCE_DIR} must be set using
+# set_target_properties in order to specify the directory where <TARGET>.adb
+# exists. Note, LINK_FLAGS can also be used to set other gnatmake flags
+# such as -aL.
+
+# In sum, you have to be careful of your target name, the nominal source file
+# name has to be compilable, but otherwise it is ignored, and you must specify
+# the required -aI and other GNAT_EXECUTABLE_BUILDER = gnatmake options
+# using LINK_FLAGS specified with set_target_properties.  
+# However, so long as you pay attention to these
+# constraints, add_executable should work for the Ada language.
+
+IF(NOT CMAKE_Ada_LINK_EXECUTABLE)
+  # N.B. under some circumstances (build tests) GNAT_EXECUTABLE_BUILDER is not
+  # defined at this stage for unknown reasons so try to find it again as a 
+  # last resort.
+  GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_Ada_COMPILER}"
+    PATH)
+  FIND_PROGRAM(GNAT_EXECUTABLE_BUILDER NAMES gnatmake PATHS ${COMPILER_LOCATION} )
+
+  IF(APPLE)
+    # Temporary fixup for one user's Ada/Mac OS X problems when using the
+    # the 4.2 version of the http://macada.org/ version of the GNAT compiler.
+    SET(CMAKE_Ada_LINK_EXECUTABLE
+    "${GNAT_EXECUTABLE_BUILDER} <CMAKE_Ada_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE>.adb -cargs <FLAGS> -largs <LINK_LIBRARIES> -lgcc_s.1")
+  ELSE(APPLE)
+    SET(CMAKE_Ada_LINK_EXECUTABLE
+    "${GNAT_EXECUTABLE_BUILDER} <CMAKE_Ada_LINK_FLAGS> <LINK_FLAGS> <TARGET_BASE>.adb -cargs <FLAGS> -largs <LINK_LIBRARIES>")
+  ENDIF(APPLE)
+ENDIF(NOT CMAKE_Ada_LINK_EXECUTABLE)
+
+IF(CMAKE_Ada_STANDARD_LIBRARIES_INIT)
+  SET(CMAKE_Ada_STANDARD_LIBRARIES "${CMAKE_Ada_STANDARD_LIBRARIES_INIT}"
+    CACHE STRING "Libraries linked by default with all Ada applications.")
+  MARK_AS_ADVANCED(CMAKE_Ada_STANDARD_LIBRARIES)
+ENDIF(CMAKE_Ada_STANDARD_LIBRARIES_INIT)
+
+IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+  SET (CMAKE_Ada_FLAGS_DEBUG "${CMAKE_Ada_FLAGS_DEBUG_INIT}" CACHE STRING
+     "Flags used by the compiler during debug builds.")
+  SET (CMAKE_Ada_FLAGS_MINSIZEREL "${CMAKE_Ada_FLAGS_MINSIZEREL_INIT}" CACHE STRING
+     "Flags used by the compiler during release minsize builds.")
+  SET (CMAKE_Ada_FLAGS_RELEASE "${CMAKE_Ada_FLAGS_RELEASE_INIT}" CACHE STRING
+     "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
+  SET (CMAKE_Ada_FLAGS_RELWITHDEBINFO "${CMAKE_Ada_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
+     "Flags used by the compiler during Release with Debug Info builds.")
+ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
+
+MARK_AS_ADVANCED(
+CMAKE_Ada_FLAGS
+CMAKE_Ada_FLAGS_DEBUG
+CMAKE_Ada_FLAGS_MINSIZEREL
+CMAKE_Ada_FLAGS_RELEASE
+CMAKE_Ada_FLAGS_RELWITHDEBINFO
+)
+SET(CMAKE_Ada_INFORMATION_LOADED 1)
diff --git a/CMakeModules/CMakeDetermineAdaCompiler.cmake b/CMakeModules/CMakeDetermineAdaCompiler.cmake
new file mode 100644
index 0000000..87b811f
--- /dev/null
+++ b/CMakeModules/CMakeDetermineAdaCompiler.cmake
@@ -0,0 +1,65 @@
+# Determine the compiler to use for Ada programs
+# NOTE, a generator may set CMAKE_Ada_COMPILER before
+# loading this file to force a compiler.
+# use environment variable ADA first if defined by user, next use 
+# the cmake variable CMAKE_GENERATOR_ADA which can be defined by a generator
+# as a default compiler
+
+IF(NOT CMAKE_Ada_COMPILER)
+
+  # prefer the environment variable ADA
+  IF($ENV{ADA} MATCHES ".+")
+    GET_FILENAME_COMPONENT(CMAKE_Ada_COMPILER_INIT $ENV{ADA} PROGRAM PROGRAM_ARGS CMAKE_Ada_FLAGS_ENV_INIT)
+    IF(CMAKE_Ada_FLAGS_ENV_INIT)
+      SET(CMAKE_Ada_COMPILER_ARG1 "${CMAKE_Ada_FLAGS_ENV_INIT}" CACHE STRING "First argument to Ada compiler")
+    ENDIF(CMAKE_Ada_FLAGS_ENV_INIT)
+    IF(EXISTS ${CMAKE_Ada_COMPILER_INIT})
+    ELSE(EXISTS ${CMAKE_Ada_COMPILER_INIT})
+      MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable ADA:\n$ENV{ADA}.") 
+    ENDIF(EXISTS ${CMAKE_Ada_COMPILER_INIT})
+  ENDIF($ENV{ADA} MATCHES ".+")
+
+  # next try prefer the compiler specified by the generator
+  IF(CMAKE_GENERATOR_ADA) 
+    IF(NOT CMAKE_Ada_COMPILER_INIT)
+      SET(CMAKE_Ada_COMPILER_INIT ${CMAKE_GENERATOR_ADA})
+    ENDIF(NOT CMAKE_Ada_COMPILER_INIT)
+  ENDIF(CMAKE_GENERATOR_ADA)
+
+  # finally list compilers to try
+  IF(CMAKE_Ada_COMPILER_INIT)
+    SET(CMAKE_Ada_COMPILER_LIST ${CMAKE_Ada_COMPILER_INIT})
+  ELSE(CMAKE_Ada_COMPILER_INIT)
+    SET(CMAKE_Ada_COMPILER_LIST gnatgcc gcc)  
+  ENDIF(CMAKE_Ada_COMPILER_INIT)
+
+  # Find the compiler.
+  FIND_PROGRAM(CMAKE_Ada_COMPILER NAMES ${CMAKE_Ada_COMPILER_LIST} DOC "Ada compiler")
+  IF(CMAKE_Ada_COMPILER_INIT AND NOT CMAKE_Ada_COMPILER)
+    SET(CMAKE_Ada_COMPILER "${CMAKE_Ada_COMPILER_INIT}" CACHE FILEPATH "Ada compiler" FORCE)
+  ENDIF(CMAKE_Ada_COMPILER_INIT AND NOT CMAKE_Ada_COMPILER)
+ENDIF(NOT CMAKE_Ada_COMPILER)
+MARK_AS_ADVANCED(CMAKE_Ada_COMPILER)
+
+GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_Ada_COMPILER}"
+  PATH)
+
+FIND_PROGRAM(GNAT_EXECUTABLE_BUILDER NAMES gnatmake PATHS ${COMPILER_LOCATION} )
+FIND_PROGRAM(CMAKE_AR NAMES ar PATHS ${COMPILER_LOCATION} )
+
+FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib)
+IF(NOT CMAKE_RANLIB)
+   SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
+ENDIF(NOT CMAKE_RANLIB)
+MARK_AS_ADVANCED(CMAKE_RANLIB)
+
+# configure variables set in this file for fast reload later on
+#CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeAdaCompiler.cmake.in 
+#message(STATUS "DEBUG: CMAKE_BINARY_DIR = ${CMAKE_BINARY_DIR}")
+#message(STATUS "DEBUG: CMAKE_FILES_DIRECTORY = ${CMAKE_FILES_DIRECTORY}")
+#message(STATUS "DEBUG: CMAKE_PLATFORM_INFO_DIR = ${CMAKE_PLATFORM_INFO_DIR}")
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CMakeModules/CMakeAdaCompiler.cmake.in 
+               "${CMAKE_PLATFORM_INFO_DIR}/CMakeAdaCompiler.cmake" IMMEDIATE)
+MARK_AS_ADVANCED(CMAKE_AR)
+
+SET(CMAKE_Ada_COMPILER_ENV_VAR "ADA")
diff --git a/CMakeModules/CMakeTestAdaCompiler.cmake b/CMakeModules/CMakeTestAdaCompiler.cmake
new file mode 100644
index 0000000..03b07d0
--- /dev/null
+++ b/CMakeModules/CMakeTestAdaCompiler.cmake
@@ -0,0 +1,60 @@
+# This file is used by EnableLanguage in cmGlobalGenerator to determine that
+# the Ada builder GNAT_EXECUTABLE_BUILDER = gnatmake can actually compile
+# and link the most basic of programs.  If not, a fatal error is set and
+# cmake stops processing commands and will not generate any makefiles or
+# projects.
+
+IF(NOT CMAKE_Ada_COMPILER_WORKS)
+  MESSAGE(STATUS "Check for working Ada builder: ${GNAT_EXECUTABLE_BUILDER}")
+  FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testadacompiler.adb
+  "
+procedure testAdaCompiler is
+begin
+  null;
+end;
+  "
+  )
+
+  FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt
+  "
+# FIXME: This specific location currently needs to be changed whenever the
+# location of the experimental Ada support files is changed.
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeModules)
+set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL \"\" FORCE)
+project(test Ada)
+add_executable(testadacompiler testadacompiler.adb)
+  "
+  )
+
+# To avoid try_compile recurse error, use any binary directory other than
+# ${CMAKE_BINARY_DIR}.  The choice of
+# bindir = ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp is
+# especially advantageous since it makes an in-source build which
+# means that no special variables need to be set to find files.
+  try_compile(CMAKE_Ada_COMPILER_WORKS
+  ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+  ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+  projectName
+  OUTPUT_VARIABLE OUTPUT
+  )
+  SET(ADA_TEST_WAS_RUN 1)
+ENDIF(NOT CMAKE_Ada_COMPILER_WORKS)
+
+IF(NOT CMAKE_Ada_COMPILER_WORKS)
+  MESSAGE(STATUS "Check for working Ada builder: ${GNAT_EXECUTABLE_BUILDER} -- broken")
+  FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+    "Determining if the Ada builder works failed with "
+    "the following output:\n${OUTPUT}\n\n")
+  MESSAGE(FATAL_ERROR "The Ada builder \"${GNAT_EXECUTABLE_BUILDER}\" "
+    "is not able to compile, bind, and link a simple test program.\nIt fails "
+    "with the following output:\n ${OUTPUT}\n\n"
+    "CMake will not be able to correctly generate this project.")
+ELSE(NOT CMAKE_Ada_COMPILER_WORKS)
+  IF(ADA_TEST_WAS_RUN)
+    MESSAGE(STATUS "Check for working Ada builder: ${GNAT_EXECUTABLE_BUILDER} -- works")
+    FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+      "Determining if the Ada builder works passed with "
+      "the following output:\n${OUTPUT}\n\n") 
+  ENDIF(ADA_TEST_WAS_RUN)
+  SET(CMAKE_Ada_COMPILER_WORKS 1 CACHE INTERNAL "")
+ENDIF(NOT CMAKE_Ada_COMPILER_WORKS)
diff --git a/CMakeModules/FindOpenCL.cmake b/CMakeModules/FindOpenCL.cmake
new file mode 100644
index 0000000..0c45edc
--- /dev/null
+++ b/CMakeModules/FindOpenCL.cmake
@@ -0,0 +1,83 @@
+# - Try to find OpenCL
+# This module tries to find an OpenCL implementation on your system. It supports
+# AMD / ATI, Apple and NVIDIA implementations, but should work, too.
+#
+# To set manually the paths, define these environment variables:
+# OpenCL_INCPATH    - Include path (e.g. OpenCL_INCPATH=/opt/cuda/4.0/cuda/include)
+# OpenCL_LIBPATH    - Library path (e.h. OpenCL_LIBPATH=/usr/lib64/nvidia)
+#
+# Once done this will define
+#  OPENCL_FOUND        - system has OpenCL
+#  OPENCL_INCLUDE_DIRS  - the OpenCL include directory
+#  OPENCL_LIBRARIES    - link these to use OpenCL
+#
+# WIN32 should work, but is untested
+
+FIND_PACKAGE(PackageHandleStandardArgs)
+
+SET (OPENCL_VERSION_STRING "0.1.0")
+SET (OPENCL_VERSION_MAJOR 0)
+SET (OPENCL_VERSION_MINOR 1)
+SET (OPENCL_VERSION_PATCH 0)
+
+IF (APPLE)
+
+	FIND_LIBRARY(OPENCL_LIBRARIES OpenCL DOC "OpenCL lib for OSX")
+	FIND_PATH(OPENCL_INCLUDE_DIRS OpenCL/cl.h DOC "Include for OpenCL on OSX")
+	FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS OpenCL/cl.hpp DOC "Include for OpenCL CPP bindings on OSX")
+
+ELSE (APPLE)
+
+	IF (WIN32)
+
+		FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h)
+		FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp)
+
+		# The AMD SDK currently installs both x86 and x86_64 libraries
+		# This is only a hack to find out architecture
+		IF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" )
+			SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86_64")
+		ELSE (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
+			SET(OPENCL_LIB_DIR "$ENV{ATISTREAMSDKROOT}/lib/x86")
+		ENDIF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" )
+		FIND_LIBRARY(OPENCL_LIBRARIES OpenCL.lib PATHS ${OPENCL_LIB_DIR} ENV OpenCL_LIBPATH)
+
+		GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
+
+		# On Win32 search relative to the library
+		FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS "${_OPENCL_INC_CAND}" ENV OpenCL_INCPATH)
+		FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS "${_OPENCL_INC_CAND}" ENV OpenCL_INCPATH)
+
+	ELSE (WIN32)
+
+		# Unix style platforms
+		FIND_LIBRARY(OPENCL_LIBRARIES OpenCL
+			PATHS ENV LD_LIBRARY_PATH ENV OpenCL_LIBPATH
+		)
+
+		GET_FILENAME_COMPONENT(OPENCL_LIB_DIR ${OPENCL_LIBRARIES} PATH)
+		GET_FILENAME_COMPONENT(_OPENCL_INC_CAND ${OPENCL_LIB_DIR}/../../include ABSOLUTE)
+
+		# The AMD SDK currently does not place its headers
+		# in /usr/include, therefore also search relative
+		# to the library
+		FIND_PATH(OPENCL_INCLUDE_DIRS CL/cl.h PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include" "/opt/AMDAPP/include" ENV OpenCL_INCPATH)
+		FIND_PATH(_OPENCL_CPP_INCLUDE_DIRS CL/cl.hpp PATHS ${_OPENCL_INC_CAND} "/usr/local/cuda/include" "/opt/AMDAPP/include" ENV OpenCL_INCPATH)
+
+	ENDIF (WIN32)
+
+ENDIF (APPLE)
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCL DEFAULT_MSG OPENCL_LIBRARIES OPENCL_INCLUDE_DIRS)
+
+IF(_OPENCL_CPP_INCLUDE_DIRS)
+	SET( OPENCL_HAS_CPP_BINDINGS TRUE )
+	LIST( APPEND OPENCL_INCLUDE_DIRS ${_OPENCL_CPP_INCLUDE_DIRS} )
+	# This is often the same, so clean up
+	LIST( REMOVE_DUPLICATES OPENCL_INCLUDE_DIRS )
+ENDIF(_OPENCL_CPP_INCLUDE_DIRS)
+
+MARK_AS_ADVANCED(
+  OPENCL_INCLUDE_DIRS
+)
+
diff --git a/CMakeModules/ada.cmake b/CMakeModules/ada.cmake
new file mode 100644
index 0000000..b5661cb
--- /dev/null
+++ b/CMakeModules/ada.cmake
@@ -0,0 +1,15 @@
+# Find and check Ada compiler
+enable_language(Ada)
+if(NOT CMAKE_Ada_COMPILER_WORKS)
+  message(FATAL_ERROR "Required working Ada compiler not found.")
+endif(NOT CMAKE_Ada_COMPILER_WORKS)
+
+# Find the gnat version used in order to search for the right version of libgnat 
+execute_process(COMMAND ${CMAKE_Ada_COMPILER} --version OUTPUT_VARIABLE ADA_OUTPUT)
+string(REGEX MATCH "gcc [(][^)]*[)] ([0-9]*[.][0-9]*)[.][0-9]" ADA_OUTPUT_TRIM ${ADA_OUTPUT})
+set(GNATVERSION ${CMAKE_MATCH_1})
+message(STATUS "gnat version = ${GNATVERSION}")
+find_library(GNAT_LIB NAMES gnat gnat-${GNATVERSION})
+if(NOT GNAT_LIB)
+  message(FATAL_ERROR "Required gnat library not found.")
+endif(NOT GNAT_LIB)
diff --git a/README.ada b/README.ada
new file mode 100644
index 0000000..f9132ed
--- /dev/null
+++ b/README.ada
@@ -0,0 +1,31 @@
+Update 09/2014:
+
+The FlightGear build system has been extended to support an optional build mode that allows mixing Ada/C++ code easily. 
+
+Ada features like tasking have been shown to work properly. The source tree already contains a few examples on calling Ada code from C++ and vice versa. 
+
+The main thing missing now are wrappers for existing SimGear/FlightGear APIs like the property tree, so that Ada code can be interfaced to subsystems, or used to implement new subsystems. All changes are completely optional and do not affect the default, non-Ada, build. People interested in exploring Ada use in FlightGear are encouraged to get in touch with Hooray or onox using either the FlightGear forum or the wiki to coordinate all related efforts.
+
+So far, the new build mode has only been tested on Linux/Unix-based OS. Help with testing on Windows would be appreciated!
+
+== Build System Integration ==
+
+FlightGear is using the CMake/Ada modules provided by the PLPlot project.
+
+The CMake/Ada modules provided by PLPlot have a number of hard-coded constraints, including the assumption that the main executable is written in Ada, which requires some creative workarounds
+
+Thus, the current integration is kind of a workaround using the following approach for the time being, 
+which ensures that the changes to our existing build system are minimal:
+
+- We're using the PLPlot CMakeModules, copied them into $FG_SRC/CMakeModules
+- Ada support needs to be explicitly enabled using this cmake configuration flag: -DENABLE_ADA_MODULES=ON
+- what used to be fgfs is now instead linked into a library called libMain (when in Ada build mode)
+- int main is renamed and extern'ed "C" to disable C++ name mangling (only in Ada build mode)
+- the fgfs executable itself is now an Ada stub that imports main() from libMain (aka FlightGear) using pragma/import
+- the imported fgfs entry point is then executed, argc/argv are passed onto fgfs
+- cmake's add_library() is used to link libMain (FlightGear as a library) into the Ada executable/stub
+- linking is delegated to gnatmake this way, we can easily mix C, C++ and Ada sources this way by simply using cmake as before (see Developing using CMake)
+
+For additional information, please refer to the wiki: http://wiki.flightgear.org/Howto:Using_Ada_in_FlightGear
+
+
diff --git a/src/AdaTest/CMakeLists.txt b/src/AdaTest/CMakeLists.txt
new file mode 100644
index 0000000..f46ad55
--- /dev/null
+++ b/src/AdaTest/CMakeLists.txt
@@ -0,0 +1,13 @@
+include(FlightGearComponent)
+
+set(SOURCES
+	do_hello.adb
+	do_hello.ads
+)
+
+set(ALI_PREFIX 
+${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/adatest.dir
+)
+
+flightgear_component(AdaTest "${SOURCES}" "${HEADERS}")
+
diff --git a/src/AdaTest/do_hello.adb b/src/AdaTest/do_hello.adb
new file mode 100644
index 0000000..9f58b40
--- /dev/null
+++ b/src/AdaTest/do_hello.adb
@@ -0,0 +1,10 @@
+with Ada.Text_IO; use Ada.Text_IO;
+package body do_hello is
+
+function do_hello(prop: in SGPropertyNode_ptr) return boolean is
+begin
+ Ada.Text_IO.Put_Line("Hello World from Ada!");
+ return true;
+end do_hello;
+
+end do_hello;
diff --git a/src/AdaTest/do_hello.ads b/src/AdaTest/do_hello.ads
new file mode 100644
index 0000000..f51e95c
--- /dev/null
+++ b/src/AdaTest/do_hello.ads
@@ -0,0 +1,13 @@
+with System;
+package do_hello is
+type SGPropertyNode_ptr is new System.Address;
+function do_hello(prop: in SGPropertyNode_ptr) return Boolean;
+pragma Export
+( Convention    => CPP,
+  Entity        => do_hello,
+  External_Name => "do_hello"
+);
+end do_hello;
+
+
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2c2d83e..19df05c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,10 @@
 
 include_directories(${PROJECT_SOURCE_DIR})
 
+if(ENABLE_ADA_MODULES)
+  add_subdirectory(AdaTest)
+endif(ENABLE_ADA_MODULES)
+
 # note order here affects link order, and hence linking correctness
 # on systems with a traditional ld (eg, GNU ld on Linux)
 foreach( mylibfolder 
@@ -35,3 +39,4 @@ foreach( mylibfolder
 
 endforeach( mylibfolder )
 
+
diff --git a/src/Main/Ada/fgfs.adb b/src/Main/Ada/fgfs.adb
new file mode 100644
index 0000000..c6e5bdd
--- /dev/null
+++ b/src/Main/Ada/fgfs.adb
@@ -0,0 +1,39 @@
+with Ada.Task_Identification;  use Ada.Task_Identification;
+with Ada.Command_Line; use Ada.Command_Line;
+
+with Ada.Text_IO; use Ada.Text_IO;
+with hook;
+
+procedure fgfs is
+
+ -- this is just a test
+ task ping is
+  entry Quit;
+ end ping;
+ task body ping is
+ begin
+  loop
+    select
+      accept  Quit;
+      exit;
+    else
+      Put_Line("Ping from Ada task ...");
+      delay 5.0;
+    end select;
+  end loop;
+ end ping;
+
+ retval: Integer;
+begin
+ -- this will hand over control to the FlightGear main entry point
+ -- and pass on any command-line arguments and store the return
+ -- value for process termination
+ retval := hook.fgfs_main(hook.gnat_argc, hook.gnat_argv);
+ Set_Exit_Status( Exit_Status(retval) );
+ -- also terminate our demo task
+ ping.Quit;
+exception
+ when others => Put_Line("FlightGear exception raised");
+end fgfs;
+
+
diff --git a/src/Main/Ada/hook.ads b/src/Main/Ada/hook.ads
new file mode 100644
index 0000000..c066ea9
--- /dev/null
+++ b/src/Main/Ada/hook.ads
@@ -0,0 +1,13 @@
+with System;
+with Ada.Command_Line; use Ada.Command_Line;
+
+package hook is
+ gnat_argc : Integer;
+ gnat_argv : System.Address;
+
+ pragma Import (C, gnat_argc);
+ pragma Import (C, gnat_argv);
+ function fgfs_main(argc: Integer; argv:System.Address) return Integer;
+ pragma Import (C, fgfs_main);
+end hook;
+
diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt
index 4b6926e..ed6cae0 100644
--- a/src/Main/CMakeLists.txt
+++ b/src/Main/CMakeLists.txt
@@ -67,12 +67,48 @@ endforeach()
 source_group("Main\\Headers" FILES ${HEADERS})
 source_group("Main\\Sources" FILES ${SOURCES})
 
-# important we pass WIN32 here so the console is optional. Other
-# platforms ignore this option. If a console is needed we allocate
+# CMAKE details - these are used in options.cxx to write debugging info to the property tree
+add_definitions(
+			-DCMAKE_VERSION=${CMAKE_VERSION} 
+			-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} 
+			-DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}
+			-DCMAKE_SYSTEM=${CMAKE_SYSTEM}
+			-DCMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}
+)
+
+# add_executable(): important we pass WIN32 here so the console is optional. 
+# Other platforms ignore this option. If a console is needed we allocate
 # it manually via AllocConsole()
 # similarly pass MACOSX_BUNDLE so we generate a .app on Mac
-add_executable(fgfs WIN32 MACOSX_BUNDLE
-                ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
+
+if(ENABLE_ADA_MODULES)
+# this turns FlightGear into a library
+add_library(Main STATIC ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
+# rename int main to fgfs_main for linking FG as a lib 
+add_definitions(	-DFG_ENABLE_ADA_BUILD=1 
+			-DFG_GNAT_VERSION=${GNATVERSION} 
+		)
+
+# NOTE: the fgfs.adb entry below is ignored, see CMakeAdaInformation.cmake
+# the adb file name is based on <TARGET>.adb !
+add_executable(fgfs WIN32 MACOSX_BUNDLE Ada/fgfs.adb)
+
+# this is just for finding the fgfs.adb stub which calls the fgfs entry point
+# for details, refer to $FG_SRC/CMakeModules/CMakeAdaInformation.cmake 184+ (see "Constraints")
+set_target_properties(
+fgfs
+PROPERTIES
+LINK_FLAGS
+" -aI${CMAKE_SOURCE_DIR}/src/Main/Ada ")
+
+# this adds the FlightGear lib to the fgfs.adb program 
+target_link_libraries(fgfs Main) 
+
+# our default build, not using Ada - everything as before
+else(ENABLE_ADA_MODULES)
+ add_executable(fgfs WIN32 MACOSX_BUNDLE ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
+endif(ENABLE_ADA_MODULES)
+
 
 #-----------------------------------------------------------------------------
 # MacOSX bundle packagaing
@@ -133,6 +169,21 @@ endif()
 if(X11_FOUND)
     target_link_libraries(fgfs ${X11_LIBRARIES})
 endif()
+
+if(ENABLE_ADA_MODULES)
+target_link_libraries(Main
+	${SQLITE3_LIBRARY}
+	${SIMGEAR_LIBRARIES}
+	${OPENSCENEGRAPH_LIBRARIES}
+	${OPENGL_LIBRARIES}
+	${PLIB_LIBRARIES}
+	${HLA_LIBRARIES}
+	${EVENT_INPUT_LIBRARIES}
+	${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
+	${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
+	${PLATFORM_LIBS}
+)
+else(ENABLE_ADA_MODULES)
 target_link_libraries(fgfs
 	${SQLITE3_LIBRARY}
 	${SIMGEAR_LIBRARIES}
@@ -145,6 +196,7 @@ target_link_libraries(fgfs
 	${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
 	${PLATFORM_LIBS}
 )
+endif(ENABLE_ADA_MODULES)
 
 if(ENABLE_FLITE)
     if(SYSTEM_HTS_ENGINE)
@@ -175,3 +227,5 @@ if(ENABLE_METAR)
 
     install(TARGETS metar RUNTIME DESTINATION bin)
 endif()
+
+
diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx
index a59fdb4..29dfed8 100644
--- a/src/Main/bootstrap.cxx
+++ b/src/Main/bootstrap.cxx
@@ -67,9 +67,14 @@
 
 #include "fg_os.hxx"
 
+#if defined(SG_MAC)
+    #include <GUI/CocoaHelpers.h> // for transformToForegroundApp
+#endif
+
 #if defined(HAVE_CRASHRPT)
 	#include <CrashRpt.h>
 
+
 bool global_crashRptEnabled = false;
 
 #endif
@@ -126,8 +131,15 @@ static void initFPE(bool)
 }
 #endif
 
+#if FG_ENABLE_ADA_BUILD
+extern "C" { // disable mangling so that the Ada stub can find the entry point
+	int fgfs_main ( int argc, char **argv );
+}
+#else 
+	int main ( int argc, char **argv );
+#endif
+
 #if defined(SG_WINDOWS)
-int main ( int argc, char **argv );
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                              LPSTR lpCmdLine, int nCmdShow) {
 
@@ -142,9 +154,15 @@ static void fg_terminate()
 
 int _bootstrap_OSInit;
 
+#if FG_ENABLE_ADA_BUILD
+// for Ada support, FlightGear's main function is called from Ada, so is renamed here
+int fgfs_main( int argc, char **argv )
+#else
 // Main entry point; catch any exceptions that have made it this far.
-int main ( int argc, char **argv )
+int main( int argc, char **argv )
+#endif
 {
+
 #if defined(SG_WINDOWS)
   // Don't show blocking "no disk in drive" error messages on Windows 7,
   // silently return errors to application instead.
diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx
index 032db16..12b1df0 100644
--- a/src/Main/fg_commands.cxx
+++ b/src/Main/fg_commands.cxx
@@ -62,6 +62,13 @@ using std::string;
 using std::ifstream;
 using std::ofstream;
 
+#if FG_ENABLE_ADA_BUILD
+extern "C" {
+	bool do_hello(const SGPropertyNode*);
+}
+#endif
+
+
 
 ////////////////////////////////////////////////////////////////////////
 // Static helper functions.
@@ -1487,6 +1494,10 @@ static struct {
     { "profiler-start", do_profiler_start },
     { "profiler-stop",  do_profiler_stop },
 
+#if FG_ENABLE_ADA_BUILD
+    { "hello-ada", do_hello },
+#endif
+
     { 0, 0 }			// zero-terminated
 };
 
diff --git a/src/Main/options.cxx b/src/Main/options.cxx
index 937e007..a0ac2a6 100644
--- a/src/Main/options.cxx
+++ b/src/Main/options.cxx
@@ -31,6 +31,7 @@
 #include <simgear/timing/sg_time.hxx>
 #include <simgear/misc/sg_dir.hxx>
 
+#include <boost/version.hpp>
 #include <boost/foreach.hpp>
 
 #include <cmath>        // rint()
@@ -237,6 +238,19 @@ void fgSetDefaults ()
     v->setValueReadOnly("nightly-build", false);
 #endif
     
+    v->setValueReadOnly("boost-version", BOOST_VERSION);
+
+    //CMake details for better troubleshooting on the forum/issue tracker (*build* system !!)
+    v->setValueReadOnly("cmake-version", SG_STRINGIZE(CMAKE_VERSION));
+    v->setValueReadOnly("cmake-build-type", SG_STRINGIZE(CMAKE_BUILD_TYPE));
+    v->setValueReadOnly("cmake-host-processor", SG_STRINGIZE(CMAKE_SYSTEM_PROCESSOR));
+    v->setValueReadOnly("cmake-host-system", SG_STRINGIZE(CMAKE_SYSTEM));
+    v->setValueReadOnly("cmake-host-compiler-cxx", SG_STRINGIZE(CMAKE_CXX_COMPILER_ID));
+
+#if FG_ENABLE_ADA_BUILD
+    v->setValueReadOnly("gnat-version", FG_GNAT_VERSION);
+#endif
+
     char* envp = ::getenv( "http_proxy" );
     if( envp != NULL )
       fgSetupProxy( envp );