[osg-users] Osgswig
Gerrick Bivins
gbivins at objectreservoir.com
Fri Jun 27 06:30:38 PDT 2008
Any plans for building java binding with Cmake?
On 6/27/08 8:27 AM, "Luigi Calori" <l.calori at cineca.it> wrote:
> Hi Harmut, I did not know you were still working on osgswig, If it can
> help, I attach some mods we have done to develop some code based on osgswig
> We have tried to add wrapping to write node visitor derived python
> I include all our mods, (we have also mod cmake to covert .dll to pyd)
> It is tested under win XP with osg 2.5
> We have also tried it under Linux and it compiles correctly but has some
> runtime problems
> We have also integrated osg window with wxpython, it is working under
> windows but bad performance under linux
>
> I attach a patch built with tortoise patch
>
> Hope it helps
>
> Luigi
>
> Hartmut Seichter wrote:
>
>>
>> Nope we are around and kicking. Unfortunately nothing to show yet: I
>> am working on getting most of the nested classes integrated.
>>
>> Hartmut
>>
>>
>> Gerrick Bivins wrote:
>>
>>> Hi all,
>>> Does anyone know if osgswig is being maintained anymore? Site on
>>> google code doesn¹t seem like it¹s being updated anymore.
>>> Has the project moved or is it just dead?
>>> biv
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
> Index: CMakeLists.txt
> ===================================================================
> --- CMakeLists.txt (revision 117)
> +++ CMakeLists.txt (working copy)
> @@ -171,3 +171,11 @@
> IMMEDIATE @ONLY)
> ADD_CUSTOM_TARGET(uninstall
> "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
> +
> +##########to get all the variables of Cmake
> +GET_CMAKE_PROPERTY(MYVARS VARIABLES)
> +FOREACH(myvar ${MYVARS})
> + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/AllVariables.txt
> + "${myvar} -->${${myvar}}<-\n"
> + )
> +ENDFOREACH(myvar)
> \ No newline at end of file
> Index: CMakeModules/FindOSG.cmake
> ===================================================================
> --- CMakeModules/FindOSG.cmake (revision 117)
> +++ CMakeModules/FindOSG.cmake (working copy)
> @@ -1,16 +1,17 @@
> # Locate gdal
> # This module defines
> # OSG_LIBRARY
> -# OSG_FOUND, if false, do not try to link to osg
> +# 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.
> -# Edited By R.C.Molenaar to include debug versions
> +SET(OSG_DIR "" CACHE PATH "set to base osg install path")
>
> FIND_PATH(OSG_INCLUDE_DIR osg/Node
> + ${OSG_DIR}/include
> $ENV{OSG_DIR}/include
> $ENV{OSG_DIR}
> $ENV{OSGDIR}/include
> @@ -24,38 +25,40 @@
> /opt/local/include # DarwinPorts
> /opt/csw/include # Blastwave
> /opt/include
> - /cygdrive/c/Program Files/OpenSceneGraph/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}
> - NAMES ${MYLIBRARYNAME}
> + FIND_LIBRARY("${MYLIBRARY}_DEBUG"
> + NAMES "${MYLIBRARYNAME}d"
> PATHS
> + ${OSG_DIR}/lib/Debug
> + ${OSG_DIR}/lib
> + $ENV{OSG_DIR}/lib/debug
> $ENV{OSG_DIR}/lib
> - $ENV{OSG_DIR}/bin
> $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
> - /cygdrive/c/Program\ Files/OpenSceneGraph/lib
> - /cygdrive/c/Program\ Files/OpenSceneGraph/bin
> - /cygdrive/c/Projects/OpenSceneGraph/Build/lib/release
> [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\
> Manager\\Environment;OSG_ROOT]/lib
> /usr/freeware/lib64
> )
>
> - FIND_LIBRARY(${MYLIBRARY}_DEBUG
> - NAMES ${MYLIBRARYNAME}d
> + FIND_LIBRARY(${MYLIBRARY}
> + NAMES ${MYLIBRARYNAME}
> PATHS
> + ${OSG_DIR}/lib/Release
> + ${OSG_DIR}/lib
> + $ENV{OSG_DIR}/lib/Release
> $ENV{OSG_DIR}/lib
> $ENV{OSG_DIR}
> $ENV{OSGDIR}/lib
> @@ -63,46 +66,84 @@
> $ENV{OSG_ROOT}/lib
> ~/Library/Frameworks
> /Library/Frameworks
> + /usr/local/lib
> + /usr/lib
> /sw/lib
> /opt/local/lib
> /opt/csw/lib
> /opt/lib
> - /cygdrive/c/Program\ Files/OpenSceneGraph/lib
> - /cygdrive/c/Program\ Files/OpenSceneGraph/bin
> - /cygdrive/c/Projects/OpenSceneGraph/Build/lib/release
> [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\
> Manager\\Environment;OSG_ROOT]/lib
> /usr/freeware/lib64
> )
> +# MESSAGE("-->${${MYLIBRARY}}<-->${${MYLIBRARY}_DEBUG}<--")
> + IF( NOT ${MYLIBRARY}_DEBUG)
> + IF(${MYLIBRARY})
> + SET(${MYLIBRARY}_DEBUG ${${MYLIBRARY}})
> + ENDIF(${MYLIBRARY})
> + ENDIF( NOT ${MYLIBRARY}_DEBUG)
> + IF( NOT ${MYLIBRARY})
> +# MESSAGE("d1-->${${MYLIBRARY}}<-->${${MYLIBRARY}_DEBUG}<--")
> + IF(${MYLIBRARY}_DEBUG)
> +# MESSAGE("d2-->${${MYLIBRARY}}<-->${${MYLIBRARY}_DEBUG}<--")
> + SET(${MYLIBRARY} ${${MYLIBRARY}_DEBUG})
> + ENDIF(${MYLIBRARY}_DEBUG)
> + ENDIF( NOT ${MYLIBRARY})
> +# MESSAGE("d3-->${${MYLIBRARY}}<-->${${MYLIBRARY}_DEBUG}<--")
> +# IF(${MYLIBRARY})
> +# IF(${MYLIBRARY}_DEBUG)
> +# SET( "${MYLIBRARYNAME}" "optimized ${${MYLIBRARY}} debug
> ${${MYLIBRARY}_DEBUG}" )
> +# ELSE (${MYLIBRARY}_DEBUG)
> +# SET( "${MYLIBRARYNAME}" ${${MYLIBRARY}} )
> +# ENDIF(${MYLIBRARY}_DEBUG)
> +# ENDIF(${MYLIBRARY})
> + MARK_AS_ADVANCED(${MYLIBRARY} ${MYLIBRARY}_DEBUG)
> +ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
>
> - IF (NOT ${MYLIBRARY})
> - MESSAGE("-- Warning ${MYLIBRARYNAME} not found, ${MYLIBRARY} tring to
> use: ${MYLIBRARY}_DEBUG")
> - ENDIF (NOT ${MYLIBRARY})
> +FIND_OSG_LIBRARY(OSG_LIBRARY osg)
> +FIND_OSG_LIBRARY(OSGUTIL_LIBRARY osgUtil)
> +FIND_OSG_LIBRARY(OSGDB_LIBRARY osgDB)
> +FIND_OSG_LIBRARY(OSGGA_LIBRARY osgGA)
> +FIND_OSG_LIBRARY(OSGTEXT_LIBRARY osgText)
> +FIND_OSG_LIBRARY(OSGTERRAIN_LIBRARY osgTerrain)
> +FIND_OSG_LIBRARY(OSGFX_LIBRARY osgFX)
> +FIND_OSG_LIBRARY(OSGSIM_LIBRARY osgSim)
> +FIND_OSG_LIBRARY(OSGMANIPULATOR_LIBRARY osgManipulator)
> +FIND_OSG_LIBRARY(OSGVIEWER_LIBRARY osgViewer)
> +FIND_OSG_LIBRARY(OSGINTROSPECTION_LIBRARY osgIntrospection)
> +FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)
>
> +#GET_FILENAME_COMPONENT(tmp ${OSG_LIBRARY} PATH)
> +#GET_FILENAME_COMPONENT(tmp ${tmp} PATH)
>
> - IF(${MYLIBRARY}_DEBUG)
> - IF (NOT ${MYLIBRARY})
> - MESSAGE("-- Warning ${MYLIBRARYNAME} not found, ${MYLIBRARY}
> using: ${${MYLIBRARY}_DEBUG}")
> - SET(${MYLIBRARY} "${${MYLIBRARY}_DEBUG}" CACHE FILEPATH "Release
> version of OpenSceneGraph ${MYLIBRARYNAME} Library (use debug version if not
> available)" FORCE)
> - ENDIF(NOT ${MYLIBRARY})
> - ENDIF(${MYLIBRARY}_DEBUG)
> +#IF(EXISTS ${tmp}/bin
> +FIND_PATH(OSG_BIN_DIR
> + NAMES
> +# "osg${CMAKE_SHARED_LIBRARY_SUFFIX}"
> +# "osgd${CMAKE_SHARED_LIBRARY_SUFFIX}"
> + "osgVersion${CMAKE_EXECUTABLE_SUFFIX}"
> + "osgVersiond${CMAKE_EXECUTABLE_SUFFIX}"
> + PATHS
> + ${OSG_DIR}/bin
> + $ENV{OSG_DIR}/bin
> + $ENV{OSG_DIR}
> + $ENV{OSGDIR}/bin
> + $ENV{OSGDIR}
> + $ENV{OSG_ROOT}/bin
> + ~/Library/Frameworks
> + /Library/Frameworks
> + /usr/local/bin
> + /usr/bin
> + /sw/bin # Fink
> + /opt/local/bin # DarwinPorts
> + /opt/csw/bin # Blastwave
> + /opt/bin
> + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\
> Manager\\Environment;OSG_ROOT]/bin
> + /usr/freeware/bin
> +)
> +MARK_AS_ADVANCED(OSG_INCLUDE_DIR OSG_BIN_DIR)
>
> - IF(${MYLIBRARY})
> - IF (NOT ${MYLIBRARY}_DEBUG)
> - MESSAGE("-- Warning Debug ${MYLIBRARYNAME} not found,
> ${MYLIBRARY}_DEBUG using: ${MYLIBRARY}")
> - #SET(OSG_LIBRARY_DEBUG "${OSG_LIBRARY}")
> - SET(${MYLIBRARY}_DEBUG "${${MYLIBRARY}}" CACHE FILEPATH "Debug
> version of OpenSceneGraph ${MYLIBRARYNAME} Library (use regular version if not
> available)" FORCE)
> - ENDIF(NOT ${MYLIBRARY}_DEBUG)
> - ENDIF(${MYLIBRARY})
>
> -
> -ENDMACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
> -
> -FOREACH(MYOSGLIBRARY osg osgUtil osgDB osgText osgTerrain osgFX osgViewer
> osgGA osgSim osgShadow osgManipulator osgParticle )
> - STRING(TOUPPER ${MYOSGLIBRARY} MYOSGUPPER )
> - FIND_OSG_LIBRARY( ${MYOSGUPPER}_LIBRARY ${MYOSGLIBRARY})
> -ENDFOREACH(MYOSGLIBRARY)
> -
> SET(OSG_FOUND "NO")
> -IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
> +IF(OSG_LIBRARY AND OSG_INCLUDE_DIR AND OSG_BIN_DIR)
> SET(OSG_FOUND "YES")
> -ENDIF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
> +ENDIF(OSG_LIBRARY AND OSG_INCLUDE_DIR AND OSG_BIN_DIR)
> Index: src/osg.i
> ===================================================================
> --- src/osg.i (revision 117)
> +++ src/osg.i (working copy)
> @@ -11,6 +11,7 @@
> %feature("director") osg::MatrixTransform;
> // directors - preliminary set
> %feature("director") osg::NodeCallback;
> +%feature("director") osg::NodeVisitor;
>
>
> //%feature("docstring");
> @@ -61,6 +62,7 @@
> #include <osg/StateSet>
> #include <osg/StateAttribute>
> #include <osg/PolygonMode>
> +#include <osg/PolygonOffset>
> #include <osg/LineWidth>
> #include <osg/LineStipple>
> #include <osg/Material>
> @@ -483,6 +485,7 @@
> %include osg/StateSet
> %include osg/StateAttribute
> %include osg/PolygonMode
> +%include osg/PolygonOffset
> %include osg/LineWidth
> %include osg/LineStipple
> %include osg/Material
> Index: src/osg_header.i
> ===================================================================
> --- src/osg_header.i (revision 117)
> +++ src/osg_header.i (working copy)
> @@ -8,6 +8,7 @@
> #include <osg/StateSet>
> #include <osg/StateAttribute>
> #include <osg/PolygonMode>
> +#include <osg/PolygonOffset>
> #include <osg/LineWidth>
> #include <osg/LineStipple>
> #include <osg/Material>
> Index: src/osgDB.i
> ===================================================================
> --- src/osgDB.i (revision 117)
> +++ src/osgDB.i (working copy)
> @@ -110,6 +110,7 @@
>
> %ignore osgDB::Input::read;
>
> +
> %include osgDB/Version
> %include osgDB/Export
> %include osgDB/ReaderWriter
> @@ -133,5 +134,15 @@
> %include osgDB/DotOsgWrapper
> %include osgDB/Registry
>
> -// %include osgDB/ReaderWriter
> -// %include osgDB/ReadFile
> +
> +//%include osgDB/ReaderWriter
> +
> +%inline %{
> +bool writeNodeFile_s(const osg::Node& node, const std::string& filename,
> const std::string& optionstring ) {
> + osgDB::ReaderWriter::Options* options = new
> osgDB::ReaderWriter::Options;
> + options->setOptionString(optionstring);
> +
> + return writeNodeFile(node,filename,options);
> +}
> +%}
> +
> Index: src/osgGA.i
> ===================================================================
> --- src/osgGA.i (revision 117)
> +++ src/osgGA.i (working copy)
> @@ -57,4 +57,5 @@
> %include osgGA/AnimationPathManipulator
> %include osgGA/DriveManipulator
> %include osgGA/NodeTrackerManipulator
> +%include osgGA/EventQueue
>
> Index: src/osgSim.i
> ===================================================================
> --- src/osgSim.i (revision 117)
> +++ src/osgSim.i (working copy)
> @@ -19,6 +19,8 @@
> %import osg.i
>
>
> +
> +
> %{
>
> #include <osgSim/BlinkSequence>
> @@ -36,11 +38,12 @@
> #include <osgSim/LightPointSystem>
> #include <osgSim/LineOfSight>
> #include <osgSim/MultiSwitch>
> -#include <osgSim/OpenFlightOptimizer>
> +#include <osgSim/ObjectRecordData>
> #include <osgSim/OverlayNode>
> #include <osgSim/ScalarBar>
> #include <osgSim/ScalarsToColors>
> #include <osgSim/Sector>
> +#include <osgSim/ShapeAttribute>
> #include <osgSim/SphereSegment>
> #include <osgSim/Version>
> #include <osgSim/VisibilityGroup>
> @@ -83,9 +86,9 @@
> %include osgSim/LightPointSystem
> %include osgSim/LineOfSight
> %include osgSim/MultiSwitch
> -%include osgSim/OpenFlightOptimizer
> +%include osgSim/ObjectRecordData
> %include osgSim/OverlayNode
> -%include osgSim/ScalarBar
> +//%include osgSim/ScalarBar
> %include osgSim/ScalarsToColors
> %include osgSim/Sector
> %include osgSim/SphereSegment
> Index: src/osgText.i
> ===================================================================
> --- src/osgText.i (revision 117)
> +++ src/osgText.i (working copy)
> @@ -53,13 +53,15 @@
>
> /* include the actual headers */
> %include osgText/Export
> +%include osgText/KerningType
> %include osgText/String
> %include osgText/Font
> +%include osgText/TextBase
> %include osgText/Text
> %include osgText/FadeText
> %include osgText/Version
> -%include osgText/KerningType
>
> +
> # %template(FontResolution) std::pair<unsigned int,unsigned int>;
>
>
> Index: src/python/CMakeLists.txt
> ===================================================================
> --- src/python/CMakeLists.txt (revision 117)
> +++ src/python/CMakeLists.txt (working copy)
> @@ -40,7 +40,6 @@
> ENDIF(NOT APPLE)
>
>
> -
> FIND_PACKAGE(PythonLibs)
> INCLUDE_DIRECTORIES(
> ${PYTHON_INCLUDE_PATH}
> @@ -61,16 +60,18 @@
>
>
> SET_SOURCE_FILES_PROPERTIES(
> - osg.i osgUtil.i osgFX.i osgDB.i osgGA.i osgText.i osgViewer.i
> osgManipulator.i
> + osg.i osgUtil.i osgFX.i osgDB.i osgGA.i osgText.i osgSim.i osgViewer.i
> osgManipulator.i
> PROPERTIES CPLUSPLUS TRUE)
>
> SET_SOURCE_FILES_PROPERTIES(osg.i PROPERTIES SWIG_FLAGS "-make_default")
>
> SET(SWIGLINKLIBS ${OSG_LIBRARY} ${PYTHON_LIBRARIES} ${OPENTHREADS_LIBRARY}
> ${OPENGL_LIBRARIES})
>
> +SET(SWIG_MODULE_osg_EXTRA_DEPS ../osg.i)
> SWIG_ADD_MODULE(osg python osg.i)
> SWIG_LINK_LIBRARIES(osg ${SWIGLINKLIBS})
>
> +SET(SWIG_MODULE_osg_EXTRA_DEPS ../osgUtil.i)
> SWIG_ADD_MODULE(osgUtil python osgUtil.i)
> SWIG_LINK_LIBRARIES(osgUtil ${SWIGLINKLIBS} ${OSGUTIL_LIBRARY})
>
> @@ -92,6 +93,10 @@
> SWIG_ADD_MODULE(osgText python osgText.i)
> SWIG_LINK_LIBRARIES(osgText ${SWIGLINKLIBS} ${OSGGA_LIBRARY}
> ${OSGTEXT_LIBRARY})
>
> +SWIG_ADD_MODULE(osgSim python osgSim.i)
> +SWIG_LINK_LIBRARIES(osgSim ${SWIGLINKLIBS} ${OSGGA_LIBRARY}
> ${OSGSIM_LIBRARY})
> +
> +
> IF(BUILD_WITH_OSGART)
> INCLUDE_DIRECTORIES(
> ${OSGART_INCLUDE_DIR}
> @@ -107,3 +112,16 @@
> # OSGSWIG_ADD_MODULE(osgART python ${SWIGLINKLIBS} ${OSGART_LIBRARY}
> ${OSGGA_LIBRARY})
> ENDIF(BUILD_WITH_OSGART)
>
> +FOREACH(modname osg osgUtil osgFX osgDB osgGA osgViewer osgText osgSim)
> + SET(TGT ${SWIG_MODULE_${modname}_REAL_NAME})
> + GET_TARGET_PROPERTY(${TGT}_LOCATION ${TGT} LOCATION)
> + GET_FILENAME_COMPONENT( MYNAME ${${TGT}_LOCATION} NAME_WE)
> + GET_FILENAME_COMPONENT( MYDIR ${${TGT}_LOCATION} PATH)
> + GET_FILENAME_COMPONENT( PARDIR ${MYDIR} PATH)
> +
> + ADD_CUSTOM_COMMAND(TARGET ${TGT}
> + POST_BUILD
> + COMMAND ${CMAKE_COMMAND}
> + ARGS -E copy ${${TGT}_LOCATION} "${PARDIR}/${MYNAME}.pyd"
> + )
> +ENDFOREACH(modname)
> Index: src/python/osgSim.i
> ===================================================================
> --- src/python/osgSim.i (revision 0)
> +++ src/python/osgSim.i (revision 0)
> @@ -0,0 +1,2 @@
> +%include "../osgSim.i"
> +
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list