[osg-users] osgWidget updated file for CMake 2.6

Jeremy Moles jeremy at emperorlinux.com
Tue Jul 1 06:27:59 PDT 2008


On Tue, 2008-07-01 at 00:17 -0400, Jean-Sébastien Guay wrote:
> Hello Jeremy,
> 
> Hoping to help osgWidget get into OSG 2.6, I did a test build tonight 
> having freshly updated from SVN. I needed to make some changes to the 
> CMakeLists.txt file, similar to what needed to be done for OSG and VPB. 
> I'm attaching the changed file to this message.
> 
> Note that the minimum required version at the top of the file is just 
> what I felt is a safe minimum. It could possibly be a lower version 
> (like 2.4.5 or whatever) but I think realistically most people have 
> 2.4.7 or higher anyways, and I didn't personally test on an older 
> version, so I have no way to guarantee that it works.
> 
> I have built on Visual Studio 2005 (8.0) SP1. It built fine, and from 
> what I can see, most of the examples run fine too. Exceptions:
> 
> - osgwidgetinput: I don't seem to be able to type any values in the 
> fields, and clicking the button to create the sphere does nothing.

Yeah, unfortunately I won't be able to do much more with Input Widget
objects until there are some changes made to osgText. As it is, the
example currently doesn't do much of anything.

> - osgwidgetscrolled: can't do anything other than resize the box 
> horizontally, is there something else I should be able to do?

It should resize in all directions, and should change the image display
when you scroll your mouse wheel up and down?

> - osgwidgetstyled: what is it supposed to do?

This just demonstrates calling various method on a few Widget objects
using a "style" string (kind of like CSS).

