Hello Carsten,
I think I have a working solution:
The first patch simply adds the boost libraries to the lib and include
directories of OSGBase.
--- OpenSG-2.0.0-pre1-svn2480-pristine/Source/Base/CMakeLists.Lib.OSGBase.txt
2010-05-19 15:30:54.776454449 +0200
+++ OpenSG-2.0.0-pre1-svn2480/Source/Base/CMakeLists.Lib.OSGBase.txt
2010-08-25 15:13:39.441958778 +0200
@@ -11,9 +11,9 @@
# SET(${PROJECT_NAME}_DEP_TEST_OSG_LIB)
# dependencies - External
-SET(${PROJECT_NAME}_DEP_LIB OSG_DL_LIB OSG_THREAD_LIB)
+SET(${PROJECT_NAME}_DEP_LIB OSG_DL_LIB OSG_THREAD_LIB OSG_BOOST_LIBS)
# SET(${PROJECT_NAME}_DEP_LIBDIR)
-# SET(${PROJECT_NAME}_DEP_INCDIR)
+SET(${PROJECT_NAME}_DEP_INCDIR OSG_BOOST_INCDIRS)
# SET(${PROJECT_NAME}_DEP_TEST_LIB)
# SET(${PROJECT_NAME}_DEP_TEST_LIBDIR)
The second patch prevents entries like "OSG_ZLIB_LIBRARY_TARGET" from
showing up in osg2-config. It replaces every entry in DEPLIBS which is
registered as a cmake target with the name of the corresponding library:
--- OpenSG-2.0.0-pre1-svn2480-pristine/CMake/BuildFunctions.cmake
2010-05-19 15:30:52.240485458 +0200
+++ OpenSG-2.0.0-pre1-svn2480/CMake/BuildFunctions.cmake 2010-08-30
13:32:59.099648696 +0200
@@ -376,6 +376,34 @@
" \"dep_lib\" : [")
FOREACH(LIB ${DEPLIBS})
+ # if LIB is a target, get location:
+ IF(TARGET ${LIB} )
+ # TODO: how do we know when to use
IMPORTED_LOCATION_(RELEASE|DEBUG|..)?
+ GET_TARGET_PROPERTY(_DEPLIB_LOCATION ${LIB}
IMPORTED_LOCATION )
+
+ # set LIB to basename of library name:
+ STRING(REGEX REPLACE ".*/(.*)" "\\1" LIB
"${_DEPLIB_LOCATION}" )
+ # note: it is assumed that DEPLIBDIRS already contains
the library directory
+
+ # strip library prefix from LIB ("libfoo.so" ->
"foo.so"):
+ GET_TARGET_PROPERTY(_DEPLIB_PREFIXES ${LIB}
IMPORT_PREFIX )
+ IF(NOT _DEPLIB_PREFIXES )
+ # target-prefix not set -> use default prefixes
+ SET(_DEPLIB_PREFIXES
${CMAKE_FIND_LIBRARY_PREFIXES})
+ ENDIF(NOT _DEPLIB_PREFIXES )
+ FOREACH(PREFIX ${_DEPLIB_PREFIXES})
+ STRING(REGEX REPLACE "^${PREFIX}(.*)$" "\\1"
LIB ${LIB})
+ ENDFOREACH(PREFIX)
+ # strip library suffix from LIB ("foo.so" -> "foo"):
+ GET_TARGET_PROPERTY( _DEPLIB_SUFFIXES ${LIB}
IMPORT_SUFFIX )
+ IF(NOT _DEPLIB_SUFFIXES )
+ # target-suffix not set -> use default suffixes
+ SET(_DEPLIB_SUFFIXES
${CMAKE_FIND_LIBRARY_SUFFIXES})
+ ENDIF(NOT _DEPLIB_SUFFIXES )
+ FOREACH(SUFFIX ${_DEPLIB_SUFFIXES})
+ STRING(REGEX REPLACE "^(.*)${SUFFIX}$" "\\1"
LIB ${LIB})
+ ENDFOREACH(SUFFIX)
+ ENDIF(TARGET ${LIB} )
FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
" \"${LIB}\", ")
ENDFOREACH(LIB)
And if you want, I have a third patch for you: it is a simplification of the
FindOpenSG.cmake changes I sent you before -- instead of querying the imported
library property, the newer version just asks if there already is a target with
the given name (and is more readable in my eyes). I didn't know before that
there
is a specific conditional for this purpose...
---
/jkuvrc/packages/OpenSG/OpenSG-2.0.0-pre1-svn2480/share/OpenSG/cmake/FindOpenSG.cmake
2010-08-24 18:27:06.000000000 +0200
+++ /home/edvz/zing/scratch/inVRs_OpenSG2/cmake/FindOpenSG.cmake
2010-09-01 17:02:26.352483180 +0200
@@ -196,16 +199,13 @@
FOREACH(COMPONENT ${OpenSG_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
- GET_TARGET_PROPERTY(__OpenSG_COMPONENT_IMPORTED ${COMPONENT} IMPORTED)
-
- IF(NOT __OpenSG_COMPONENT_IMPORTED)
- # avoid setting up componentes more than once - which is not
- # allowed for import libraries
- __OpenSG_ADJUST_LIB_VARS(${UPPERCOMPONENT} ${COMPONENT})
- SET(OpenSG_LIBRARIES ${OpenSG_LIBRARIES}
${OpenSG_${UPPERCOMPONENT}_LIBRARY})
-
- SETUP_OSG_LIB_TARGETS(${COMPONENT} ${UPPERCOMPONENT})
- ENDIF(NOT __OpenSG_COMPONENT_IMPORTED)
+ # only setup target, if target is not defined yet:
+ # (i.e. allow this script to be called twice without errors)
+ IF ( NOT TARGET ${COMPONENT} )
+ __OpenSG_ADJUST_LIB_VARS(${UPPERCOMPONENT} ${COMPONENT})
+ SET(OpenSG_LIBRARIES ${OpenSG_LIBRARIES}
${OpenSG_${UPPERCOMPONENT}_LIBRARY})
+ SETUP_OSG_LIB_TARGETS(${COMPONENT} ${UPPERCOMPONENT})
+ ENDIF ( NOT TARGET ${COMPONENT} )
ENDFOREACH(COMPONENT)
SET(OpenSG_INCLUDE_DIRS "${OpenSG_INCLUDE_DIR}"
"${OpenSG_INCLUDE_DIR}/OpenSG")
Cheers,
Johannes
>>> On 08/25/2010 at 14:33, "Johannes Zarl" <[email protected]> wrote:
> Hello Carsten,
>
>> However,
>>> the FindOpenSG script searches only for PREFIX/lib.
>>
>> This works fine here and I don't think it needs to be changed, cmake
>> handles the lib/lib64 thing internally. Most modules that come with it
>> don't have an explicit lib64 either.
>> Does it cause problems for you, can you give some more details?
>
> You are right, I just tried it again without the lib64 line and it works.
> So this is fine with me.
>
>> thanks for the patch, I've applied the change to only do the library
>> setup once in r2480.
>
> Thanks!
>
>>> I guess the boost-include-directory should show up here inside
>>> "dep_inc_dir"?
>>> How can I influence the value for this, so I can supply a patch?
>>
>> yes, osg2-config is not in very good shape unfortunately. The problem is
>> that some of the library dependencies are handled as imported library
>> targets and others just as regular libs. This makes writing the
>> information for osg2-config a bit tricky.
>> The osg2-config script is produced from three parts during a cmake run,
>> part 1 and 3 are in the CMake directory and part 2 is written from the
>> function OSG_STORE_PROJECT_DEPENDENCIES in CMake/BuildFunctions.cmake.
>> If you want to look into this it is probably a good idea to put
>> -DOSG_VERBOSE_BUILD_MESSAGES=ON on the cmake command line, this prints
>> information about the configuration of OpenSG libs.
>
> I will try your suggestions and get back to you once I have fixed the issue
> or I get stuck - whichever comes first ;-)
>
> Cheers,
> Johannes
--
Johannes Zarl
Virtual Reality Services
Johannes Kepler University
Informationsmanagement
Altenbergerstrasze 69
4040 Linz, Austria
Phone: +43 732 2468-8321
[email protected]
http://vrc.zid.jku.at
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users