]> git.mxchange.org Git - flightgear.git/blobdiff - CMakeLists.txt
Reset: work with threaded OSG modes
[flightgear.git] / CMakeLists.txt
index d0ef8c4fda9f1a37a34289dfc0a3657fb194438a..35e12ac1cdcf97c99552b830545d0e55d1bbeff8 100644 (file)
@@ -37,7 +37,10 @@ set(CMAKE_MINSIZEREL_POSTFIX     ""  CACHE STRING "add a postfix, usually empty
 
 # read 'version' file into a variable (stripping any newlines or spaces)
 file(READ version versionFile)
-string(STRIP ${versionFile} FLIGHTGEAR_VERSION)
+if (NOT versionFile)
+    message(FATAL_ERROR "Unable to determine FlightGear version. Version file is missing.")
+endif()
+string(STRIP "${versionFile}" FLIGHTGEAR_VERSION)
 
 # FlightGear packaging (to build a source tarball)
 include( ConfigureCPack )
@@ -60,12 +63,32 @@ endif(NOT CMAKE_BUILD_TYPE)
 if(NOT "$ENV{BUILD_ID}" STREQUAL "")
     set(HUDSON_BUILD_ID $ENV{BUILD_ID})
     set(HUDSON_BUILD_NUMBER $ENV{BUILD_NUMBER})
-    message(STATUS "running under Hudson, build-number is ${HUDSON_BUILD_NUMBER}")
+    message(STATUS "running under Hudson/Jenkins, build-number is ${HUDSON_BUILD_NUMBER}")
 else()
     set(HUDSON_BUILD_NUMBER 0)
     set(HUDSON_BUILD_ID "none")
 endif()
 
+#####################################################################################
+# Configure library search paths
+#####################################################################################
+
+
+if(NOT "${CMAKE_LIBRARY_ARCHITECTURE}" STREQUAL "")
+    # Workaround for Ubuntu/Debian which introduced the "multiarch" library
+    # directory structure, which is unsupported by CMake < 2.8.10, so we need to
+    # add paths manually
+    # see http://www.cmake.org/Bug/view.php?id=12049 and
+    # http://www.cmake.org/Bug/view.php?id=12037
+    list(APPEND ADDITIONAL_LIBRARY_PATHS
+         /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
+         /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
+         /lib/${CMAKE_LIBRARY_ARCHITECTURE})
+    message(STATUS "additional library directories: ${ADDITIONAL_LIBRARY_PATHS}")
+endif()
+
+#####################################################################################
+
 IF(APPLE)
     set(EVENT_INPUT_DEFAULT 1)
 
@@ -74,11 +97,23 @@ IF(APPLE)
     list(APPEND PLATFORM_LIBS ${COCOA_LIBRARY} ${CORESERVICES_LIBRARY})
 
 elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
+    set(USE_DBUS_DEFAULT 1)
     find_package(UDev)
 
     if(UDEV_FOUND)
         set(EVENT_INPUT_DEFAULT 1)
     endif(UDEV_FOUND)
+
+    find_package(Speex)
+    find_package(Speexdsp)
+    if(SPEEX_FOUND AND SPEEXDSP_FOUND)
+        set(SYSTEM_SPEEX_DEFAULT 1)
+    endif(SPEEX_FOUND AND SPEEXDSP_FOUND)
+
+    find_package(Gsm)
+    if(GSM_FOUND)
+        set(SYSTEM_GSM_DEFAULT 1)
+    endif(GSM_FOUND)
 endif()
 
 find_package(Git)
@@ -91,19 +126,37 @@ else()
     set(REVISION "none")
 endif()
 
-option(LOGGING           "Set to OFF to build FlightGear without logging" ON)
+# FlightGear build options
+option(SIMGEAR_SHARED    "Set to ON when SimGear was built as a shared library" OFF)
+option(LOGGING           "Set to ON to build FlightGear with logging support (default)" ON)
+option(JSBSIM_TERRAIN    "Set to ON to build FlightGear with JSBSim terrain handling code" ON)
 option(SP_FDMS           "Set to ON to build FlightGear with special-purpose FDMs" OFF)
 option(ENABLE_UIUC_MODEL "Set to ON to build FlightGear with UIUCModel FDM" OFF)
 option(ENABLE_LARCSIM    "Set to ON to build FlightGear with LaRCsim FDM" OFF)
-option(ENABLE_YASIM      "Set to ON to build FlightGear with YASIM FDM" ON)
-option(ENABLE_JSBSIM     "Set to ON to build FlightGear with JSBSim FDM" ON)
-option(ENABLE_FGADMIN    "Set to ON to build FlightGear with FGADMIN" ON)
+option(ENABLE_YASIM      "Set to ON to build FlightGear with YASIM FDM (default)" ON)
+option(ENABLE_JSBSIM     "Set to ON to build FlightGear with JSBSim FDM (default)" ON)
 option(EVENT_INPUT       "Set to ON to build FlightGear with event-based Input support" ${EVENT_INPUT_DEFAULT})
-option(ENABLE_LIBSVN     "Set to ON to build FlightGear/terrasync with libsvnclient support" ON)
-option(ENABLE_RTI        "Set to ON to build SimGear with RTI support" OFF)
-option(WITH_FGPANEL      "Set to ON to build the fgpanel application" ON)
-option(JPEG_FACTORY      "Enable JPEG-factory support" OFF)
-option(ENABLE_TESTS      "Set to OFF to disable building test applications" ON)
+option(ENABLE_RTI        "Set to ON to build FlightGear with RTI support" OFF)
+option(ENABLE_PROFILE    "Set to ON to build FlightGear with gperftools profiling support" OFF)
+option(SYSTEM_SQLITE     "Set to ON to build FlightGear with the system's SQLite3 library" OFF)
+option(ENABLE_IAX        "Set to ON to build FlightGear with IAXClient/fgcom built-in (default)" ON)
+option(USE_DBUS          "Set to ON to build FlightGear with DBus screensaver interaction (default on Linux)" ${USE_DBUS_DEFAULT})
+option(SYSTEM_SPEEX      "Set to ON to build IAXClient with the system's speex and speexdsp library" ${SYSTEM_SPEEX_DEFAULT})
+option(SYSTEM_GSM        "Set to ON to build IAXClient with the system's GSM library" ${SYSTEM_GSM_DEFAULT})
+
+# additional utilities
+option(ENABLE_FGADMIN    "Set to ON to build the FGADMIN application (default)" ON)
+option(ENABLE_FGELEV     "Set to ON to build the fgelev application (default)" ON)
+option(WITH_FGPANEL      "Set to ON to build the fgpanel application (default)" ON)
+option(ENABLE_FGVIEWER   "Set to ON to build the fgviewer application (default)" ON)
+option(ENABLE_GPSSMOOTH  "Set to ON to build the GPSsmooth application (default)" ON)
+option(ENABLE_TERRASYNC  "Set to ON to build the terrasync application (default)" ON)
+option(ENABLE_FGJS       "Set to ON to build the fgjs application (default)" ON)
+option(ENABLE_JS_DEMO    "Set to ON to build the js_demo application (default)" ON)
+option(ENABLE_METAR      "Set to ON to build the metar application (default)" ON)
+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" OFF)
 
 if(LOGGING)
     # nothing
@@ -111,10 +164,18 @@ else()
     set(FG_NDEBUG 1)
 endif()
 
+if(JSBSIM_TERRAIN)
+   set(JSBSIM_USE_GROUNDREACTIONS 1)
+endif()
+
 if(SP_FDMS)
     set(ENABLE_SP_FDM 1)
 endif()
 
+if(ENABLE_FGCOM)
+  set(ENABLE_IAX 1)
+endif()
+
 # Setup MSVC 3rd party directories
 include( ConfigureMsvc3rdParty )
 
@@ -125,6 +186,7 @@ if(EVENT_INPUT)
             message(WARNING "UDev not found, event input is disabled!")
             set(EVENT_INPUT 0)
         else()
+            add_definitions(-DWITH_EVENTINPUT)
             set(EVENT_INPUT_LIBRARIES ${UDEV_LIBRARIES})
             message(STATUS "event-based input enabled. Using ${UDEV_LIBRARIES}")
         endif()
@@ -144,7 +206,16 @@ find_package(ZLIB    REQUIRED)
 find_package(Threads REQUIRED)
 find_package(OpenGL  REQUIRED)
 find_package(OpenAL  REQUIRED)
-find_package(OpenSceneGraph 3.0.0 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
+find_package(OpenSceneGraph 3.2.0 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
+
+if (MSVC)
+       find_package(CrashRpt)
+       if (CRASHRPT_FOUND)
+               set(HAVE_CRASHRPT 1)
+               message(STATUS "Using CrashRpt")
+        include_directories( ${CRASHRPT_INCLUDE_DIR})
+       endif()
+endif()
 
 if(ENABLE_FGADMIN)
     find_package(FLTK)
@@ -160,56 +231,78 @@ if(ENABLE_FGADMIN)
             list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB})
         endif()
 
+        if ( CMAKE_DL_LIBS )
+            list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})
+        endif()
+
         message(STATUS "Using FLTK_LIBRARIES for fgadmin: ${FLTK_LIBRARIES}")
     endif ( FLTK_FOUND )
 endif(ENABLE_FGADMIN)
 
