I think this depends on how did you built OSG and what do you provide in env var: You can either build as in-rource or out source: when you run CMakeSetup (the CMake wint gui) it ask where are the sources and where you want the binaries generated. It hen put .lib files into <CMAKE_BINARY_DIR>/lib/<release/debug> depending on the release/debug type of build
It leaves the includes into the original folder <CMAKE_SOURCE_DIR>
It seems to me you have built osg as in-source, so you have <CMAKE_SOURCE_DIR> == <CMAKE_BINARY_DIR> and then you have specified the env var OSG_DIR = <CMAKE_SOURCE_DIR> == <CMAKE_BINARY_DIR> So the find process require you to search lib in $ENV{OSG_DIR}/lib/*/release == */%OSG_DIR%\lib\release If you build the install target in visual studio, it copy include, lib and bin folders inside <CMAKE_INSTALL_PREFIX>, both debug and release stuff.

then you can set OSG_DIR with the CmakeSetup gui to point to <CMAKE_INSTALL_PREFIX> and , the generated VirualPlanetBuilder sln projects should pick up the correct debug/release libs of OSG accordingly to the type of build.

Anyway, we can add release and debug to the folder searched to allow your setup.

Thanks
            Luigi




christophe loustaunau wrote:

Hello Luigi,
I have set OSG_DIR and GDAL_DIR as env var. Apply your patch but there are still
some errors :
This projet requires some variables to be set and cmake can not find them :
OPENTHREAD_LIBRARY
OSGDB_LIBRARY
OSGFX_LIBRARY
OSGUTIL_LIBRARY
OSGVIEWER_LIBRARY
OSG_LIBRARY
Then, I have modified the file (with the help of Damien, one of my colleague:-)
) : VirtualPlanetBuilder\CMakeModules\FindOSG.cmake
Modification is in */red/*
*//*
# Locate gdal
# This module defines
# OSG_LIBRARY
# OSG_FOUND, if false, do not try to link to gdal
# OSG_INCLUDE_DIR, where to find the headers
#
# $OSG_DIR is an environment variable that would
# correspond to the ./configure --prefix=$OSG_DIR
#
# Created by Robert Osfield.

FIND_PATH(OSG_INCLUDE_DIR osg/Node
    ${OSG_DIR}/include
    $ENV{OSG_DIR}/include
    $ENV{OSG_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
)

MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)

    FIND_LIBRARY("${MYLIBRARY}_DEBUG"
        NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
        PATHS
        ${OSG_DIR}/lib
        $ENV{OSG_DIR}/lib
        $ENV{OSG_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
    )

    FIND_LIBRARY("${MYLIBRARY}"
        NAMES ${MYLIBRARYNAME}
        PATHS
        ${OSG_DIR}/lib
        $ENV{OSG_DIR}/lib/*/release */
        $ENV{OSG_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
    )
    IF( NOT ${MYLIBRARY}_DEBUG)
     IF(MYLIBRARY)
      SET(${MYLIBRARY}_DEBUG ${MYLIBRARY})
      ENDIF(MYLIBRARY)
    ENDIF( NOT ${MYLIBRARY}_DEBUG)
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)

FIND_OSG_LIBRARY(OSG_LIBRARY osg)
FIND_OSG_LIBRARY(OSGUTIL_LIBRARY osgUtil)
FIND_OSG_LIBRARY(OSGDB_LIBRARY osgDB)
FIND_OSG_LIBRARY(OSGTEXT_LIBRARY osgText)
FIND_OSG_LIBRARY(OSGTERRAIN_LIBRARY osgTerrain)
FIND_OSG_LIBRARY(OSGFX_LIBRARY osgFX)
FIND_OSG_LIBRARY(OSGVIEWER_LIBRARY osgViewer)
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)

SET(OSG_FOUND "NO")
IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
    SET(OSG_FOUND "YES")
ENDIF(OSG_LIBRARY AND OSG_INCLUDE_DIR)

With this modification, no errors, and the project compile fine ! Christophe.

2007/7/12, Luigi Calori <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:


    Here is my patches:

    I have modified the FindOSG and FindGDAL scripts to search not
    only env
    var OSG_DIR and GDAL_DIR but, before
    cmake variables OSG_DIR and GDAL_DIR that can be specified either
    in the
    CMake gui or via  the -d OSG_DIR=<install path of osg, what you have
    specified in CMAKE_INSTALL_PREFIX at osg cmake time>

    I think this is handier to use than env var (under window you have to
    remember either to set a user or system env var or to launch Cmake
    from
    a shell where you have set your env)

    I' ve built osgdem against GDAL found from a pre-built
    installation of
    FWTools (1.2.0)     http://fwtools.maptools.org/
    I' ve also modified to select debug osg libraries if present when
    building in debug mode
    I had to add osgViewer to the osgdem app to be able to open
    windows. Not
    completely sure it is absolutely needed.

    The patch has been extracted under windows with the following command
    against the current ( 631) svn version
    svn -x -u -x --ignore-eol-style diff | unix2dos | zip

    Hope it helps

    Luigi Calori

    If it works for you, let us know, so eventually Robert can check
    in the
    mods.


    christophe loustaunau wrote:

    > Ok, so I will wait for this changes.
    >
    > Thanks !
    >
    >
    > 2007/7/12, Robert Osfield <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    > <mailto:[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>>>:
    >
    >     Hi Christophe,
    >
    >     Luigi sent a post a few days about about build VPB under
    Windows using
    >     the new Cmake build.  He mentioned that he had to make a few
    changes
    >     to CMakeLists.txt files and source files but hasn't
    submitted any
    >     changes yet though.
    >
    >     Robert.
    >


    _______________________________________________
    osg-users mailing list
    osg-users@openscenegraph.net <mailto:osg-users@openscenegraph.net>
    http://openscenegraph.net/mailman/listinfo/osg-users
    http://www.openscenegraph.org/


------------------------------------------------------------------------

_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to