1
0
Fork 0

CMake: Windows PLIB fixes from Olaf Flebbe.

This commit is contained in:
James Turner 2011-01-01 21:22:37 +00:00
parent 4d1d215ded
commit 61c88af564
2 changed files with 90 additions and 61 deletions

View file

@ -47,6 +47,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
@ -71,6 +72,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
@ -89,6 +101,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)

View file

@ -67,8 +67,21 @@ FIND_LIBRARY(PLIB_LIBRARIES
/Library/Frameworks
)
if (MSVC)
set (PUNAME "pui")
else (MSVC)
set (PUNAME "pu")
endif (MSVC)
macro(find_static_component comp libs)
# 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}
@ -83,9 +96,7 @@ macro(find_static_component comp libs)
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()
endmacro()
@ -98,9 +109,12 @@ if(${PLIB_LIBRARIES} STREQUAL "PLIB_LIBRARIES-NOTFOUND")
foreach(c ${PLIB_FIND_COMPONENTS})
if (${c} STREQUAL "pu")
list(APPEND outDeps "fnt" "ssg" "sg")
# 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 "pu" "fnt" "ssg" "sg")
list(APPEND outDeps ${PUNAME} "fnt" "ssg" "sg")
elseif (${c} STREQUAL "ssg")
list(APPEND outDeps "sg")
endif()
@ -109,6 +123,8 @@ if(${PLIB_LIBRARIES} STREQUAL "PLIB_LIBRARIES-NOTFOUND")
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)