-if(ENABLE_LIBSVN)
-    find_package(SvnClient)
+##############################################################################
+## Sqlite3 setup
 
-    if(LIBSVN_FOUND)
-        message(STATUS "libsvn found, enabling in terrasync")
-        set(HAVE_SVN_CLIENT_H 1)
-        set(HAVE_LIBSVN_CLIENT_1 1)
+if (SYSTEM_SQLITE)
+    find_package(SQLite3 REQUIRED)
+    
+    message(STATUS "Using system SQLite3 library")
+else()
+    set(SQLITE3_INCLUDED_DIR "${CMAKE_SOURCE_DIR}/3rdparty/sqlite3")
+    # this target is defined in src/Navaids/CMakeLists.txt
+    list(APPEND SQLITE3_LIBRARY fgsqlite3)
+endif (SYSTEM_SQLITE)
+
+# Sqlite always depends on the threading lib
+list(APPEND SQLITE3_LIBRARY ${CMAKE_THREAD_LIBS_INIT})
+
+##############################################################################
+## DBus setup
+
+if (USE_DBUS)
+    include(FindPkgConfig)
+    if (PKG_CONFIG_FOUND)
+        pkg_check_modules(DBUS dbus-1)
+    endif (PKG_CONFIG_FOUND) #if we don't have pkg-config, assume we don't have libdbus-1-dev either http://packages.debian.org/sid/libdbus-1-dev
+    if (DBUS_FOUND)
+        set(HAVE_DBUS 1)
+        message(STATUS "Using DBus")
+        include_directories( ${DBUS_INCLUDE_DIRS})
     else()
