Merge branch 'next' of gitorious.org:fg/flightgear into next
This commit is contained in:
commit
3f6285965c
7 changed files with 159 additions and 76 deletions
|
@ -8,7 +8,9 @@ include (CPack)
|
|||
|
||||
project(FlightGear)
|
||||
|
||||
file(READ version FLIGHTGEAR_VERSION)
|
||||
# read 'version' file into a variable (stripping any newlines or spaces)
|
||||
file(READ version versionFile)
|
||||
string(STRIP ${versionFile} FLIGHTGEAR_VERSION)
|
||||
|
||||
#packaging
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
|
||||
|
@ -20,6 +22,25 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
|||
# autoconf compatibility
|
||||
set(PKGLIBDIR "foo")
|
||||
|
||||
if($ENV{BUILD_ID})
|
||||
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}")
|
||||
else()
|
||||
set(HUDSON_BUILD_NUMBER 0)
|
||||
set(HUDSON_BUILD_ID "none")
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
if (GIT_FOUND)
|
||||
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}")
|
||||
else()
|
||||
set(REVISION "none")
|
||||
endif()
|
||||
|
||||
option(LOGGING "Set to OFF to build FlightGear without logging" ON)
|
||||
|
||||
option(SP_FDMS "Set to ON to build FlightGear with special-purpose FDMs" OFF)
|
||||
|
@ -28,6 +49,7 @@ option(ENABLE_LARCSIM "Set to ON to build FlightGear with LaRCsim FDM" ON)
|
|||
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(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support" OFF)
|
||||
option(MSVC_3RDPARTY_DIR "Location where the third-party dependencies are extracted" NOT_FOUND)
|
||||
|
||||
if(LOGGING)
|
||||
# nothing
|
||||
|
@ -52,6 +74,17 @@ else(EVENT_INPUT)
|
|||
set(ENABLE_PLIB_JOYSTICK 1)
|
||||
endif(EVENT_INPUT)
|
||||
|
||||
if (MSVC_3RDPARTY_DIR)
|
||||
message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_DIR}")
|
||||
set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/lib ${MSVC_3RDPARTY_DIR}/install/msvc90/OpenScenegraph/lib )
|
||||
set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_DIR}/3rdParty/include ${MSVC_3RDPARTY_DIR}/install/msvc90/OpenScenegraph/include)
|
||||
set (BOOST_ROOT ${MSVC_3RDPARTY_DIR}/boost_1_44_0)
|
||||
set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_DIR}/3rdParty/include)
|
||||
set (ALUT_INCLUDE_DIR ${MSVC_3RDPARTY_DIR}/3rdParty/include)
|
||||
set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_DIR}/3rdParty/lib)
|
||||
endif (MSVC_3RDPARTY_DIR)
|
||||
|
||||
|
||||
# check required dependencies
|
||||
if (MSVC)
|
||||
# on MSVC, Olaf reports that the serialization library is required at
|
||||
|
@ -70,6 +103,7 @@ find_package(OpenGL REQUIRED)
|
|||
find_package(OpenAL REQUIRED)
|
||||
find_package(ALUT REQUIRED)
|
||||
find_package(OpenSceneGraph 2.8.2 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
|
||||
|
||||
find_package(PLIB REQUIRED puaux pu js fnt)
|
||||
find_package(SimGear 2.0.0 REQUIRED)
|
||||
|
||||
|
@ -146,6 +180,10 @@ include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
|
|||
${PLIB_INCLUDE_DIR} )
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# 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)
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
@ -156,7 +194,13 @@ configure_file (
|
|||
"${PROJECT_SOURCE_DIR}/src/Include/config_cmake.h.in"
|
||||
"${PROJECT_BINARY_DIR}/src/Include/config.h"
|
||||
)
|
||||
|
||||
|
||||
#and the same for the version header
|
||||
configure_file (
|
||||
"${PROJECT_SOURCE_DIR}/src/Include/version.h.cmake-in"
|
||||
"${PROJECT_BINARY_DIR}/src/Include/version.h"
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(utils)
|
||||
|
||||
|
|
|
@ -67,76 +67,92 @@ FIND_LIBRARY(PLIB_LIBRARIES
|
|||
/Library/Frameworks
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
set (PUNAME "pui")
|
||||
else (MSVC)
|
||||
set (PUNAME "pu")
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
macro(find_static_component comp libs)
|
||||
set(compLib "plib${comp}")
|
||||
string(TOUPPER "PLIB_${comp}_LIBRARY" compLibName)
|
||||
|
||||
FIND_LIBRARY(${compLibName}
|
||||
NAMES ${compLib}
|
||||
HINTS $ENV{PLIBDIR}
|
||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||
PATHS
|
||||
/usr/local
|
||||
/usr
|
||||
/opt
|
||||
)
|
||||
|
||||
set(componentLib ${${compLibName}})
|
||||
if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND")
|
||||
#message(STATUS "found ${componentLib}")
|
||||
list(APPEND ${libs} ${componentLib})
|
||||
#set(PLIB_LIBRARIES "${PLIB_LIBRARIES} ${componentLib}" PARENT_SCOPE)
|
||||
endif()
|
||||
# account for alternative Windows PLIB distribution naming
|
||||
if(MSVC)
|
||||
set(compLib "${comp}")
|
||||
else(MSVC)
|
||||
set(compLib "plib${comp}")
|
||||
endif(MSVC)
|
||||
|
||||
string(TOUPPER "PLIB_${comp}_LIBRARY" compLibName)
|
||||
|
||||
FIND_LIBRARY(${compLibName}
|
||||
NAMES ${compLib}
|
||||
HINTS $ENV{PLIBDIR}
|
||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||
PATHS
|
||||
/usr/local
|
||||
/usr
|
||||
/opt
|
||||
)
|
||||
|
||||
set(componentLib ${${compLibName}})
|
||||
if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND")
|
||||
list(APPEND ${libs} ${componentLib})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(${PLIB_LIBRARIES} STREQUAL "PLIB_LIBRARIES-NOTFOUND")
|
||||
set(PLIB_LIBRARIES "") # clear value
|
||||
|
||||
if(${PLIB_LIBRARIES} STREQUAL "PLIB_LIBRARIES-NOTFOUND")
|
||||
set(PLIB_LIBRARIES "") # clear value
|
||||
|
||||
# based on the contents of deps, add other required PLIB
|
||||
# static library dependencies. Eg PUI requires SSG and FNT
|
||||
set(outDeps ${PLIB_FIND_COMPONENTS})
|
||||
|
||||
foreach(c ${PLIB_FIND_COMPONENTS})
|
||||
if (${c} STREQUAL "pu")
|
||||
list(APPEND outDeps "fnt" "ssg" "sg")
|
||||
elseif (${c} STREQUAL "puaux")
|
||||
list(APPEND outDeps "pu" "fnt" "ssg" "sg")
|
||||
elseif (${c} STREQUAL "ssg")
|
||||
list(APPEND outDeps "sg")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND outDeps "ul") # everything needs ul
|
||||
list(REMOVE_DUPLICATES outDeps) # clean up
|
||||
|
||||
# look for traditional static libraries
|
||||
foreach(component ${outDeps})
|
||||
find_static_component(${component} PLIB_LIBRARIES)
|
||||
endforeach()
|
||||
set(outDeps ${PLIB_FIND_COMPONENTS})
|
||||
|
||||
foreach(c ${PLIB_FIND_COMPONENTS})
|
||||
if (${c} STREQUAL "pu")
|
||||
# handle MSVC confusion over pu/pui naming, by removing
|
||||
# 'pu' and then adding it back
|
||||
list(REMOVE_ITEM outDeps "pu")
|
||||
list(APPEND outDeps ${PUNAME} "fnt" "ssg" "sg")
|
||||
elseif (${c} STREQUAL "puaux")
|
||||
list(APPEND outDeps ${PUNAME} "fnt" "ssg" "sg")
|
||||
elseif (${c} STREQUAL "ssg")
|
||||
list(APPEND outDeps "sg")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND outDeps "ul") # everything needs ul
|
||||
list(REMOVE_DUPLICATES outDeps) # clean up
|
||||
|
||||
|
||||
|
||||
# look for traditional static libraries
|
||||
foreach(component ${outDeps})
|
||||
find_static_component(${component} PLIB_LIBRARIES)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
list(FIND outDeps "js" haveJs)
|
||||
if(${haveJs} GREATER -1)
|
||||
message(STATUS "adding runtime JS dependencies")
|
||||
if(APPLE)
|
||||
# resolve frameworks to full paths
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(CF_LIBRARY CoreFoundation)
|
||||
set(JS_LIBS ${IOKIT_LIBRARY} ${CF_LIBRARY})
|
||||
elseif(WIN32)
|
||||
find_library(WINMM_LIBRARY winmm)
|
||||
set(JS_LIBS ${WINMM_LIBRARY})
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# anything needed here?
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
find_library(USBHID_LIBRARY usbhid)
|
||||
# check_function_exists(hidinit)
|
||||
set(JS_LIBS ${USBHID_LIBRARY})
|
||||
else()
|
||||
message(WARNING "Unsupported platform for PLIB JS libs")
|
||||
endif()
|
||||
|
||||
list(APPEND PLIB_LIBRARIES ${JS_LIBS})
|
||||
message(STATUS "adding runtime JS dependencies")
|
||||
if(APPLE)
|
||||
# resolve frameworks to full paths
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(CF_LIBRARY CoreFoundation)
|
||||
set(JS_LIBS ${IOKIT_LIBRARY} ${CF_LIBRARY})
|
||||
elseif(WIN32)
|
||||
find_library(WINMM_LIBRARY winmm)
|
||||
set(JS_LIBS ${WINMM_LIBRARY})
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# anything needed here?
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
find_library(USBHID_LIBRARY usbhid)
|
||||
# check_function_exists(hidinit)
|
||||
set(JS_LIBS ${USBHID_LIBRARY})
|
||||
else()
|
||||
message(WARNING "Unsupported platform for PLIB JS libs")
|
||||
endif()
|
||||
|
||||
list(APPEND PLIB_LIBRARIES ${JS_LIBS})
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
|
|
@ -143,6 +143,8 @@ FGJSBsim::FGJSBsim( double dt )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
resetPropertyState();
|
||||
|
||||
fdmex = new FGFDMExec( (FGPropertyManager*)globals->get_props() );
|
||||
|
||||
|
@ -298,13 +300,6 @@ FGJSBsim::FGJSBsim( double dt )
|
|||
FGJSBsim::~FGJSBsim(void)
|
||||
{
|
||||
delete fdmex;
|
||||
|
||||
SGPropertyNode_ptr jsbsimRoot = fgGetNode("/fdm/jsbsim");
|
||||
if (jsbsimRoot) {
|
||||
SGPropertyNode* fdm = jsbsimRoot->getParent();
|
||||
fdm->removeChild("jsbsim", 0, false);
|
||||
}
|
||||
// properties are deleted when the sharedPtr above goes away
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -1418,3 +1413,22 @@ void FGJSBsim::update_external_forces(double t_off)
|
|||
fgSetDouble("/fdm/jsbsim/systems/hook/tailhook-pos-deg", fi);
|
||||
}
|
||||
|
||||
|
||||
void FGJSBsim::resetPropertyState()
|
||||
{
|
||||
// this code works-around bug #222:
|
||||
// http://code.google.com/p/flightgear-bugs/issues/detail?id=222
|
||||
// for whatever reason, having an existing value for the WOW
|
||||
// property causes the NaNs. Should that be fixed, this code can die
|
||||
SGPropertyNode* gear = fgGetNode("/fdm/jsbsim/gear", false);
|
||||
if (!gear) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
SGPropertyNode* unitNode = NULL;
|
||||
for (; (unitNode = gear->getChild("unit", index)) != NULL; ++index) {
|
||||
unitNode->removeChild("WOW", 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -284,6 +284,7 @@ private:
|
|||
|
||||
void update_external_forces(double t_off);
|
||||
|
||||
void resetPropertyState();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -307,23 +307,18 @@ bool FGPropulsion::Load(Element* el)
|
|||
try {
|
||||
if (type == "piston_engine") {
|
||||
HavePistonEngine = true;
|
||||
if (!IsBound) bind();
|
||||
Engines.push_back(new FGPiston(FDMExec, document, numEngines));
|
||||
} else if (type == "turbine_engine") {
|
||||
HaveTurbineEngine = true;
|
||||
if (!IsBound) bind();
|
||||
Engines.push_back(new FGTurbine(FDMExec, document, numEngines));
|
||||
} else if (type == "turboprop_engine") {
|
||||
HaveTurboPropEngine = true;
|
||||
if (!IsBound) bind();
|
||||
Engines.push_back(new FGTurboProp(FDMExec, document, numEngines));
|
||||
} else if (type == "rocket_engine") {
|
||||
HaveRocketEngine = true;
|
||||
if (!IsBound) bind();
|
||||
Engines.push_back(new FGRocket(FDMExec, document, numEngines));
|
||||
} else if (type == "electric_engine") {
|
||||
HaveElectricEngine = true;
|
||||
if (!IsBound) bind();
|
||||
Engines.push_back(new FGElectric(FDMExec, document, numEngines));
|
||||
} else {
|
||||
cerr << "Unknown engine type: " << type << endl;
|
||||
|
@ -350,6 +345,7 @@ bool FGPropulsion::Load(Element* el)
|
|||
if (el->FindElement("dump-rate"))
|
||||
DumpRate = el->FindElementValueAsNumberConvertTo("dump-rate", "LBS/MIN");
|
||||
|
||||
if (!IsBound) bind();
|
||||
PostLoad(el, PropertyManager);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#cmakedefine HAVE_SYS_TIME_H
|
||||
#cmakedefine HAVE_CULLSETTINGS_CLEAR_MASK
|
||||
|
||||
#define VERSION "@FLIGHTGEAR_VERSION"
|
||||
#define VERSION "@FLIGHTGEAR_VERSION@"
|
||||
|
||||
#define HAVE_VERSION_H 1 // version.h is assumed for CMake builds
|
||||
|
||||
#cmakedefine ENABLE_UIUC_MODEL
|
||||
#cmakedefine ENABLE_LARCSIM
|
||||
|
|
10
src/Include/version.h.cmake-in
Normal file
10
src/Include/version.h.cmake-in
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
#define FLIGHTGEAR_VERSION "@FLIGHTGEAR_VERSION@"
|
||||
|
||||
#define HUDSON_BUILD_NUMBER @HUDSON_BUILD_NUMBER@
|
||||
#define HUDSON_BUILD_ID "@HUDSON_BUILD_ID@"
|
||||
#define REVISION "@REVISION@"
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue