[Edit]:In hind site. To run through the tutorial, I found it far easier to just create a project from the code::blocks template.
Only thing with that was that I ran into a weird linker thing going on if I removed the pre-created main.cpp in one folder and used in another. Once I understood what was going on no big deal. http://forums.codeblocks.org/index.php/topic,14770.0.html
I can see the Cmake coming in handy for deployment, but is more of an irritant to me at development
[/Edit]
I’ve been trying to get that darn funguloids to work in Linux so far without success. Something seems to be going south within Ogre, perhaps because of version updates? I’ve never really played with Ogre so I thought it would be worth my while to run through the Ogre Tutorials.
I made it through setting up an application as well as basic tutorial 1.
On tutorial 2 I wanted to setup a new project and decided that it would be helpful on setting up a cheat sheet on how to get a project going so I wouldn’t have to navigate through all kinds of menus. For this go around I thought I use the cmake method for tutorial1 and use it on tutorial 2. At this point, my impressions is that this is a pain but at least I’ll have my notes set up for tutorial3 and I can see if I want to do this again.
Get the Ogre Wiki Tutorial Framework and put the four files in a directory:
- ogreapp
- CMakeLists.txt (see below)
- BaseApplication.h
- BaseApplication.cpp
- TutorialApplication.h
- TutorialApplication.cpp
Ok.. Now on “tutorial 2” authors want you build as you go, except that the code::blocks project example assumes what you have your existing source files and has the make file in the project. (I’m not used to using an external makefile in code::blocks,(maybe this isn’t as bad as I think it is) So… I guess I’ll go with this by setting up the minimal as they specified.:
BasicTutorial2.h
BasicTutorial2.cpp
Just thinking ahead a bit, I’m going to also copy over the main routine and through it into its own separate file.
So basically my starting point looks like this:
jonas@jonas5:~/OgreTutorials/BasicTutorial2$ ls -l
total 40
-rw-r–r– 1 jonas jonas 13504 2010-12-31 19:37 BaseApplication.cpp
-rw-r–r– 1 jonas jonas 3158 2010-12-31 19:37 BaseApplication.h
-rw-r–r– 1 jonas jonas 1024 2011-05-25 06:53 BasicTutorial2.cpp
-rw-r–r– 1 jonas jonas 231 2011-05-25 06:52 BasicTutorial2.h
-rw-r–r– 1 jonas jonas 5920 2011-05-16 21:11 CMakeLists.txt
-rw-r–r– 1 jonas jonas 752 2011-05-25 06:55 main.cpp
jonas@jonas5:~/OgreTutorials/BasicTutorial2$
I needed to make the following edits to CMakeLists.txt
set(HDRS
./BaseApplication.h
#./TutorialApplication.h
./BasicTutorial2.h)
set(SRCS
./BaseApplication.cpp
#./TutorialApplication.cpp
./BasicTutorial2.cpp
./main.cpp
)
ooking at:
Setting Up An Application – CodeBlocks – Linux
Points me here first: Building Your Projects With CMake
I’m not sure if this is considered or bad practise but, I’ve been wanting to keep everything together so, I’ve been creating a BasicTutorial2_build folder under the BasicTutorial2 just to keep everything tidy.
Next steps:
How To Use It
After having created your OgreApp source directory, and populated it with the four files from the Ogre Wiki Tutorial Framework and the CMakeLists.txt file, plus the ‘dist‘ directory, you are now ready to build it using CMake.
- Open CMake-Gui, choose your source directory (‘ogreapp‘) and a build directory (‘ogreapp_build‘).
- Click ‘Configure‘, choose a generator.
- Click ‘Configure‘ again if CMake ran without fatal errors.
- Click ‘Generate‘.
- Navigate to your ‘ogreapp_build‘ directory.
I guess I’m supposed to create a directory called “dist” in the source directory.. Ok. Did that.
I found that “cmake-gui” works from the command line. Not CMake-Gui.
(I need to clear the cache out from my previous project)
Clicked configure (Accepted default generatror aka CodeBlocks-Unix Make files) with “Use default native compiler.
It seems to have run ok… so click configure again, then generate…. Oh dang… I get some complaints that “TutorialApplication.h” can’t be found… That implies that CmakeLists is not generate.. (which I just fixed in my notes above
jonas@jonas5:~/OgreTutorials/BasicTutorial2$ cd BasicTutorial2_build
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build$ ls
Basic_Project.cbp CMakeFiles dist
CMakeCache.txt cmake_install.cmake Makefile
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build$
It seems as if I have a code::blocks project file, I guess I’ll click on it it from Nautilus file browser and see if she fires up…
‘A bunch of compiler errors, nothing to earth shaking..
Once I got done with the compiler errors I got this message:
You can’t “run” a commands-only target…
I spent a while googling trying to figure out what the heck that meant, but it has to do with the build options.
Navigate Project->Properties and select the build target tab.
If you select “all” in the build targets column and you see it says commands only.
I just won’t up deleted all so Orge/app was on top.
At this point, I managed to get the application to compile, but it appears like nothing is happening… Actually I believe Ogre started up and then shut down.
The problem was that I needed to add the resources.cfg and the plugins.cfg to the same folder as the executable.
You can figure that out reading the Ogre.log that’s with the compiled executable:
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build$ cd dist
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build/dist$ cd bin
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build/dist/bin$ ls
OgreApp Ogre.log
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build/dist/bin$ cp /usr/local/share/OGRE/resources.cfg resources.cfg
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build/dist/bin$ cp /usr/local/share/OGRE/plugins.cfg plugins.cfg
jonas@jonas5:~/OgreTutorials/BasicTutorial2/BasicTutorial2_build/dist/bin$ ./OgreApp
At this point, I need to select the Opengl renderer and Fullscreen as no.
I managed to get a view screen but when I did anything with the mouse I got a segmentation fault. Considering that I basically have empty BasicTutorial2.cpp and BasicTutorial2.h in order to work through the tutorial.
Next tutorial I think I’ll try using the code::blocks template and see how that goes.