2013-02-21 19:06:29 +08:00
|
|
|
cmake_minimum_required (VERSION 2.6.4)
|
|
|
|
|
|
|
|
include (ExternalProject)
|
|
|
|
|
|
|
|
project(FlightGear-Meta)
|
|
|
|
|
2013-10-22 05:19:45 +08:00
|
|
|
if(NOT CMAKE_INSTALL_PREFIX)
|
2013-11-14 00:34:29 +08:00
|
|
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
|
2013-10-22 05:19:45 +08:00
|
|
|
message(STATUS "Default install dir to ${CMAKE_INSTALL_PREFIX}")
|
|
|
|
endif()
|
|
|
|
|
2013-02-21 19:06:29 +08:00
|
|
|
if (UNIX)
|
|
|
|
set(BOOST_BOOTSTRAP "./bootstrap.sh" --prefix=${CMAKE_INSTALL_PREFIX})
|
|
|
|
else()
|
|
|
|
set(BOOST_BOOTSTRAP "bootstrap.bat")
|
|
|
|
endif()
|
|
|
|
|
2013-03-02 01:55:55 +08:00
|
|
|
set(SG_DEPS OSG)
|
|
|
|
set(FG_DEPS SimGear)
|
2013-10-22 05:19:45 +08:00
|
|
|
set(SG_CMAKE_ARGS "")
|
|
|
|
set(FG_CMAKE_ARGS "")
|
2013-11-15 04:15:31 +08:00
|
|
|
set(FGRUN_CMAKE_ARGS "")
|
2013-03-02 01:55:55 +08:00
|
|
|
|
2013-03-02 00:26:38 +08:00
|
|
|
if(APPLE)
|
2013-02-21 19:06:29 +08:00
|
|
|
set(BOOST_ARGS link=static stage --with-system)
|
|
|
|
ExternalProject_Add(Boost
|
2013-11-14 00:34:29 +08:00
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
|
|
|
SVN_REPOSITORY http://svn.boost.org/svn/boost/tags/release/Boost_1_52_0
|
|
|
|
UPDATE_COMMAND ${BOOST_BOOTSTRAP}
|
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_COMMAND ./bjam ${BOOST_ARGS}
|
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
INSTALL_COMMAND ./b2 install ${BOOST_ARGS})
|
2013-10-22 05:19:45 +08:00
|
|
|
|
|
|
|
list(APPEND SG_DEPS Boost)
|
2013-03-02 00:26:38 +08:00
|
|
|
endif() # of Apple
|
|
|
|
|
2013-11-14 00:34:29 +08:00
|
|
|
set(OSG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
2013-11-14 06:21:18 +08:00
|
|
|
set(SG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(FG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
2013-11-19 05:24:31 +08:00
|
|
|
set(PLIB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(RTI_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
2013-11-15 03:57:54 +08:00
|
|
|
set(FGRUN_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
2013-02-21 19:06:29 +08:00
|
|
|
|
2013-03-02 01:55:55 +08:00
|
|
|
# OpenSceneGraph configuration
|
2013-11-19 05:24:31 +08:00
|
|
|
set(OSG_SOURCE http://www.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.2.0.zip)
|
2013-09-16 05:04:58 +08:00
|
|
|
|
2013-02-21 19:06:29 +08:00
|
|
|
if (APPLE)
|
2013-11-14 00:34:29 +08:00
|
|
|
set(SDKROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk)
|
2013-02-21 22:21:26 +08:00
|
|
|
# force disable Qt and Jasper, and ensure an SDKROOT is set, or
|
|
|
|
# osgViewer system detection goes wrongh
|
2013-11-14 00:34:29 +08:00
|
|
|
set(OSG_CMAKE_ARGS -DCMAKE_OSX_SYSROOT=${SDKROOT}
|
2013-02-25 05:14:08 +08:00
|
|
|
-DOSG_USE_QT=0
|
|
|
|
-DJASPER_LIBRARY=
|
2013-03-02 01:55:55 +08:00
|
|
|
-DSDL_LIBRARY:FILEPATH=
|
2013-02-25 05:14:08 +08:00
|
|
|
-DCMAKE_OSX_ARCHITECTURES=x86_64
|
|
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.7
|
|
|
|
)
|
2013-02-21 19:06:29 +08:00
|
|
|
# OSG with some patches applied for Mac
|
2013-11-14 00:34:29 +08:00
|
|
|
# set(OSG_SOURCE GIT_REPOSITORY git://gitorious.org/+flightgear-developers/openscenegraph/mac-release-osg.git)
|
|
|
|
# set(OSG_SOURCE URL http://www.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.2.0.zip)
|
2013-02-21 22:21:26 +08:00
|
|
|
|
2013-03-02 00:26:38 +08:00
|
|
|
elseif(MSVC)
|
2013-11-14 00:34:29 +08:00
|
|
|
set(OSG_MSVC "msvc")
|
2013-03-02 01:55:55 +08:00
|
|
|
if (${MSVC_VERSION} EQUAL 1700)
|
2013-11-14 00:34:29 +08:00
|
|
|
set(OSG_MSVC ${OSG_MSVC}110)
|
2013-03-02 01:55:55 +08:00
|
|
|
elseif (${MSVC_VERSION} EQUAL 1600)
|
2013-11-14 00:34:29 +08:00
|
|
|
set(OSG_MSVC ${OSG_MSVC}100)
|
2013-03-02 01:55:55 +08:00
|
|
|
else (${MSVC_VERSION} EQUAL 1700)
|
2013-11-14 00:34:29 +08:00
|
|
|
set(OSG_MSVC ${OSG_MSVC}90)
|
2013-03-02 01:55:55 +08:00
|
|
|
endif (${MSVC_VERSION} EQUAL 1700)
|
2013-11-14 00:34:29 +08:00
|
|
|
if (CMAKE_CL_64)
|
|
|
|
set(OSG_MSVC ${OSG_MSVC}-64)
|
2013-11-14 09:35:33 +08:00
|
|
|
set(RDPARTY_DIR 3rdParty.x64)
|
2013-11-16 03:58:05 +08:00
|
|
|
list(APPEND FG_CMAKE_ARGS -DWITH_FGPANEL=OFF)
|
2013-11-14 00:45:48 +08:00
|
|
|
else ()
|
2013-11-14 09:35:33 +08:00
|
|
|
set(RDPARTY_DIR 3rdParty)
|
2013-11-14 00:34:29 +08:00
|
|
|
endif (CMAKE_CL_64)
|
2013-03-02 00:26:38 +08:00
|
|
|
|
2013-11-14 00:34:29 +08:00
|
|
|
SET(OSG_CMAKE_ARGS
|
|
|
|
-DBUILD_OSG_APPLICATIONS:BOOL=ON
|
|
|
|
-DOSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS:BOOL=OFF
|
2014-05-12 16:12:24 +08:00
|
|
|
-DACTUAL_3RDPARTY_DIR:PATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}
|
2014-05-12 18:27:06 +08:00
|
|
|
-DCURL_INCLUDE_DIR:PATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/include
|
|
|
|
-DTIFF_INCLUDE_DIR:PATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/include
|
|
|
|
-DGDAL_INCLUDE_DIR:PATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/include
|
|
|
|
-DGDAL_LIBRARY:FILEPATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/lib/gdal_i.lib
|
|
|
|
-DTIFF_LIBRARY:FILEPATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/lib/libtiff.lib
|
|
|
|
-DCURL_LIBRARY:FILEPATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/lib/libcurl_imp.lib
|
|
|
|
-DFREETYPE_LIBRARY:FILEPATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/lib/freetype.lib
|
2014-05-12 18:35:06 +08:00
|
|
|
-DFREETYPE_INCLUDE_DIR:PATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/include;${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/include/freetype
|
2013-03-02 00:26:38 +08:00
|
|
|
)
|
2013-11-14 00:34:29 +08:00
|
|
|
|
|
|
|
# for compatability with MSVC directory layout
|
|
|
|
set(OSG_INSTALL_PREFIX ${OSG_INSTALL_PREFIX}/${OSG_MSVC}/OpenSceneGraph)
|
2013-11-15 03:57:54 +08:00
|
|
|
set(FGRUN_INSTALL_PREFIX ${FGRUN_INSTALL_PREFIX}/${OSG_MSVC}/FGRun)
|
2013-11-14 06:21:18 +08:00
|
|
|
set(FG_INSTALL_PREFIX ${FG_INSTALL_PREFIX}/${OSG_MSVC}/FlightGear)
|
|
|
|
set(SG_INSTALL_PREFIX ${SG_INSTALL_PREFIX}/${OSG_MSVC}/SimGear)
|
2013-03-02 01:55:55 +08:00
|
|
|
list(APPEND OSG_DEPS WinDeps)
|
2013-02-21 19:06:29 +08:00
|
|
|
else()
|
|
|
|
# normal OSG
|
|
|
|
endif()
|
|
|
|
|
2013-03-02 00:26:38 +08:00
|
|
|
if (MSVC)
|
2013-11-14 00:34:29 +08:00
|
|
|
# download 3rdparty dependencies zip, including boost
|
|
|
|
ExternalProject_Add(WinDeps
|
2013-11-30 23:25:12 +08:00
|
|
|
SVN_REPOSITORY http://fgfs.goneabitbursar.com/fgwin3rdparty/trunk/msvc100/${RDPARTY_DIR}
|
2013-11-14 00:34:29 +08:00
|
|
|
# extract to current root
|
2013-11-16 07:07:57 +08:00
|
|
|
SOURCE_DIR ${CMAKE_BINARY_DIR}/winDeps/${RDPARTY_DIR}
|
|
|
|
BINARY_DIR ${CMAKE_BINARY_DIR}
|
|
|
|
UPDATE_COMMAND ""
|
2013-11-14 00:34:29 +08:00
|
|
|
CONFIGURE_COMMAND ""
|
|
|
|
BUILD_COMMAND ${CMAKE_SOURCE_DIR}/installWinDeps.bat
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
)
|
|
|
|
|
2013-11-16 07:07:57 +08:00
|
|
|
set(BOOST_ARGS link=static stage --with-system)
|
2013-11-16 07:40:02 +08:00
|
|
|
set(Boost_Version 1.54.0)
|
|
|
|
string(REPLACE "." "_" Boost_Version_Underscore ${Boost_Version})
|
2013-11-14 00:34:29 +08:00
|
|
|
ExternalProject_Add(Boost
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
2013-11-16 07:40:02 +08:00
|
|
|
URL http://downloads.sourceforge.net/project/boost/boost/${Boost_Version}/boost_${Boost_Version_Underscore}.zip
|
|
|
|
URL_MD5 78a35834c45220a6164310e280abe675
|
2013-12-03 05:55:59 +08:00
|
|
|
UPDATE_COMMAND ""
|
|
|
|
CONFIGURE_COMMAND ${BOOST_BOOTSTRAP}
|
2013-11-14 00:34:29 +08:00
|
|
|
BUILD_COMMAND bjam --with-program_options ${BOOST_ARGS}
|
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
INSTALL_COMMAND ""
|
|
|
|
)
|
2013-11-16 07:07:57 +08:00
|
|
|
|
2013-11-14 00:34:29 +08:00
|
|
|
list(APPEND SG_DEPS Boost)
|
|
|
|
list(APPEND SG_CMAKE_ARGS -DBOOST_ROOT=${CMAKE_BINARY_DIR}/src/Boost)
|
|
|
|
list(APPEND FG_CMAKE_ARGS -DBOOST_ROOT=${CMAKE_BINARY_DIR}/src/Boost)
|
2013-11-15 04:15:31 +08:00
|
|
|
list(APPEND FGRUN_CMAKE_ARGS -DBOOST_ROOT=${CMAKE_BINARY_DIR}/src/Boost)
|
2013-03-02 01:55:55 +08:00
|
|
|
endif(MSVC) # of Windows
|
2013-02-21 19:06:29 +08:00
|
|
|
|
|
|
|
ExternalProject_Add(OSG
|
2013-11-14 00:34:29 +08:00
|
|
|
DEPENDS ${OSG_DEPS}
|
2013-02-21 19:06:29 +08:00
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
2013-11-19 05:24:31 +08:00
|
|
|
URL ${OSG_SOURCE}
|
2013-11-14 00:34:29 +08:00
|
|
|
URL_HASH MD5=4980f8692712a24d4c99f363f80c6814
|
2013-02-21 19:06:29 +08:00
|
|
|
BINARY_DIR osgbuild
|
2013-03-02 00:26:38 +08:00
|
|
|
CMAKE_ARGS ${OSG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${OSG_INSTALL_PREFIX}
|
2013-03-02 01:55:55 +08:00
|
|
|
)
|
2013-02-21 19:06:29 +08:00
|
|
|
|
2013-11-19 05:24:31 +08:00
|
|
|
# Because OSG install the libraries in lib64/ instead of lib/
|
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
ExternalProject_Add_Step(OSG after_install
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${OSG_INSTALL_PREFIX}/lib64 ${OSG_INSTALL_PREFIX}/lib
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${OSG_INSTALL_PREFIX}/lib64
|
|
|
|
DEPENDEES install
|
|
|
|
)
|
|
|
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
|
|
|
2013-03-02 01:55:55 +08:00
|
|
|
# FIXME install of OpenRTI is failing on Windows, files in PREFIX/share which
|
|
|
|
# are ending up in C:/Program Files/OpenRTI
|
|
|
|
if (NOT MSVC)
|
|
|
|
ExternalProject_Add(OpenRTI
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
|
|
|
DOWNLOAD_COMMAND GIT_REPOSITORY git://gitorious.org/openrti/openrti.git
|
|
|
|
BINARY_DIR rtibuild
|
2013-11-19 05:24:31 +08:00
|
|
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${RTI_INSTALL_PREFIX}
|
2013-02-21 22:21:26 +08:00
|
|
|
)
|
2013-03-02 00:26:38 +08:00
|
|
|
|
2013-11-14 00:34:29 +08:00
|
|
|
list(APPEND SG_DEPS OpenRTI)
|
|
|
|
list(APPEND SG_CMAKE_ARGS -DENABLE_RTI=1)
|
|
|
|
list(APPEND FG_CMAKE_ARGS -DENABLE_RTI=1)
|
2013-03-02 00:26:38 +08:00
|
|
|
endif()
|
|
|
|
|
2013-02-21 19:06:29 +08:00
|
|
|
ExternalProject_Add(SimGear
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
2013-03-02 01:55:55 +08:00
|
|
|
DEPENDS ${SG_DEPS}
|
2013-11-14 00:34:29 +08:00
|
|
|
DOWNLOAD_COMMAND "" # no need to download
|
|
|
|
UPDATE_COMMAND "" # or update.
|
2013-02-21 19:06:29 +08:00
|
|
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/simgear
|
|
|
|
BINARY_DIR sgbuild
|
2013-11-14 06:21:18 +08:00
|
|
|
CMAKE_ARGS ${SG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${SG_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${OSG_INSTALL_PREFIX}
|
2013-11-14 00:34:29 +08:00
|
|
|
)
|
2013-02-21 19:06:29 +08:00
|
|
|
|
2013-12-03 05:55:59 +08:00
|
|
|
# because we download SimGear externally (via Git submodules),
|
|
|
|
# the change-detection doesn't work. Ensure we always change
|
|
|
|
# for changes
|
|
|
|
ExternalProject_Add_Step(SimGear forcebuild
|
|
|
|
ALWAYS 1
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo foo
|
|
|
|
DEPENDERS build
|
|
|
|
)
|
|
|
|
|
2013-10-22 05:19:45 +08:00
|
|
|
# on Windows, PLIB is in the 3rd-party dependencies zip
|
2013-03-02 00:26:38 +08:00
|
|
|
if (NOT WIN32)
|
2013-11-19 05:24:31 +08:00
|
|
|
set(PLIB_ARGS --disable-pw --disable-sl --disable-psl --disable-ssg --disable-ssgaux)
|
2013-11-14 00:34:29 +08:00
|
|
|
|
|
|
|
ExternalProject_Add(PLIB
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
|
|
|
URL http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz
|
|
|
|
URL_HASH MD5=47a6fbf63668c1eed631024038b2ea90
|
2013-11-19 05:24:31 +08:00
|
|
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${PLIB_INSTALL_PREFIX} ${PLIB_ARGS}
|
2013-11-14 00:34:29 +08:00
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
)
|
2013-03-02 01:55:55 +08:00
|
|
|
|
|
|
|
list(APPEND FG_DEPS PLIB)
|
2013-03-02 00:26:38 +08:00
|
|
|
endif()
|
2013-02-21 19:06:29 +08:00
|
|
|
|
2013-11-15 03:57:54 +08:00
|
|
|
# Only compile FGRun for Windows
|
|
|
|
if (MSVC)
|
2013-11-15 04:28:10 +08:00
|
|
|
list(APPEND FGRUN_CMAKE_ARGS -DMSVC_3RDPARTY_ROOT:PATH=${CMAKE_BINARY_DIR})
|
|
|
|
list(APPEND FGRUN_CMAKE_ARGS -DFLTK_FLUID_EXECUTABLE:FILEPATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/bin/fluid.exe)
|
|
|
|
list(APPEND FGRUN_CMAKE_ARGS -DGETTEXT_MSGFMT_EXECUTABLE:FILEPATH==${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/bin/msgfmt.exe)
|
|
|
|
list(APPEND FGRUN_CMAKE_ARGS -DGETTEXT_MSGMERGE_EXECUTABLE:FILEPATH=${CMAKE_BINARY_DIR}/${RDPARTY_DIR}/bin/msgmerge.exe)
|
2013-11-15 03:57:54 +08:00
|
|
|
ExternalProject_Add(FGRun
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
|
|
|
DEPENDS ${FG_DEPS}
|
|
|
|
DOWNLOAD_COMMAND "" # no need to download
|
|
|
|
UPDATE_COMMAND "" # or update.
|
|
|
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/fgrun
|
|
|
|
BINARY_DIR fgrunbuild
|
2013-11-15 04:15:31 +08:00
|
|
|
CMAKE_ARGS ${FGRUN_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${FGRUN_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${OSG_INSTALL_PREFIX} -DADDITIONAL_LIBRARY_PATHS=${SG_INSTALL_PREFIX}
|
2013-11-15 03:57:54 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2013-02-21 19:06:29 +08:00
|
|
|
ExternalProject_Add(FlightGear
|
|
|
|
PREFIX ${CMAKE_BINARY_DIR}
|
2013-03-02 01:55:55 +08:00
|
|
|
DEPENDS ${FG_DEPS}
|
2013-11-14 00:34:29 +08:00
|
|
|
DOWNLOAD_COMMAND "" # no need to download
|
|
|
|
UPDATE_COMMAND "" # or update.
|
2013-02-21 19:06:29 +08:00
|
|
|
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/flightgear
|
|
|
|
BINARY_DIR fgbuild
|
2013-11-15 03:39:34 +08:00
|
|
|
CMAKE_ARGS ${FG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${FG_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${OSG_INSTALL_PREFIX} -DADDITIONAL_LIBRARY_PATHS=${SG_INSTALL_PREFIX}
|
2013-11-14 00:34:29 +08:00
|
|
|
)
|
2013-12-03 05:55:59 +08:00
|
|
|
|
|
|
|
# because we download FlightGear externally (via Git submodules),
|
|
|
|
# the change-detection doesn't work. Ensure we always change
|
|
|
|
# for changes
|
|
|
|
ExternalProject_Add_Step(FlightGear forcebuild
|
|
|
|
ALWAYS 1
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo foo
|
|
|
|
DEPENDERS build
|
|
|
|
)
|