I' ve built your example using wxWidgets-2.8.0
I' ve done some patching , attache is the patch file:
I had to mod the macro, so other 2 examples are affected, that were
using command type of linking
Let me know if it works for you
Gian Lorenzetto wrote:
Hi all,
Just checked out the latest SVN and I’m having a few problems building
the wxWidgets example under Windoze.
Using WinXP, VS 7.1, plus totally new to CMake, so be kind …
PROBLEM 1:
During linking the following error occurs:
Examples osgsimpleviewerWX error LNK2019: unresolved external symbol
_main referenced in function _mainCRTStartup
you have to add WIN32 to the ADD_EXECUTABLE line, this is inside the
macros, so I have changed the line
ADD_EXECUTABLE(${TARGET_TARGETNAME} WIN32 ${TARGET_SRC} ${TARGET_H})
inside OsgMacroUtils.cmake
This let you specify the type of application,
This can be fixed by changing the /SUBSYSTEM:CONSOLE option to
/SUBSYSTEM:WINDOWS.
I don’t know how to do this in CMake. If someone can point me at an
example of what to do, I’ll patch and test …
PROBLEM 2:
wxWidgets requires certain pre-processor defines for correct
compilation. In the CMakeLists.txt file there is the line:
ADD_DEFINITIONS( ${wxWidgets_DEFINITIONS} )
which looks likely, but using CMakeSetup doesn’t let me edit the
“wxWidgets_DEFINITIONS” value. Is this just a place holder? Again, if
someone can point me at an example of what to do, I’ll patch with the
appropriate values …
The variable wxWidgets_DEFINITIONS is defined inside the
FindwxWidgets.cmake under the share\cmake-2.4\Modules folder of your
cmake installation folder.
You can see from the patch that I ' ve added the line
INCLUDE(${wxWidgets_USE_FILE})
to the CMakeLists.txt, this is something suggested inside comment in the
Find module, it should add the additional dir to both include and lib
paths and should also take care of adding proper definitions, for me it
worked
I ' ve also substituted cow.osg with argv[1]
Hope it helps
Luigi Calori
Index: applications/osgversion/CMakeLists.txt
===================================================================
--- applications/osgversion/CMakeLists.txt (revision 6682)
+++ applications/osgversion/CMakeLists.txt (working copy)
@@ -4,4 +4,8 @@
SET(TARGET_SRC osgversion.cpp )
#### end var setup ###
-SETUP_COMMANDLINE_APPLICATION(osgversion)
+IF(WIN32)
+ SETUP_EXAMPLE(osgversion)
+ELSE(WIN32)
+ SETUP_COMMANDLINE_EXAMPLE(osgversion)
+ENDIF(WIN32)
Index: CMakeModules/OsgMacroUtils.cmake
===================================================================
--- CMakeModules/OsgMacroUtils.cmake (revision 6682)
+++ CMakeModules/OsgMacroUtils.cmake (working copy)
@@ -144,7 +144,7 @@
ENDIF(NOT TARGET_LABEL)
IF(${IS_COMMANDLINE_APP})
- ADD_EXECUTABLE(${TARGET_TARGETNAME} ${TARGET_SRC} ${TARGET_H})
+ ADD_EXECUTABLE(${TARGET_TARGETNAME} WIN32 ${TARGET_SRC} ${TARGET_H})
ELSE(${IS_COMMANDLINE_APP})
IF(APPLE)
# SET(MACOSX_BUNDLE_LONG_VERSION_STRING
"${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
Index: examples/osgsimpleviewerWX/CMakeLists.txt
===================================================================
--- examples/osgsimpleviewerWX/CMakeLists.txt (revision 6682)
+++ examples/osgsimpleviewerWX/CMakeLists.txt (working copy)
@@ -2,11 +2,14 @@
SET(TARGET_H osgsimpleviewerWX.h )
-SET(TARGET_EXTERNAL_LIBRARIES ${wxWidgets_LIBRARIES} )
+MESSAGE(" wxWidgets_LIBRARIES-->${wxWidgets_LIBRARIES}<--")
+#SET(TARGET_EXTERNAL_LIBRARIES ${wxWidgets_LIBRARIES} )
-INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS} )
+#INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS} )
-ADD_DEFINITIONS( ${wxWidgets_DEFINITIONS} )
+#ADD_DEFINITIONS( ${wxWidgets_DEFINITIONS} )
+INCLUDE(${wxWidgets_USE_FILE})
#### end var setup ###
-SETUP_EXAMPLE(osgsimpleviewerWX)
+SETUP_EXAMPLE(osgsimpleviewerWX 1)
+TARGET_LINK_LIBRARIES("${TARGET_DEFAULT_PREFIX}osgsimpleviewerWX"
${wxWidgets_LIBRARIES})
Index: examples/osgsimpleviewerWX/osgsimpleviewerWX.cpp
===================================================================
--- examples/osgsimpleviewerWX/osgsimpleviewerWX.cpp (revision 6682)
+++ examples/osgsimpleviewerWX/osgsimpleviewerWX.cpp (working copy)
@@ -28,7 +28,7 @@
wxSize(200, 200), wxSUNKEN_BORDER);
// load the scene.
- osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("cow.osg");
+ osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(argv[1]);
if (!loadedModel)
{
return false;
Index: examples/osgunittests/CMakeLists.txt
===================================================================
--- examples/osgunittests/CMakeLists.txt (revision 6682)
+++ examples/osgunittests/CMakeLists.txt (working copy)
@@ -4,5 +4,8 @@
SET(TARGET_SRC UnitTestFramework.cpp UnitTests_osg.cpp osgunittests.cpp
performance.cpp )
SET(TARGET_H UnitTestFramework.h performance.h )
#### end var setup ###
-
-SETUP_COMMANDLINE_EXAMPLE(osgunittests)
+IF(WIN32)
+ SETUP_EXAMPLE(osgunittests)
+ELSE(WIN32)
+ SETUP_COMMANDLINE_EXAMPLE(osgunittests)
+ENDIF(WIN32)
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/