> Note that I didn't build with Python or Lua support, perhaps I need one 
> of those for the examples above to work properly?
> 
> All in all, looking good. :-)
> 
> J-S
> plain text document attachment (CMakeLists.txt)
> cmake_minimum_required(VERSION 2.4.7)
> 
> PROJECT(osgWidget)
> 
> if(COMMAND cmake_policy)
>   cmake_policy(SET CMP0003 OLD)
> endif(COMMAND cmake_policy)
> 
> INCLUDE(FindPkgConfig)
> INCLUDE(FindPythonLibs)
> 
> PKG_CHECK_MODULES(LUA lua)
> 
> SET(SRC_FILES
> 	src/Box.cpp
> 	src/Canvas.cpp
> 	src/Frame.cpp
> 	src/Input.cpp
> 	src/Label.cpp
> 	src/Lua.cpp
> 	src/Python.cpp
> 	src/StyleManager.cpp
> 	src/Table.cpp
> 	src/Util.cpp
> 	src/Version.cpp
> 	src/ViewerEventHandlers.cpp
> 	src/Widget.cpp
> 	src/Window.cpp
> 	src/WindowManager.cpp
> )
> 
> SET(HEADER_FILES
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Box
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Canvas
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/EventInterface
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Frame
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Input
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Label
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Lua
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Python
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/ScriptEngine
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/StyleInterface
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/StyleManager
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Table
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Types
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/UIObjectParent
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Util
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/ViewerEventHandlers
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Widget
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Window
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/WindowManager
> 	${osgWidget_SOURCE_DIR}/include/osgWidget/Version
> )
> 
> SET(CMAKE_INCLUDE_PATH /usr/local/include CACHE STRING "Put your OSG include dir here...")
> SET(CMAKE_LIBRARY_PATH /usr/local/lib CACHE STRING "Put your OSG lib dir here...")
> SET(CMAKE_DEBUG_POSTFIX "d")
> 
> # Add our Lua cmake variable for turning it off and on.
> # NOTE: You must be using Lua 5.1 or greater...
> IF(LUA_VERSION STRGREATER "5.0")
> 	SET(OSGWIDGET_USELUA TRUE CACHE BOOL "Build with LUA support?")
> ELSE(LUA_VERSION STRGREATER "5.0")
> 	SET(OSGWIDGET_USELUA FALSE CACHE BOOL "Build with LUA support?")
> ENDIF(LUA_VERSION STRGREATER "5.0")
> 
> # Add our Python cmake variable for turning it off and on.
> IF(PYTHON_LIBRARY)
> 	SET(OSGWIDGET_USEPYTHON TRUE CACHE BOOL "Build with Python support?")
> ELSE(PYTHON_LIBRARY)
> 	SET(OSGWIDGET_USEPYTHON FALSE CACHE BOOL "Build with Python support?")
> ENDIF(PYTHON_LIBRARY)
> 
> # Stuff that should be in every build...
> INCLUDE_DIRECTORIES(include ${CMAKE_INCLUDE_PATH})
> 
> LINK_DIRECTORIES(${CMAKE_LIBRARY_PATH})
> 
> LINK_LIBRARIES(
> 	debug osgd         optimized osg
> 	debug osgUtild     optimized osgUtil
> 	debug osgViewerd   optimized osgViewer
> 	debug osgTextd     optimized osgText
> 	debug osgDBd       optimized osgDB
> 	debug osgGAd       optimized osgGA
> 	debug OpenThreadsd optimized OpenThreads
> )
> 
> ADD_LIBRARY(osgWidget SHARED ${SRC_FILES} ${HEADER_FILES})
> 
> # Stuff that is just available when LUA is toggled on.
> IF(OSGWIDGET_USELUA)
> 	INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIRS})
> 
> 	LINK_DIRECTORIES(${LUA_LIBRARY_DIRS})
> 
> 	TARGET_LINK_LIBRARIES(osgWidget ${LUA_LDFLAGS})
> 
> 	ADD_DEFINITIONS(-DOSGWIDGET_USELUA)
> ENDIF(OSGWIDGET_USELUA)
> 
> # Stuff that is just available when Python is toggled on.
> IF(OSGWIDGET_USEPYTHON)
> 	INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
> 
> 	LINK_DIRECTORIES(${PYTHON_LIBRARIES})
> 
> 	TARGET_LINK_LIBRARIES(osgWidget ${PYTHON_LIBRARIES})
> 
> 	ADD_DEFINITIONS(-DOSGWIDGET_USEPYTHON)
> ENDIF(OSGWIDGET_USEPYTHON)
> 
> INSTALL(TARGETS osgWidget DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
> 
> # This little do-hicky installs all of the header files.
> FOREACH(INCLUDEFILE ${HEADER_FILES})
> 	FILE(RELATIVE_PATH REL_INCLUDEFILE ${osgWidget_SOURCE_DIR}/include/osgWidget ${INCLUDEFILE})
> 	GET_FILENAME_COMPONENT(REL_INCLUDE_PATH ${REL_INCLUDEFILE} PATH)
> 	INSTALL(
> 		FILES ${INCLUDEFILE}
> 		DESTINATION ${CMAKE_INSTALL_PREFIX}/include/osgWidget/${REL_INCLUDE_PATH}
> 	)
> ENDFOREACH(INCLUDEFILE)
> 
> ADD_SUBDIRECTORY(examples/osgwidgetaddremove)
> ADD_SUBDIRECTORY(examples/osgwidgetbox)
> ADD_SUBDIRECTORY(examples/osgwidgetcanvas)
> ADD_SUBDIRECTORY(examples/osgwidgetframe)
> ADD_SUBDIRECTORY(examples/osgwidgetinput)
> ADD_SUBDIRECTORY(examples/osgwidgetlabel)
> ADD_SUBDIRECTORY(examples/osgwidgetmenu)
> ADD_SUBDIRECTORY(examples/osgwidgetnotebook)
> ADD_SUBDIRECTORY(examples/osgwidgetscrolled)
> ADD_SUBDIRECTORY(examples/osgwidgetshader)
> ADD_SUBDIRECTORY(examples/osgwidgetstyled)
> ADD_SUBDIRECTORY(examples/osgwidgettable)
> ADD_SUBDIRECTORY(examples/osgwidgetversion)
> ADD_SUBDIRECTORY(examples/osgwidgetwindow)
> 
> EXECUTE_PROCESS(
> 	COMMAND osgversion --version-number
> 	OUTPUT_VARIABLE OSG_VERSION
> 	OUTPUT_STRIP_TRAILING_WHITESPACE
> )
> 
> # Our osgdb_osgWidget loader.
> ADD_SUBDIRECTORY(src/osgPlugins/osg)
> # ADD_SUBDIRECTORY(src/osgPlugins/style)
> 
> IF(WIN32)
> 	TARGET_LINK_LIBRARIES(osgWidget opengl32.lib)
> 
> 	ADD_DEFINITIONS(-DOSG_LIBRARY)
> 
> 	INSTALL(TARGETS osgWidget RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
> ENDIF(WIN32)
> 
> CONFIGURE_FILE(
> 	"${CMAKE_CURRENT_SOURCE_DIR}/etc/uninstall.cmake"
> 	"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
> 	IMMEDIATE @ONLY
> )
> 
> ADD_CUSTOM_TARGET(uninstall
> 	"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
> )
> _______________________________________________
> 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