Revised the DYNAMIC vs STATIC library setup of COLLADA.

This commit is contained in:
Robert Osfield 2008-12-02 10:42:58 +00:00
parent b58efff175
commit 9d92a26693
2 changed files with 81 additions and 27 deletions

View File

@ -1,9 +1,13 @@
# Locate gdal
# This module defines
# COLLADA_LIBRARY
# COLLADA_FOUND, if false, do not try to link to gdal
# Locate Collada
# This module defines:
# COLLADA_INCLUDE_DIR, where to find the headers
#
# COLLADA_LIBRARY, COLLADA_LIBRARY_DEBUG
# COLLADA_FOUND, if false, do not try to link to Collada dynamically
#
# COLLADA_LIBRARY_STATIC, COLLADA_LIBRARY_STATIC_DEBUG
# COLLADA_STATIC_FOUND, if false, do not try to link to Collada statically
#
# $COLLADA_DIR is an environment variable that would
# correspond to the ./configure --prefix=$COLLADA_DIR
#
@ -29,7 +33,7 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
/usr/freeware/include
)
FIND_LIBRARY(COLLADA_LIBRARY
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom libcollada14dom21
PATHS
$ENV{COLLADA_DIR}/build/vc8-1.4
@ -53,7 +57,7 @@ FIND_LIBRARY(COLLADA_LIBRARY
/usr/freeware/lib64
)
FIND_LIBRARY(COLLADA_LIBRARY_DEBUG
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d libcollada14dom21-d
PATHS
$ENV{COLLADA_DIR}/build/vc8-1.4-d
@ -77,9 +81,57 @@ FIND_LIBRARY(COLLADA_LIBRARY_DEBUG
/usr/freeware/lib64
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
NAMES collada_dom-s collada14dom-s libcollada14dom21-s
PATHS
$ENV{COLLADA_DIR}/build/vc8-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd
PATHS
$ENV{COLLADA_DIR}/build/vc8-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
SET(COLLADA_FOUND "NO")
IF(COLLADA_LIBRARY AND COLLADA_INCLUDE_DIR)
SET(COLLADA_FOUND "YES")
ENDIF(COLLADA_LIBRARY AND COLLADA_INCLUDE_DIR)
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (COLLADA_INCLUDE_DIR)
SET(COLLADA_FOUND "YES")
ENDIF(COLLADA_INCLUDE_DIR)
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)

View File

@ -21,30 +21,27 @@ SET(TARGET_H
domSourceReader.h
)
OPTION(COLLADA_USE_STATIC "Set to ON to build OpenSceneGraph with static Collada support." OFF)
#MARK_AS_ADVANCED(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)
IF (COLLADA_DYNAMIC_LIBRARY OR 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)
IF (COLLADA_USE_STATIC)
SET(TARGET_EXTERNAL_LIBRARIES libxml2 pcrecpp-d pcre-d)
SET(TARGET_EXTERNAL_LIBRARIES libxml2 pcrecpp pcre)
ELSE (COLLADA_USE_STATIC)
# ADD_DEFINITIONS(-DDOM_DYNAMIC)
SET(TARGET_EXTERNAL_LIBRARIES libxml2 pcrecpp-d pcre-d)
ADD_DEFINITIONS(-DDOM_DYNAMIC)
ENDIF(COLLADA_USE_STATIC)
ELSE (WIN32)
# SET(TARGET_EXTERNAL_LIBRARIES collada_dom collada_dae collada_STLDatabase collada_LIBXMLPlugin collada_stdErrPlugin xml2 )
# JC hack STLDatabase and XMLPlugin are statically linked on Linux
#
# This works in "shared" mode
# SET(TARGET_EXTERNAL_LIBRARIES collada_dom_shared collada_dae_shared xml2 )
#
# This works in "static" mode
# SET(TARGET_EXTERNAL_LIBRARIES collada_dom collada_dae xml2 pcrecpp)
#
# ...so what we need is a conditional way to properly SET() the right one.
IF(COLLADA_USE_STATIC)
SET(TARGET_EXTERNAL_LIBRARIES collada14dom xml2 pcrecpp)
ELSE(COLLADA_USE_STATIC)
@ -53,7 +50,12 @@ ELSE (WIN32)
ENDIF(WIN32)
SET(TARGET_LIBRARIES_VARS COLLADA_LIBRARY)
IF (COLLADA_USE_STATIC)
SET(TARGET_LIBRARIES_VARS COLLADA_STATIC_LIBRARY)
ELSE (COLLADA_USE_STATIC)
SET(TARGET_LIBRARIES_VARS COLLADA_DYNAMIC_LIBRARY)
ENDIF(COLLADA_USE_STATIC)
SET(TARGET_ADDED_LIBRARIES osgSim )
#### end var setup ###