From Roland Smeenk and Robert Osfiled, tweaks to the Collada finding/linking to improve support for Collada DOM 2.1 + 2.2 across platforms.

This commit is contained in:
Robert Osfield 2009-02-10 11:44:50 +00:00
parent e15383fd7a
commit 7de8527efd
3 changed files with 142 additions and 29 deletions

View File

@ -301,13 +301,12 @@ FIND_PACKAGE(Inventor)
FIND_PACKAGE(Jasper)
FIND_PACKAGE(OpenEXR)
FIND_PACKAGE(COLLADA)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(Xine)
FIND_PACKAGE(OpenVRML)
FIND_PACKAGE(Performer)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(GDAL)
FIND_PACKAGE(CURL)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(ITK)
FIND_PACKAGE(LibVNCServer)
FIND_PACKAGE(OurDCMTK)

View File

@ -13,7 +13,10 @@
#
# Created by Robert Osfield.
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory")
FIND_PATH(COLLADA_INCLUDE_DIR dae.h
${COLLADA_DOM_ROOT}/include
$ENV{COLLADA_DIR}/include
$ENV{COLLADA_DIR}
$ENV{OSGDIR}/include
@ -36,6 +39,7 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom libcollada14dom21
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4
$ENV{COLLADA_DIR}/build/vc8-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
@ -60,6 +64,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d libcollada14dom21-d
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
@ -81,9 +86,10 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
/usr/freeware/lib64
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
NAMES collada_dom-s collada14dom-s libcollada14dom21-s
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
NAMES libcollada14dom21-s
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4
$ENV{COLLADA_DIR}/build/vc8-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
@ -108,6 +114,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd
PATHS
${COLLADA_DOM_ROOT}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
@ -129,6 +136,118 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
/usr/freeware/lib64
)
IF(COLLADA_STATIC_LIBRARY)
# find extra libraries that the static linking requires
FIND_PACKAGE(LibXml2)
IF (LIBXML2_FOUND)
SET(COLLADA_LIBXML_LIBRARY ${LIBXML2_LIBRARIES})
ELSE(LIBXML2_FOUND)
FIND_LIBRARY(COLLADA_LIBXML_LIBRARY
NAMES libxml2
PATHS
${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
)
ENDIF(LIBXML2_FOUND)
FIND_PACKAGE(ZLIB)
IF (ZLIB_FOUND)
SET(COLLADA_ZLIB_LIBRARY ${ZLIB_LIBRARY})
ELSE(ZLIB_FOUND)
FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
NAMES zlib
PATHS
${COLLADA_DOM_ROOT}/external-libs/libxml2/win32/lib
${COLLADA_DOM_ROOT}/external-libs/libxml2/mingw/lib
)
ENDIF(ZLIB_FOUND)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY
NAMES pcrecpp
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRECPP_LIBRARY_DEBUG
NAMES pcrecpp-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY
NAMES pcre
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_PCRE_LIBRARY_DEBUG
NAMES pcre-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mac
${COLLADA_DOM_ROOT}/external-libs/pcre/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
NAMES libboost_filesystem
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
NAMES libboost_filesystem-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
NAMES libboost_system
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
NAMES libboost_system-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc8
${COLLADA_DOM_ROOT}/external-libs/boost/lib/vc9
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY
NAMES minizip
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
FIND_LIBRARY(COLLADA_MINIZIP_LIBRARY_DEBUG
NAMES minizip-d
PATHS
${COLLADA_DOM_ROOT}/external-libs/minizip/win32/lib
${COLLADA_DOM_ROOT}/external-libs/minizip/mac
)
ENDIF(COLLADA_STATIC_LIBRARY)
SET(COLLADA_FOUND "NO")
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (COLLADA_INCLUDE_DIR)

View File

@ -21,39 +21,34 @@ SET(TARGET_H
domSourceReader.h
)
IF (COLLADA_STATIC_LIBRARY)
SET(COLLADA_USE_STATIC "YES")
ELSE(COLLADA_STATIC_LIBRARY)
SET(COLLADA_USE_STATIC "NO")
ENDIF(COLLADA_STATIC_LIBRARY)
IF (COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (COLLADA_DYNAMIC_LIBRARY AND COLLADA_STATIC_LIBRARY)
OPTION(COLLADA_USE_STATIC "Set to ON to build OpenSceneGraph with static Collada support." OFF)
MARK_AS_ADVANCED(COLLADA_USE_STATIC)
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (WIN32)
ELSE(COLLADA_DYNAMIC_LIBRARY AND COLLADA_STATIC_LIBRARY)
IF (COLLADA_USE_STATIC)
SET(TARGET_EXTERNAL_LIBRARIES libxml2 pcrecpp pcre)
ELSE (COLLADA_USE_STATIC)
ADD_DEFINITIONS(-DDOM_DYNAMIC)
ENDIF(COLLADA_USE_STATIC)
IF (COLLADA_STATIC_LIBRARY)
SET(COLLADA_USE_STATIC "YES")
ELSE(COLLADA_STATIC_LIBRARY)
SET(COLLADA_USE_STATIC "NO")
ENDIF(COLLADA_STATIC_LIBRARY)
ELSE (WIN32)
IF(COLLADA_USE_STATIC)
SET(TARGET_EXTERNAL_LIBRARIES collada14dom xml2 pcrecpp)
ELSE(COLLADA_USE_STATIC)
SET(TARGET_EXTERNAL_LIBRARIES collada14dom xml2)
ENDIF(COLLADA_USE_STATIC)
ENDIF(WIN32)
ENDIF(COLLADA_DYNAMIC_LIBRARY AND COLLADA_STATIC_LIBRARY)
IF (COLLADA_USE_STATIC)
SET(TARGET_LIBRARIES_VARS COLLADA_STATIC_LIBRARY)
IF(WIN32)
SET(TARGET_LIBRARIES_VARS COLLADA_STATIC_LIBRARY COLLADA_LIBXML_LIBRARY COLLADA_ZLIB_LIBRARY COLLADA_PCRECPP_LIBRARY COLLADA_PCRE_LIBRARY COLLADA_MINIZIP_LIBRARY COLLADA_BOOST_FILESYSTEM_LIBRARY COLLADA_BOOST_SYSTEM_LIBRARY)
ELSE(WIN32)
SET(TARGET_LIBRARIES_VARS COLLADA_STATIC_LIBRARY COLLADA_LIBXML_LIBRARY COLLADA_PCRECPP_LIBRARY COLLADA_BOOST_FILESYSTEM_LIBRARY COLLADA_BOOST_SYSTEM_LIBRARY)
ENDIF(WIN32)
ELSE (COLLADA_USE_STATIC)
SET(TARGET_LIBRARIES_VARS COLLADA_DYNAMIC_LIBRARY)
IF(WIN32)
ADD_DEFINITIONS(-DDOM_DYNAMIC)
SET(TARGET_LIBRARIES_VARS COLLADA_DYNAMIC_LIBRARY)
ELSE(WIN32)
SET(TARGET_LIBRARIES_VARS COLLADA_DYNAMIC_LIBRARY)
ENDIF(WIN32)
ENDIF(COLLADA_USE_STATIC)
SET(TARGET_ADDED_LIBRARIES osgSim )