Programmation:Compiler Ogre3D sous linux
- Hardware: Intel i7, NVidia GTX 980
- OS: Linux Mint 17.3 64bits
Getting the source
Installation of TortoiseHG
$ sudo apt-get install tortoisehg
Getting source code from bitbucket.
After cloning the repository locally:
Obviously, Ogre needs a lot of things. complete tuto.
$ sudo apt-get install build-essential automake libtool libfreetype6-dev libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev nvidia-cg-toolkit libois-dev libboost-thread-dev doxygen graphviz libcppunit-dev
This step will take several minutes. I recommend using CMake with UI.
$ sudo apt-get install cmake-qt-gui
Create a build folder somewhere.
$ mkdir ~/ogre_build/
Open CMake-QT and configure it. full tuto here
- source: folder containing the main CMakeList.txt
- build: compilation folder
The build folder should now contains a Makefile at the root.
$ cd ~/ogre_build/ $ make $ sudo make install
The make process is long.
Create a ogre_example folder. I'm working in a folder named forge.ogre.
$ cd ~/forge.ogre/ $ mkdir ogre_example
Create 2 subfolders, one for source, the other to build.
$ cd ogre_example $ mkdir ogreapp $ mkdir ogreapp_build
- Open clean_ogre_cmake_project_1-10.zip and decompress these files in ogreapp folder
- Open dist.tar.bz2 and decompress the folder dist in ogreapp folder
Open CMakeUI and position path as follow:
- source: ogreapp (containing the CMakeLists.txt)
- build: ogreapp_build
hit Configure and Generate
Compile the example.
$ cd ogreapp_build $ make $ make install
Using make install is crucial to copy configurations to the build folder.
$ cd dist/bin/ $ ./OgreApp
Installation of netbeans
Go to netbeans.org and download the latest C++ version for your architecture.
Once done, launch it and verify that the CMake tool is accessible. Tools > Options > C/C++ > Build tools.
If the CMake Command is empty, locate the executable on your drive, usually at /usr/bin/cmake.
Apply and close the Options panel.
Importing the example
Before importing, verify that you have called make install in the build folder. The application will crash if the dist folder is only containing the runnable.
Go to File > New project
Select C/C++ Project with Existing Sources and press Next
Select the root folder of the project (the one containing the source folder and the build folder), choose Custom configuration mode and press Next.
- Check Pre-BuildStep is Required
- Set the run folder to ogreapp_build/
- Select Predefined Command
- Set Script_type to CMake (CMakeList.txt)
- Set the script to ogreapp/CMakeList.txt
And press Next.
Set the Working directory to ogreapp_build and press Next until the Finish button shows up. Press it also.
Once the configuration panel closed, netbeans will start to compile the project. It will be quick.
- right-click on the project icon in the Projects panel and select Project properties;
- go to Run;
- set the Run directory to ogreapp_build/dist/bin/;
- and Apply.
If the compilation is successful, launch the application by pressing on the green arrow in the top toolbar.
A confirmation panel pops-up, the path to the executable should be OgreApp.
- Ogre Empty Example in bitbucket