-        message(STATUS "libsvn missing. Disabling...")
-    endif(LIBSVN_FOUND)
-endif(ENABLE_LIBSVN)
+        message(STATUS "DBus not found, screensaver control disabled")
+    endif (DBUS_FOUND)
+else()
+endif (USE_DBUS)
+
+# Sqlite always depends on the threading lib
+list(APPEND SQLITE3_LIBRARY ${CMAKE_THREAD_LIBS_INIT})
+
+##############################################################################
 
 find_package(PLIB REQUIRED puaux pu js fnt)
 
 # FlightGear and SimGear versions need to match
 find_package(SimGear ${FLIGHTGEAR_VERSION} REQUIRED)
 
-if (JPEG_FACTORY)
-    # check simgear was built with JPEG-factory support
-    find_package(JPEG REQUIRED)
-    include_directories(${JPEG_INCLUDE_DIR})
-
-    set(CMAKE_REQUIRED_INCLUDES
-        ${SIMGEAR_INCLUDE_DIR}
-        ${JPEG_INCLUDE_DIR}
-        ${OPENSCENEGRAPH_INCLUDE_DIRS})
-
-    check_cxx_source_compiles(
-        "#include <simgear/screen/jpgfactory.hxx>
-        int main()    { return 0; } "
-        FG_JPEG_SERVER)
-
-    if (NOT FG_JPEG_SERVER)
-        message(STATUS "JPEG server support requested, but SimGear was built without JPEG support")
-    endif()
-endif()
+##############################################################################
 
 check_include_file(unistd.h   HAVE_UNISTD_H)
 check_include_file(sys/time.h HAVE_SYS_TIME_H)
 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")
+endif()
+
 if(ENABLE_RTI)
+    message(STATUS "RTI: ENABLED")
     find_package(RTI)
     if(RTI_FOUND)
         set(FG_HAVE_HLA 1)
     endif(RTI_FOUND)
+else()
+    message(STATUS "RTI: DISABLED")
 endif(ENABLE_RTI)
 
 if(CMAKE_COMPILER_IS_GNUCXX)
@@ -230,10 +323,10 @@ if(WIN32)
         #     SET(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
         # endforeach(warning)
 
-        set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS")
-        if (${MSVC_VERSION} EQUAL 1600)
+        set(MSVC_FLAGS "-DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS -Dstrdup=_strdup")
+        if (${MSVC_VERSION} GREATER 1599)
             set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" )
-        endif (${MSVC_VERSION} EQUAL 1600)
+        endif (${MSVC_VERSION} GREATER 1599)
     endif(MSVC)
 
     set(NOMINMAX 1)
@@ -251,15 +344,22 @@ include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
     ${OPENGL_INCLUDE_DIR}
     ${OPENAL_INCLUDE_DIR}
     ${SIMGEAR_INCLUDE_DIR}
-    ${PLIB_INCLUDE_DIR} )
+    ${PLIB_INCLUDE_DIR}
+    ${SQLITE3_INCLUDED_DIR} )
 
+include_directories(${PROJECT_SOURCE_DIR})
 include_directories(${PROJECT_SOURCE_DIR}/src)
-
+include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib ) # for iaxclient.h
 # following is needed, because config.h is include 'bare', whereas
 # version.h is included as <Include/version.h> - this should be cleaned up
 include_directories(${PROJECT_BINARY_DIR}/src)
 include_directories(${PROJECT_BINARY_DIR}/src/Include)
 
+if (ENABLE_FLITE)
+    include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include )
+    include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/include )
+endif()
+
 add_definitions(-DHAVE_CONFIG_H)
 
 check_function_exists(mkfifo HAVE_MKFIFO)
@@ -277,8 +377,9 @@ configure_file (
     "${PROJECT_BINARY_DIR}/src/Include/version.h"
 )
 
-add_subdirectory(src)
+add_subdirectory(3rdparty)
 add_subdirectory(utils)
+add_subdirectory(src)
 add_subdirectory(man)
 
 #-----------------------------------------------------------------------------