Re: [osg-users] [build] how to build basicGeometry example?

2009-10-29 Thread Mathieu MARACHE
Hi Thomas,

you need to do a couple of things, first take a copy of the
CMakeModules folder of OSG itself :
http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/CMakeModules

Then you need to tell CMake via your CMakeLists.txt where to find those

set(CMAKE_MODULE_PATH PATH_TO/CMakeModules;${CMAKE_MODULE_PATH})

# this will include and run CMakeModules/FindXXX.cmake
find_package(OpenThreads)
find_package(OSG)
include_directories(${OSG_INCLUDE_DIR})
project(testProject)
add_executable(testProjectMain
 main.cpp
)
target_link_libraries(testProjectMain ${OSG_LIBRARY} ${OPENTHREADS_LIBRARY})

HTH

--
Mathieu
O ascii ribbon campaign - stop html mail - www.asciiribbon.org



2009/10/26 Thomas Maier in...@web.de:
 Hi,

 i used the source code on this site 
 http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicGeometry,
  then i build test-src/ and test-build/ directories. Into test-src/ dir i put 
 in the file main.cpp with the example code. Then i created a CMakeLists.txt 
 file and put into it:
 PROJECT(testProject)
  ADD_EXECUTABLE(testProjectMain
   main.cpp
  )

 then i switched into test-build/ dir and run ccmake ../test-src/ then i run 
 make and the output is:
 Linking CXX executable /tmp/testProjectMain
 /usr/bin/cmake -E cmake_link_script CMakeFiles/testProjectMain.dir/link.txt 
 --verbose=1
 /usr/bin/c++   -g   CMakeFiles/testProjectMain.dir/main.o  -o 
 /tmp/testProjectMain -rdynamic
 CMakeFiles/testProjectMain.dir/main.o: In function `main':
 /home/bob/openscenegraph-programming/test/test-src/main.cpp:27: undefined 
 reference to `osgViewer::Viewer::Viewer()'
 /home/bob/openscenegraph-programming/test/test-src/main.cpp:28: undefined 
 reference to `osg::Group::Group()'


 How can i let cmake know that it should use osg header/libs? Is there 
 anywhere online a tutorial which explains the building of e.g. the examples? 
 i did not find anything,sorry.

 thanks for help
 flo




 Thank you!

 Cheers,
 inflo

 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=18735#18735





 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] how to build basicGeometry example?

2009-10-29 Thread J.P. Delport

Hi,

it seems like it found the headers and is breaking on linking.

I attach a CMakeLists.txt I use for simple test apps. It assumes OSG is 
installed and the linker can find it (e.g. mine is installed in 
/usr/local and /usr/local/lib is added in /etc/ld.so.conf).


You could also have a look at FindOSG module in the latest cmake versions.

jp

--8---
PROJECT(test)

#SET(CMAKE_CXX_COMPILER g++-3.4)

SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -g)
#SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -O2)

SET(SOURCES
test.cpp
)

INCLUDE_DIRECTORIES(/usr/local/include)
LINK_DIRECTORIES(${CMAKE_SOURCE_DIR})

ADD_EXECUTABLE(test ${SOURCES})

TARGET_LINK_LIBRARIES(test m osg osgUtil osgGA osgDB osgText osgSim 
osgParticle OpenThreads rt)


Thomas Maier wrote:

Hi,

i used the source code on this site 
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicGeometry,
 then i build test-src/ and test-build/ directories. Into test-src/ dir i put 
in the file main.cpp with the example code. Then i created a CMakeLists.txt 
file and put into it:
PROJECT(testProject)
 ADD_EXECUTABLE(testProjectMain
   main.cpp
 )

then i switched into test-build/ dir and run ccmake ../test-src/ then i run 
make and the output is:
Linking CXX executable /tmp/testProjectMain
/usr/bin/cmake -E cmake_link_script CMakeFiles/testProjectMain.dir/link.txt 
--verbose=1
/usr/bin/c++   -g   CMakeFiles/testProjectMain.dir/main.o  -o /tmp/testProjectMain -rdynamic 
CMakeFiles/testProjectMain.dir/main.o: In function `main':

/home/bob/openscenegraph-programming/test/test-src/main.cpp:27: undefined 
reference to `osgViewer::Viewer::Viewer()'
/home/bob/openscenegraph-programming/test/test-src/main.cpp:28: undefined 
reference to `osg::Group::Group()'


How can i let cmake know that it should use osg header/libs? Is there anywhere 
online a tutorial which explains the building of e.g. the examples? i did not 
find anything,sorry.

thanks for help
flo




Thank you!

Cheers,
inflo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18735#18735





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] how to build basicGeometry example?

2009-10-29 Thread Thomas Maier
Hi,

thanks for the help. I am on debian there it seemed i must use lower-case 
find_package(osg), not OSG.

the line 
target_link_libraries(testProjectMain ${OSG_LIBRARY} ${OPENTHREADS_LIBRARY})

works with OpenThreads , but ${OPENTHREADS_LIBRARY} it cannot find


Thank you!

Cheers,
Thomas

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18884#18884





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org