2011-09-11 19:44:43 +00:00
|
|
|
cmake_minimum_required (VERSION 2.6.4)
|
2010-11-30 10:08:30 +00:00
|
|
|
|
|
|
|
include (CheckFunctionExists)
|
|
|
|
include (CheckCSourceCompiles)
|
2010-12-25 23:44:02 +00:00
|
|
|
include (CheckCXXSourceCompiles)
|
|
|
|
include (CheckIncludeFile)
|
2011-10-22 15:07:09 +00:00
|
|
|
|
2010-11-30 10:08:30 +00:00
|
|
|
project(FlightGear)
|
|
|
|
|
2011-11-30 22:33:03 +00:00
|
|
|
# We have some custom .cmake scripts not in the official distribution.
|
|
|
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
|
|
|
|
2011-11-30 18:56:44 +00:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
|
|
|
|
# use official include provided by latest CMake
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
else(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
|
|
|
|
# backward compatibility: use our own module for older cmake versions
|
|
|
|
include(OldGNUInstallDirs)
|
|
|
|
endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
|
|
|
|
|
2012-07-17 17:19:17 +00:00
|
|
|
# Warning when build is not an out-of-source build.
|
|
|
|
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" InSourceBuild)
|
|
|
|
if(InSourceBuild)
|
|
|
|
message(WARNING "Avoid building inside the source tree!")
|
|
|
|
message(WARNING "Create a separate build directory instead (i.e. 'fgbuild') and call CMake from there: ")
|
|
|
|
message(WARNING " mkdir ../fgbuild && cd ../fgbuild && cmake ${CMAKE_SOURCE_DIR}")
|
|
|
|
endif(InSourceBuild)
|
|
|
|
|
2012-08-18 11:40:57 +00:00
|
|
|
# System detection/default settings
|
|
|
|
include( DetectDistro )
|
2012-08-18 12:11:31 +00:00
|
|
|
include( DetectBrowser )
|
2012-08-18 11:40:57 +00:00
|
|
|
|
2012-03-12 20:18:37 +00:00
|
|
|
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
|
|
|
|
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
|
|
|
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
|
|
|
set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
2011-01-05 16:19:42 +00:00
|
|
|
|
2011-01-01 21:46:16 +00:00
|
|
|
# read 'version' file into a variable (stripping any newlines or spaces)
|
|
|
|
file(READ version versionFile)
|
2012-08-26 13:28:51 +00:00
|
|
|
if (NOT versionFile)
|
|
|
|
message(FATAL_ERROR "Unable to determine FlightGear version. Version file is missing.")
|
|
|
|
endif()
|
|
|
|
string(STRIP "${versionFile}" FLIGHTGEAR_VERSION)
|
2010-11-30 10:08:30 +00:00
|
|
|
|
2012-08-18 11:40:08 +00:00
|
|
|
# FlightGear packaging (to build a source tarball)
|
|
|
|
include( ConfigureCPack )
|
2011-10-22 15:07:09 +00:00
|
|
|
|
2012-08-18 11:40:08 +00:00
|
|
|
# FlightGear base package path
|
2011-11-01 17:05:54 +00:00
|
|
|
if (FG_DATA_DIR)
|
2012-08-18 11:40:08 +00:00
|
|
|
message(STATUS "Using explicit data directory for base package: ${FG_DATA_DIR}")
|
2011-11-01 17:05:54 +00:00
|
|
|
else()
|
2011-11-05 13:17:08 +00:00
|
|
|
set(FG_DATA_DIR "${CMAKE_INSTALL_PREFIX}/lib/FlightGear" CACHE PATH "Default location where data files are located")
|
2012-08-18 11:40:08 +00:00
|
|
|
message(STATUS "Using default data directory for base package: ${FG_DATA_DIR}")
|
2011-11-01 17:05:54 +00:00
|
|
|
endif()
|
2010-11-30 10:08:30 +00:00
|
|
|
|
2011-09-12 06:10:48 +00:00
|
|
|
# Change the default build type to something fast
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2012-03-12 20:18:37 +00:00
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING
|
|
|
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
|
|
|
FORCE)
|
2011-09-12 06:10:48 +00:00
|
|
|
endif(NOT CMAKE_BUILD_TYPE)
|
|
|
|
|
2011-12-28 11:24:22 +00:00
|
|
|
if(NOT "$ENV{BUILD_ID}" STREQUAL "")
|
2012-03-12 20:18:37 +00:00
|
|
|
set(HUDSON_BUILD_ID $ENV{BUILD_ID})
|
|
|
|
set(HUDSON_BUILD_NUMBER $ENV{BUILD_NUMBER})
|
2012-08-26 13:28:51 +00:00
|
|
|
message(STATUS "running under Hudson/Jenkins, build-number is ${HUDSON_BUILD_NUMBER}")
|
2011-01-01 18:24:53 +00:00
|
|
|
else()
|
2012-03-12 20:18:37 +00:00
|
|
|
set(HUDSON_BUILD_NUMBER 0)
|
|
|
|
set(HUDSON_BUILD_ID "none")
|
2011-01-01 18:24:53 +00:00
|
|
|
endif()
|
|
|
|
|
2012-12-01 10:01:25 +00:00
|
|
|
#####################################################################################
|
|
|
|
# Configure library search paths
|
|
|
|
#####################################################################################
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
# Custom library directories for Mac, which should have precedence over any other
|
|
|
|
list(APPEND ADDITIONAL_LIBRARY_PATHS
|
|
|
|
~/Library/Frameworks
|
|
|
|
/Library/Frameworks)
|
|
|
|
endif(APPLE)
|
|
|
|
|
|
|
|
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(NOT MSVC)
|
|
|
|
# TBD: are these really necessary? Aren't they considered by cmake automatically?
|
|
|
|
list(APPEND ADDITIONAL_LIBRARY_PATHS
|
2012-12-01 10:06:50 +00:00
|
|
|
/opt/local
|
2012-12-01 10:01:25 +00:00
|
|
|
/usr/local
|
|
|
|
/usr)
|
|
|
|
endif()
|
|
|
|
#####################################################################################
|
|
|
|
|
2011-09-21 16:13:13 +00:00
|
|
|
IF(APPLE)
|
|
|
|
set(EVENT_INPUT_DEFAULT 1)
|
2012-03-12 20:18:37 +00:00
|
|
|
|
2011-10-16 18:55:04 +00:00
|
|
|
find_library(CORESERVICES_LIBRARY CoreServices)
|
2011-11-20 13:23:52 +00:00
|
|
|
find_library(COCOA_LIBRARY Cocoa)
|
|
|
|
list(APPEND PLATFORM_LIBS ${COCOA_LIBRARY} ${CORESERVICES_LIBRARY})
|
2011-10-16 18:55:04 +00:00
|
|
|
|
2011-09-21 16:13:13 +00:00
|
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
2012-03-12 20:18:37 +00:00
|
|
|
find_package(UDev)
|
2011-12-04 13:37:25 +00:00
|
|
|
|
2012-03-12 20:18:37 +00:00
|
|
|
if(UDEV_FOUND)
|
|
|
|
set(EVENT_INPUT_DEFAULT 1)
|
|
|
|
endif(UDEV_FOUND)
|
2011-09-21 16:13:13 +00:00
|
|
|
endif()
|
|
|
|
|
2011-01-01 18:24:53 +00:00
|
|
|
find_package(Git)
|
|
|
|
if (GIT_FOUND)
|
2012-03-12 20:18:37 +00:00
|
|
|
execute_process(COMMAND git --git-dir ${PROJECT_SOURCE_DIR}/.git rev-parse HEAD
|
|
|
|
OUTPUT_VARIABLE REVISION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
message(STATUS "Git revision is ${REVISION}")
|
2011-01-01 18:24:53 +00:00
|
|
|
else()
|
2012-03-12 20:18:37 +00:00
|
|
|
set(REVISION "none")
|
2011-01-01 18:24:53 +00:00
|
|
|
endif()
|
|
|
|
|
2012-08-26 13:28:51 +00:00
|
|
|
# FlightGear build options
|
2012-10-04 18:57:35 +00:00
|
|
|
option(SIMGEAR_SHARED "Set to ON when SimGear was built as a shared library" OFF)
|
2012-08-26 13:28:51 +00:00
|
|
|
option(LOGGING "Set to ON to build FlightGear with logging support (default)" ON)
|
2012-03-12 20:18:37 +00:00
|
|
|
option(SP_FDMS "Set to ON to build FlightGear with special-purpose FDMs" OFF)
|
2011-11-01 16:21:59 +00:00
|
|
|
option(ENABLE_UIUC_MODEL "Set to ON to build FlightGear with UIUCModel FDM" OFF)
|
2012-03-12 20:18:37 +00:00
|
|
|
option(ENABLE_LARCSIM "Set to ON to build FlightGear with LaRCsim FDM" OFF)
|
2012-08-26 13:28:51 +00:00
|
|
|
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)
|
2012-03-12 20:18:37 +00:00
|
|
|
option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support" ${EVENT_INPUT_DEFAULT})
|
2012-08-26 13:28:51 +00:00
|
|
|
option(ENABLE_RTI "Set to ON to build FlightGear with RTI support" OFF)
|
2012-11-19 12:10:38 +00:00
|
|
|
option(ENABLE_PROFILE "Set to ON to build FlightGear with gperftools profiling support" OFF)
|
2012-08-26 13:28:51 +00:00
|
|
|
option(JPEG_FACTORY "Set to ON to build FlightGear with JPEG-factory support" OFF)
|
2012-09-19 13:28:25 +00:00
|
|
|
option(SYSTEM_SQLITE "Set to ON to build FlightGear with the system's SQLite3 library" OFF)
|
2013-09-27 18:24:19 +00:00
|
|
|
option(ENABLE_IAX "Set to ON to build FlightGear with IAXClient/fgcom built-in (default)" ON)
|
2012-08-26 13:28:51 +00:00
|
|
|
|
|
|
|
# additional utilities
|
|
|
|
option(ENABLE_FGADMIN "Set to ON to build the FGADMIN application (default)" ON)
|
2013-02-12 16:38:46 +00:00
|
|
|
option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON)
|
2012-08-26 13:28:51 +00:00
|
|
|
option(WITH_FGPANEL "Set to ON to build the fgpanel application (default)" ON)
|
2013-02-12 16:38:46 +00:00
|
|
|
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)
|
2012-08-26 13:28:51 +00:00
|
|
|
option(ENABLE_TESTS "Set to ON to build test applications (default)" ON)
|
2013-09-27 14:05:45 +00:00
|
|
|
option(ENABLE_FGCOM "Set to ON to build the FGCom application (default)" ON)
|
2011-09-26 12:33:06 +00:00
|
|
|
|
2010-11-30 10:08:30 +00:00
|
|
|
if(LOGGING)
|
2012-03-12 20:18:37 +00:00
|
|
|
# nothing
|
2010-11-30 10:08:30 +00:00
|
|
|
else()
|
2012-03-12 20:18:37 +00:00
|
|
|
set(FG_NDEBUG 1)
|
2010-11-30 10:08:30 +00:00
|
|
|
endif()
|
|
|
|
|
2011-06-12 13:17:03 +00:00
|
|
|
if(SP_FDMS)
|
2012-03-12 20:18:37 +00:00
|
|
|
set(ENABLE_SP_FDM 1)
|
2010-11-30 10:08:30 +00:00
|
|
|
endif()
|
|
|
|
|
2013-09-27 18:24:19 +00:00
|
|
|
if(ENABLE_FGCOM)
|
|
|
|
set(ENABLE_IAX 1)
|
|
|
|
endif()
|
|
|
|
|
2012-08-18 11:40:08 +00:00
|
|
|
# Setup MSVC 3rd party directories
|
|
|
|
include( ConfigureMsvc3rdParty )
|
2011-01-01 21:22:37 +00:00
|
|
|
|
2011-09-21 16:13:13 +00:00
|
|
|
if(EVENT_INPUT)
|
2012-08-18 11:40:08 +00:00
|
|
|
if(APPLE)
|
2012-03-12 20:18:37 +00:00
|
|
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|
|
|
if(NOT UDEV_FOUND)
|
|
|
|
message(WARNING "UDev not found, event input is disabled!")
|
|
|
|
set(EVENT_INPUT 0)
|
|
|
|
else()
|
2012-09-22 12:20:49 +00:00
|
|
|
add_definitions(-DWITH_EVENTINPUT)
|
2012-03-12 20:18:37 +00:00
|
|
|
set(EVENT_INPUT_LIBRARIES ${UDEV_LIBRARIES})
|
2012-08-18 11:40:08 +00:00
|
|
|
message(STATUS "event-based input enabled. Using ${UDEV_LIBRARIES}")
|
2012-03-12 20:18:37 +00:00
|
|
|
endif()
|
|
|
|
else()
|
2012-08-18 11:40:08 +00:00
|
|
|
message(WARNING "event-based input is not supported on this platform yet")
|
2012-03-12 20:18:37 +00:00
|
|
|
endif()
|
2011-12-04 13:37:25 +00:00
|
|
|
|
2012-03-12 20:18:37 +00:00
|
|
|
# Keep PLIB INPUT enabled as long as EventInput does not replace current joystick configurations.
|
|
|
|
set(ENABLE_PLIB_JOYSTICK 1)
|
2011-09-21 16:13:13 +00:00
|
|
|
else(EVENT_INPUT)
|
2012-03-12 20:18:37 +00:00
|
|
|
set(ENABLE_PLIB_JOYSTICK 1)
|
2011-09-21 16:13:13 +00:00
|
|
|
endif(EVENT_INPUT)
|
2011-01-01 21:22:37 +00:00
|
|
|
|
2010-11-30 10:08:30 +00:00
|
|
|
# check required dependencies
|
2012-03-12 20:18:37 +00:00
|
|
|
find_package(Boost REQUIRED)
|
|
|
|
find_package(ZLIB REQUIRED)
|
2010-11-30 10:08:30 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2012-03-12 20:18:37 +00:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
find_package(OpenAL REQUIRED)
|
2011-11-26 15:41:35 +00:00
|
|
|
find_package(OpenSceneGraph 3.0.0 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
|
2011-01-06 16:56:07 +00:00
|
|
|
|
|
|
|
if(ENABLE_FGADMIN)
|
2012-03-12 20:18:37 +00:00
|
|
|
find_package(FLTK)
|
2011-12-18 15:18:46 +00:00
|
|
|
|
2012-03-12 20:18:37 +00:00
|
|
|
if ( FLTK_FOUND )
|
|
|
|
if ( X11_Xinerama_FOUND )
|
|
|
|
message(STATUS "Found X11_Xinerama...")
|
|
|
|
list(APPEND FLTK_LIBRARIES ${X11_Xinerama_LIB})
|
|
|
|
endif()
|
2012-01-03 21:02:48 +00:00
|
|
|
|
2012-03-12 20:18:37 +00:00
|
|
|
if ( X11_Xft_FOUND )
|
|
|
|
message(STATUS "Found X11_Xft...")
|
|
|
|
list(APPEND FLTK_LIBRARIES ${X11_Xft_LIB})
|
|
|
|
endif()
|
2011-12-18 15:18:46 +00:00
|
|
|
|
2013-07-14 18:49:04 +00:00
|
|
|
if ( CMAKE_DL_LIBS )
|
|
|
|
list(APPEND FLTK_LIBRARIES ${CMAKE_DL_LIBS})
|
|
|
|
endif()
|
|
|
|
|
2012-03-12 20:18:37 +00:00
|
|
|
message(STATUS "Using FLTK_LIBRARIES for fgadmin: ${FLTK_LIBRARIES}")
|
|
|
|
endif ( FLTK_FOUND )
|
2011-01-06 16:56:07 +00:00
|
|
|
endif(ENABLE_FGADMIN)
|
2011-01-01 21:22:37 +00:00
|
|
|
|
2013-09-25 12:54:16 +00:00
|
|
|
##############################################################################
|
|
|
|
## Sqlite3 setup
|
|
|
|
|
2012-09-19 13:28:25 +00:00
|
|
|
if (SYSTEM_SQLITE)
|
|
|
|
find_package(SQLite3 REQUIRED)
|
2013-09-25 12:54:16 +00:00
|
|
|
|
2012-09-19 13:28:25 +00:00
|
|
|
message(STATUS "Using system SQLite3 library")
|
2013-09-25 12:54:16 +00:00
|
|
|
else()
|
|
|
|
set(SQLITE3_INCLUDED_DIR "${CMAKE_SOURCE_DIR}/3rdparty/sqlite3")
|
|
|
|
# this target is defined in src/Navaids/CMakeLists.txt
|
|
|
|
list(APPEND SQLITE3_LIBRARY fgsqlite3)
|
2012-09-19 13:28:25 +00:00
|
|
|
endif (SYSTEM_SQLITE)
|
|
|
|
|
2012-09-21 20:32:07 +00:00
|
|
|
# Sqlite always depends on the threading lib
|
|
|
|
list(APPEND SQLITE3_LIBRARY ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
2013-09-25 12:54:16 +00:00
|
|
|
##############################################################################
|
|
|
|
|
2011-01-14 21:37:39 +00:00
|
|
|
find_package(PLIB REQUIRED puaux pu js fnt)
|
2012-01-31 20:42:37 +00:00
|
|
|
|
2013-09-28 13:17:53 +00:00
|
|
|
# FlightGear and SimGear versions need to match
|
|
|
|
find_package(SimGear ${FLIGHTGEAR_VERSION} REQUIRED)
|
2010-11-30 10:08:30 +00:00
|
|
|
|
2013-09-28 13:15:47 +00:00
|
|
|
##############################################################################
|
|
|
|
|
2011-11-05 13:17:08 +00:00
|
|
|
if (JPEG_FACTORY)
|
|
|
|
# check simgear was built with JPEG-factory support
|
|
|
|
find_package(JPEG REQUIRED)
|
|
|
|
include_directories(${JPEG_INCLUDE_DIR})
|
2012-03-12 20:18:37 +00:00
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES
|
|
|
|
${SIMGEAR_INCLUDE_DIR}
|
|
|
|
${JPEG_INCLUDE_DIR}
|
2011-11-06 10:51:02 +00:00
|
|
|
${OPENSCENEGRAPH_INCLUDE_DIRS})
|
2012-03-12 20:18:37 +00:00
|
|
|
|
2011-11-05 13:17:08 +00:00
|
|
|
check_cxx_source_compiles(
|
|
|
|
"#include <simgear/screen/jpgfactory.hxx>
|
|
|
|
int main() { return 0; } "
|
|
|
|
FG_JPEG_SERVER)
|
2012-03-12 20:18:37 +00:00
|
|
|
|
2011-11-05 13:17:08 +00:00
|
|
|
if (NOT FG_JPEG_SERVER)
|
|
|
|
message(STATUS "JPEG server support requested, but SimGear was built without JPEG support")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2012-03-12 20:18:37 +00:00
|
|
|
check_include_file(unistd.h HAVE_UNISTD_H)
|
2010-12-25 23:44:02 +00:00
|
|
|
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
2012-03-12 20:18:37 +00:00
|
|
|
check_include_file(windows.h HAVE_WINDOWS_H)
|
2010-12-25 23:44:02 +00:00
|
|
|
|
2012-11-15 12:56:31 +00:00
|
|
|
if(ENABLE_PROFILE)
|
2012-11-19 12:10:38 +00:00
|
|
|
find_package(GooglePerfTools REQUIRED)
|
|
|
|
set(FG_HAVE_GPERFTOOLS 1)
|
|
|
|
message(STATUS "Built-in profiler using gperftools available")
|
2012-11-15 12:56:31 +00:00
|
|
|
endif()
|
2012-11-15 10:55:25 +00:00
|
|
|
|
2011-09-05 18:25:30 +00:00
|
|
|
if(ENABLE_RTI)
|
2013-02-15 23:03:40 +00:00
|
|
|
message(STATUS "RTI: ENABLED")
|
2011-09-05 18:25:30 +00:00
|
|
|
find_package(RTI)
|
|
|
|
if(RTI_FOUND)
|
|
|
|
set(FG_HAVE_HLA 1)
|
|
|
|
endif(RTI_FOUND)
|
2013-02-15 23:03:40 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "RTI: DISABLED")
|
2011-09-05 18:25:30 +00:00
|
|
|
endif(ENABLE_RTI)
|
2010-12-26 12:55:52 +00:00
|
|
|
|
2010-11-30 10:08:30 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
2012-05-05 07:42:25 +00:00
|
|
|
set(WARNING_FLAGS_CXX "-Wall")
|
|
|
|
set(WARNING_FLAGS_C "-Wall")
|
2010-11-30 10:08:30 +00:00
|
|
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
|
2012-03-25 17:46:50 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
2012-05-05 07:42:25 +00:00
|
|
|
set (WARNING_FLAGS_CXX "-Wall -Wno-overloaded-virtual")
|
|
|
|
set (WARNING_FLAGS_C "-Wall")
|
2012-03-25 17:46:50 +00:00
|
|
|
endif()
|
|
|
|
|
2010-11-30 10:08:30 +00:00
|
|
|
if(WIN32)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
# turn off various warnings
|
|
|
|
# foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
|
|
|
|
# SET(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
|
|
|
|
# endforeach(warning)
|
2012-03-12 20:18:37 +00:00
|
|
|
|
2013-03-07 07:00:47 +00:00
|
|
|
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")
|
2012-09-03 15:34:01 +00:00
|
|
|
if (${MSVC_VERSION} GREATER 1599)
|
2012-03-12 20:18:37 +00:00
|
|
|
set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" )
|
2012-09-03 15:34:01 +00:00
|
|
|
endif (${MSVC_VERSION} GREATER 1599)
|
2010-11-30 10:08:30 +00:00
|
|
|
endif(MSVC)
|
|
|
|
|
|
|
|
set(NOMINMAX 1)
|
2012-03-12 20:18:37 +00:00
|
|
|
endif(WIN32)
|
2010-11-30 10:08:30 +00:00
|
|
|
|
2012-05-12 15:20:28 +00:00
|
|
|
set (BOOST_CXX_FLAGS "-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_BIMAP_DISABLE_SERIALIZATION")
|
|
|
|
|
2012-05-05 07:42:25 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS} -D_REENTRANT")
|
2012-05-12 15:20:28 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} -D_REENTRANT ${BOOST_CXX_FLAGS}")
|
2011-01-28 14:15:20 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}")
|
2010-11-30 10:08:30 +00:00
|
|
|
|
2010-12-26 12:55:52 +00:00
|
|
|
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
|
2012-03-12 20:18:37 +00:00
|
|
|
${Boost_INCLUDE_DIRS}
|
|
|
|
${ZLIB_INCLUDE_DIR}
|
|
|
|
${OPENGL_INCLUDE_DIR}
|
|
|
|
${OPENAL_INCLUDE_DIR}
|
|
|
|
${SIMGEAR_INCLUDE_DIR}
|
2013-09-25 12:54:16 +00:00
|
|
|
${PLIB_INCLUDE_DIR}
|
|
|
|
${SQLITE3_INCLUDED_DIR} )
|
2010-11-30 10:08:30 +00:00
|
|
|
|
2013-05-19 14:29:49 +00:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR})
|
2010-11-30 10:08:30 +00:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src)
|
2013-09-27 14:05:45 +00:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib ) # for iaxclient.h
|
2011-01-01 21:46:16 +00:00
|
|
|
# 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)
|
2010-11-30 10:08:30 +00:00
|
|
|
include_directories(${PROJECT_BINARY_DIR}/src/Include)
|
|
|
|
|
|
|
|
add_definitions(-DHAVE_CONFIG_H)
|
|
|
|
|
2011-06-02 22:01:17 +00:00
|
|
|
check_function_exists(mkfifo HAVE_MKFIFO)
|
|
|
|
|
2010-11-30 10:08:30 +00:00
|
|
|
# configure a header file to pass some of the CMake settings
|
|
|
|
# to the source code
|
|
|
|
configure_file (
|
2012-03-12 20:18:37 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/src/Include/config_cmake.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/src/Include/config.h"
|
|
|
|
)
|
2011-01-01 18:24:53 +00:00
|
|
|
|
|
|
|
#and the same for the version header
|
|
|
|
configure_file (
|
2012-03-12 20:18:37 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/src/Include/version.h.cmake-in"
|
|
|
|
"${PROJECT_BINARY_DIR}/src/Include/version.h"
|
|
|
|
)
|
2011-01-01 18:24:53 +00:00
|
|
|
|
2013-09-25 12:54:16 +00:00
|
|
|
add_subdirectory(3rdparty)
|
2010-11-30 10:08:30 +00:00
|
|
|
add_subdirectory(utils)
|
2013-05-19 14:29:49 +00:00
|
|
|
add_subdirectory(src)
|
2011-11-04 09:38:07 +00:00
|
|
|
add_subdirectory(man)
|
2010-12-28 13:43:14 +00:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
### uninstall target
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
CONFIGURE_FILE(
|
2012-03-12 20:18:37 +00:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
2010-12-28 13:43:14 +00:00
|
|
|
ADD_CUSTOM_TARGET(uninstall
|
2012-03-12 20:18:37 +00:00
|
|
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|