CMake: Windows PLIB fixes from Olaf Flebbe.
This commit is contained in:
parent
4d1d215ded
commit
61c88af564
2 changed files with 90 additions and 61 deletions
|
@ -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_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_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(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)
|
if(LOGGING)
|
||||||
# nothing
|
# nothing
|
||||||
|
@ -71,6 +72,17 @@ else(EVENT_INPUT)
|
||||||
set(ENABLE_PLIB_JOYSTICK 1)
|
set(ENABLE_PLIB_JOYSTICK 1)
|
||||||
endif(EVENT_INPUT)
|
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
|
# check required dependencies
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# on MSVC, Olaf reports that the serialization library is required at
|
# 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(OpenAL REQUIRED)
|
||||||
find_package(ALUT REQUIRED)
|
find_package(ALUT REQUIRED)
|
||||||
find_package(OpenSceneGraph 2.8.2 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
|
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(PLIB REQUIRED puaux pu js fnt)
|
||||||
find_package(SimGear 2.0.0 REQUIRED)
|
find_package(SimGear 2.0.0 REQUIRED)
|
||||||
|
|
||||||
|
|
|
@ -67,76 +67,92 @@ FIND_LIBRARY(PLIB_LIBRARIES
|
||||||
/Library/Frameworks
|
/Library/Frameworks
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set (PUNAME "pui")
|
||||||
|
else (MSVC)
|
||||||
|
set (PUNAME "pu")
|
||||||
|
endif (MSVC)
|
||||||
|
|
||||||
|
|
||||||
macro(find_static_component comp libs)
|
macro(find_static_component comp libs)
|
||||||
set(compLib "plib${comp}")
|
# account for alternative Windows PLIB distribution naming
|
||||||
string(TOUPPER "PLIB_${comp}_LIBRARY" compLibName)
|
if(MSVC)
|
||||||
|
set(compLib "${comp}")
|
||||||
FIND_LIBRARY(${compLibName}
|
else(MSVC)
|
||||||
NAMES ${compLib}
|
set(compLib "plib${comp}")
|
||||||
HINTS $ENV{PLIBDIR}
|
endif(MSVC)
|
||||||
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
|
||||||
PATHS
|
string(TOUPPER "PLIB_${comp}_LIBRARY" compLibName)
|
||||||
/usr/local
|
|
||||||
/usr
|
FIND_LIBRARY(${compLibName}
|
||||||
/opt
|
NAMES ${compLib}
|
||||||
)
|
HINTS $ENV{PLIBDIR}
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
set(componentLib ${${compLibName}})
|
PATHS
|
||||||
if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND")
|
/usr/local
|
||||||
#message(STATUS "found ${componentLib}")
|
/usr
|
||||||
list(APPEND ${libs} ${componentLib})
|
/opt
|
||||||
#set(PLIB_LIBRARIES "${PLIB_LIBRARIES} ${componentLib}" PARENT_SCOPE)
|
)
|
||||||
endif()
|
|
||||||
|
set(componentLib ${${compLibName}})
|
||||||
|
if (NOT ${componentLib} STREQUAL "componentLib-NOTFOUND")
|
||||||
|
list(APPEND ${libs} ${componentLib})
|
||||||
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
if(${PLIB_LIBRARIES} STREQUAL "PLIB_LIBRARIES-NOTFOUND")
|
if(${PLIB_LIBRARIES} STREQUAL "PLIB_LIBRARIES-NOTFOUND")
|
||||||
set(PLIB_LIBRARIES "") # clear value
|
set(PLIB_LIBRARIES "") # clear value
|
||||||
|
|
||||||
# based on the contents of deps, add other required PLIB
|
# based on the contents of deps, add other required PLIB
|
||||||
# static library dependencies. Eg PUI requires SSG and FNT
|
# static library dependencies. Eg PUI requires SSG and FNT
|
||||||
set(outDeps ${PLIB_FIND_COMPONENTS})
|
set(outDeps ${PLIB_FIND_COMPONENTS})
|
||||||
|
|
||||||
foreach(c ${PLIB_FIND_COMPONENTS})
|
foreach(c ${PLIB_FIND_COMPONENTS})
|
||||||
if (${c} STREQUAL "pu")
|
if (${c} STREQUAL "pu")
|
||||||
list(APPEND outDeps "fnt" "ssg" "sg")
|
# handle MSVC confusion over pu/pui naming, by removing
|
||||||
elseif (${c} STREQUAL "puaux")
|
# 'pu' and then adding it back
|
||||||
list(APPEND outDeps "pu" "fnt" "ssg" "sg")
|
list(REMOVE_ITEM outDeps "pu")
|
||||||
elseif (${c} STREQUAL "ssg")
|
list(APPEND outDeps ${PUNAME} "fnt" "ssg" "sg")
|
||||||
list(APPEND outDeps "sg")
|
elseif (${c} STREQUAL "puaux")
|
||||||
endif()
|
list(APPEND outDeps ${PUNAME} "fnt" "ssg" "sg")
|
||||||
endforeach()
|
elseif (${c} STREQUAL "ssg")
|
||||||
|
list(APPEND outDeps "sg")
|
||||||
list(APPEND outDeps "ul") # everything needs ul
|
endif()
|
||||||
list(REMOVE_DUPLICATES outDeps) # clean up
|
endforeach()
|
||||||
|
|
||||||
# look for traditional static libraries
|
list(APPEND outDeps "ul") # everything needs ul
|
||||||
foreach(component ${outDeps})
|
list(REMOVE_DUPLICATES outDeps) # clean up
|
||||||
find_static_component(${component} PLIB_LIBRARIES)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
|
# look for traditional static libraries
|
||||||
|
foreach(component ${outDeps})
|
||||||
|
find_static_component(${component} PLIB_LIBRARIES)
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(FIND outDeps "js" haveJs)
|
list(FIND outDeps "js" haveJs)
|
||||||
if(${haveJs} GREATER -1)
|
if(${haveJs} GREATER -1)
|
||||||
message(STATUS "adding runtime JS dependencies")
|
message(STATUS "adding runtime JS dependencies")
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
# resolve frameworks to full paths
|
# resolve frameworks to full paths
|
||||||
find_library(IOKIT_LIBRARY IOKit)
|
find_library(IOKIT_LIBRARY IOKit)
|
||||||
find_library(CF_LIBRARY CoreFoundation)
|
find_library(CF_LIBRARY CoreFoundation)
|
||||||
set(JS_LIBS ${IOKIT_LIBRARY} ${CF_LIBRARY})
|
set(JS_LIBS ${IOKIT_LIBRARY} ${CF_LIBRARY})
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
find_library(WINMM_LIBRARY winmm)
|
find_library(WINMM_LIBRARY winmm)
|
||||||
set(JS_LIBS ${WINMM_LIBRARY})
|
set(JS_LIBS ${WINMM_LIBRARY})
|
||||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
# anything needed here?
|
# anything needed here?
|
||||||
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
find_library(USBHID_LIBRARY usbhid)
|
find_library(USBHID_LIBRARY usbhid)
|
||||||
# check_function_exists(hidinit)
|
# check_function_exists(hidinit)
|
||||||
set(JS_LIBS ${USBHID_LIBRARY})
|
set(JS_LIBS ${USBHID_LIBRARY})
|
||||||
else()
|
else()
|
||||||
message(WARNING "Unsupported platform for PLIB JS libs")
|
message(WARNING "Unsupported platform for PLIB JS libs")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND PLIB_LIBRARIES ${JS_LIBS})
|
list(APPEND PLIB_LIBRARIES ${JS_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
Loading…
Reference in a new issue