|
Notes |
|
|
(0011784)
|
|
Philip Lowman
|
|
2008-05-09 14:18
|
|
I have no major issue with doing a FIND_PACKAGE() for all of the OSG node kits that I'm using. My biggest issue with the built in packages is that they don't find the MSVC debugged versions of the libraries if you're using MSVC so I have to get around this with a bit of a hack right now.
#
# A wrapper for TARGET_LINK_LIBRARIES() which lets the MPV link against
# MSVC debug libraries of the OSG when applicable and also warn users
# when they are missing.
#
MACRO(MPV_TARGET_LINK_OSG_LIBRARIES _target)
IF(MSVC)
FOREACH(_lib ${ARGN})
IF(EXISTS ${_lib})
# do a simple string replacement to obtain the debugged libname
STRING(REPLACE ".lib" "d.lib" _libd ${_lib})
IF(NOT EXISTS ${_libd})
SET(_MPV_warn_msvc_user true)
ELSE()
TARGET_LINK_LIBRARIES(${_target} debug ${_libd})
ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES(${_target} optimized ${_lib})
ENDFOREACH()
IF(_MPV_warn_msvc_user AND NOT _MPV_have_warned_msvc_user)
MESSAGE("WARNING: You do not have debug libraries of the OSG built
(osgd.lib, etc.)! Until you provide these debug libraries you
will not be able to build a Debug build of the MPV. Click OK to
acknowledge this.")
SET(_MPV_have_warned_msvc_user true CACHE INTERNAL "")
ENDIF()
ELSE()
TARGET_LINK_LIBRARIES(${_target} ${ARGN})
ENDIF()
ENDMACRO() |
|
|
|
(0014674)
|
|
Christian Ehrlicher
|
|
2009-01-23 01:46
|
|
I don't understand the problem here - wyh can't you use the cmake-provided 'debug' and 'release' keywords here like it's done in FindQt4.cmake. Searching for the debug version is done in kde4 with a helper macro ( http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/FindLibraryWithDebug.cmake [^] ). It's not very nice but it works fine for all our libs which have a debug prefix.
I've uploaded a FindOpenSceneGraph.cmake from me which works fine on Linux and Windows if you want to take a look :) |
|
|
|
(0014675)
|
|
Philip Lowman
|
|
2009-01-23 02:29
|
|
The new modules I checked into CVS a couple of days ago use the debug & release keywords. My complaint from 2008-05-09 was basically about the lack of debug & release support. :)
As for a consolidated FindOpenSceneGraph.cmake I'm working on one at the moment as well. Unfortunately we can't remove all of the various Findosg.cmake, FindosgDB.cmake, etc. modules from CMake but we can make a FindOpenSceneGraph.cmake include them as desired so they are at least reused.
Rather than assuming the user wants to use every nodekit in existence (which is definitely not the case where I work), I'm inclined more towards adding something like this:
FIND_PACKAGE(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil osgSim)
INCLUDE_DIRECTORIES(${OPENSCENEGRAPH_INCLUDE_DIRS})
ADD_EXECUTABLE(foo foo.cc)
TARGET_LINK_LIBRARIES(foo ${OPENSCENEGRAPH_LIBRARIES})
The user would need to define libraries in addition to "osg" and "OpenThreads" that they want to use, but the plus side is they would only have to do this on one line. Also there would be no ambiguous question regarding what to do if the user links against an older version of OSG that may not have a nodekit they need, like osgAnimation or osgShadow. If they specify osgAnimation in the REQUIRED line and it's not there simply issue a FATAL_ERROR.
The current means of doing the above (in latest CVS) is cumbersome and there is no version support.
FIND_PACKAGE(osg REQUIRED)
FIND_PACKAGE(osgDB REQUIRED)
FIND_PACKAGE(osgUtil REQUIRED)
FIND_PACKAGE(osgSim REQUIRED)
FIND_PACKAGE(OpenThreads REQUIRED)
INCLUDE_DIRECTORIES(${OSG_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OSGDB_INCLUDE_DIR}) # probably not needed unless an external library is being used
...
TARGET_LINK_LIBRARIES(foo ${OSG_LIBRARIES} ${OSGDB_LIBRARIES} ${OSGUTIL_LIBRARIES} ${OSGSIM_LIBRARIES} ${OPENTHREADS_LIBRARIES}) |
|
|
|
(0014676)
|
|
Christian Ehrlicher
|
|
2009-01-23 03:11
|
|
|
Good idea - cmake 2.6.x wasn't available while I wrote the initial version therefore I couldn't use the new possiblities :) |
|
|
|
(0014744)
|
|
Philip Lowman
|
|
2009-01-30 20:23
|
|
Checked a new FindOpenSceneGraph.cmake into CVS, see the documentation for details. It will be in CMake 2.6.3.
If you have any further suggestions please post to the mailing list or open additional feature requests / bugs. |
|
|
|
(0015303)
|
|
Philip Lowman
|
|
2009-02-23 22:39
|
|
|
Implemented in CMake 2.6.3 |
|