From f2d59416aa814eb1e6f32d935a6084fc71a09154 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 8 Dec 2007 16:52:27 +0000 Subject: [PATCH] From Jeremy Moles, Anders Backman and Robert Osfield, both Jeremy and Anders added static build support as an option, but one was for Unix and one for Windowsm, but the two mods were also inconsitent in naming and implementation. I have had a bash at merging them both, but don't know yet if these changes will work yet on either configuration... user testing will tell... --- src/osgPlugins/dae/CMakeLists.txt | 34 +++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/dae/CMakeLists.txt b/src/osgPlugins/dae/CMakeLists.txt index 637ccf43d..b7205f837 100644 --- a/src/osgPlugins/dae/CMakeLists.txt +++ b/src/osgPlugins/dae/CMakeLists.txt @@ -14,18 +14,44 @@ SET(TARGET_SRC domSourceReader.cpp ReaderWriterDAE.cpp ) + SET(TARGET_H daeReader.h daeWriter.h domSourceReader.h ) -IF(WIN32) + +OPTION(COLLADA_USE_STATIC "Set to ON to build OpenSceneGraph with static Collada support." OFF) +MARK_AS_ADVANCED(COLLADA_USE_STATIC) + +IF (WIN32) + + IF (COLLADA_USE_STATIC) SET(TARGET_EXTERNAL_LIBRARIES libcollada_dom libcollada_dae libcollada_STLDatabase libcollada_LIBXMLPlugin libcollada_stdErrPlugin libxml2 ) -ELSE(WIN32) - #SET(TARGET_EXTERNAL_LIBRARIES collada_dom collada_dae collada_STLDatabase collada_LIBXMLPlugin collada_stdErrPlugin xml2 ) + ELSE (COLLADA_USE_STATIC) + 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 - SET(TARGET_EXTERNAL_LIBRARIES collada_dom collada_dae xml2 ) + # + # 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 collada_dom collada_dae xml2 pcrecpp) + ELSE(COLLADA_USE_STATIC) + SET(TARGET_EXTERNAL_LIBRARIES collada_dom_shared collada_dae_shared xml2) + ENDIF(COLLADA_USE_STATIC) + ENDIF(WIN32) + SET(TARGET_LIBRARIES_VARS COLLADA_LIBRARY) #### end var setup ###