[osg-users] CMake config for OpenVRML plugin - debug vs release libs

Jean-Sébastien Guay jean-sebastien.guay at polymtl.ca
Mon Sep 10 09:11:55 PDT 2007


Hello Luigi,

> Sorry I am on a really slow connection now, so just hints, I can not test:

That's fine, thanks for helping even in less than optimal work conditions :-)

> The idea is that TARGET_ADDED_LIBRARIES is interpreted by SETUP_PLUGIN
> macro as a list of undifferentiated external lib libraries to link to

I had to replace TARGET_ADDED_LIBRARIES with  
TARGET_EXTERNAL_LIBRARIES, otherwise CMake would complain that it  
doesn't know how to make the library... I think that was just because  
of the "untested" disclaimer you put in your message :-)

> TARGET_LIBRARIES_VARS is interpreted as a list of variable names, the
> simple name is intended to hold the library to iln in optimizemed mode,
> the var with _DEBUG appended holds the lib name to use in debug mode.

That works well, except for one thing. CMake seems to not use the  
debug version of the OpenVRML library (given as OPENVRML_LIBRARY and  
OPENVRML_LIBRARY_DEBUG in FindOpenVRML.cmake) in the debug linker  
properties... I have no idea why. I can see in the CMake dialog that  
the right library is specified (openvrml.lib for release,  
openvrmld.lib for debug) but after doing configure+generate, it's  
openvrml.lib in both release and debug in the Visual C++ linker  
properties.

The weird thing is that ANTLR_LIBRARY and REGEX_LIBRARY work well for  
release and debug... It's just OPENVRML_LIBRARY that doesn't work. Is  
it FindOpenVRML.cmake that has a problem? I'm including both files  
just to see if you can spot what's wrong...

Thanks,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay     jean-sebastien.guay at polymtl.ca
                         http://whitestar02.webhop.org/

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
# Locate openvml library
# This module defines
# OPENVRML_LIBRARY
# OPENVRML_FOUND, if false, do not try to link to vrml 
# OPENVRML_INCLUDE_DIR, where to find the headers
#
# $OPENVRML_DIR is an environment variable that would
# correspond to the ./configure --prefix=$OPENVRML_DIR
#
# Created by Robert Osfield. 

FIND_PATH(OPENVRML_INCLUDE_DIR openvrml/openvrml/common.h
    $ENV{OPENVRML_DIR}/include
    $ENV{OPENVRML_DIR}
    $ENV{OSGDIR}/include
    $ENV{OSGDIR}
    $ENV{OSG_ROOT}/include
    ~/Library/Frameworks
    /Library/Frameworks
    /usr/local/include
    /usr/include
    /sw/include # Fink
    /opt/local/include # DarwinPorts
    /opt/csw/include # Blastwave
    /opt/include
    [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
    /usr/freeware/include
)

FIND_LIBRARY(OPENVRML_LIBRARY 
    NAMES openvrml
    PATHS
    $ENV{OPENVRML_DIR}/lib
    $ENV{OPENVRML_DIR}
    $ENV{OSGDIR}/lib
    $ENV{OSGDIR}
    $ENV{OSG_ROOT}/lib
    ~/Library/Frameworks
    /Library/Frameworks
    /usr/local/lib
    /usr/lib
    /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(OPENVRML_LIBRARY_DEBUG "${OPENVRML_LIBRARY}d")
#FIND_LIBRARY(OPENVRML_LIBRARY_DEBUG 
#    NAMES openvrmld
#    PATHS
#    $ENV{OPENVRML_DIR}/lib
#    $ENV{OPENVRML_DIR}
#    $ENV{OSGDIR}/lib
#    $ENV{OSGDIR}
#    $ENV{OSG_ROOT}/lib
#    ~/Library/Frameworks
#    /Library/Frameworks
#    /usr/local/lib
#    /usr/lib
#    /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(OPENVRML_FOUND "NO")
IF(OPENVRML_LIBRARY AND OPENVRML_INCLUDE_DIR)
    SET(OPENVRML_FOUND "YES")
ENDIF(OPENVRML_LIBRARY AND OPENVRML_INCLUDE_DIR)


-------------- next part --------------
IF (WIN32)
    INCLUDE_DIRECTORIES( ${OPENVRML_INCLUDE_DIR} ${OPENVRML_INCLUDE_DIR}/openvrml ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
    SET(OPENVRML_ANTLR_LIBRARY       antlr.lib)
    SET(OPENVRML_ANTLR_LIBRARY_DEBUG antlrd.lib)
    SET(OPENVRML_REGEX_LIBRARY       regex.lib)
    SET(OPENVRML_REGEX_LIBRARY_DEBUG regexd.lib)
        SET(TARGET_LIBRARIES_VARS OPENVRML_ANTLR_LIBRARY OPENVRML_REGEX_LIBRARY OPENVRML_LIBRARY JPEG_LIBRARY PNG_LIBRARY ZLIB_LIBRARY)
    SET(TARGET_EXTERNAL_LIBRARIES Ws2_32.lib)
ELSE(WIN32)
    INCLUDE_DIRECTORIES( ${OPENVRML_INCLUDE_DIR} ${OPENVRML_INCLUDE_DIR}/openvrml)
    SET(TARGET_LIBRARIES_VARS OPENVRML_LIBRARY)
ENDIF(WIN32)

SET(TARGET_SRC ReaderWriterVRML2.cpp )

#### end var setup  ###
SETUP_PLUGIN(vrml)


More information about the osg-users mailing list