The usual way to create Ogre from a source is:
Get a new Ogre self-extractor (these instructions are for Ogre version 1.7.3)
Download and install CMake
Download and install the DirectX SDK
Create a folder named "OGRE" on the disk with a minimum size of 4.3 GB.
Extract the ogre source to the OGRE folder. Download the Ogre dependencies and extract them to the OGRE folder. Launch CMake and select Visual Studio 10 as the default compiler.
Specify the source directory of Ogre. This is the ogre_src_v1-7-3 folder. Also set the OGRE_HOME environment variable in the windows to the full path ogre_src_v1-7-3. (install it by right-clicking on my computer, properties, additional, environment variables, user variables, new) Specify the directory for CMake to host the generated binaries. You can create a directory called "Binaries" in the OGRE folder.
Click "configure" in CMake.
It will display a lot of red posted entries. For the OGRE_DEPENDENCIES_DIR entry, specify the path to the dependency folder that you extracted above.
Click configure again and all of these red lines will turn white, which means that the configuration works fine.
Click generate.
What is it with CMake.
Go to the binaries folder and you will see OGRE.sln. Double-click it to open it in VS2010.
Either right-click the “ALL-BUILD” project and create or press F5 (if you press F5, when the assembly is completed, it will say that it cannot work, which is normal, because the entire assembly is not intended to run)
The assembly process will take about 30 minutes on a dual-core PC with a frequency of 2 GHz with 1 GB of RAM.
Set the Sample Browser project as the active project and press F5 to start it.
It! Ogre is configured on your system.
==================================================== ====
But if you are having trouble building:
To avoid a lot of problems, make sure that you get the Ogre source code as the original folder / zip file / self-extractor from the Internet and the DirectX SDK is installed on your computer. Create a folder on your system for Ogre and save the source folder there. Upon completion, the Ogre source, binaries, and embedded files fully occupy about 4.3 GB of disk space.
[Attention! Do not install Visual Studio 2008 on your system. If you did this, and if it caused problems (fatal error C1902: program database manager does not match, check your installation) when creating ogre.sln, just delete the mspdb100.dll file if you are building VS2010. (It is not confirmed whether the problem is really related to installing VS2008.This may be due to one step written in this very file where mspdb100.dll is copied to a folder where this should not be. Re building Ogre with VS2008, and it shows "fatal error" and then removing mspdb80.dll is a solution)]
Extract the Ogre source to a folder on your system. It's nice to have a directory path:
"your-root \ Ogre \ Binaries \" for binary files
and
* "your-root \ Ogre \ ogre_src_v1-7-3 \" * for the source
CMake
Download and install CMake, which helps you configure Ogre to install on your system.
Run the CMake executable.
Select "Add cmake to PATH for the current user."
Find the place where cmake was installed and run \ CMake 2.8 \ bin \ cmake-gui.exe
Specify directories for binary files and source.
Click the "advanced" checkbox in the CMake GUI
Install CMAKE_CXX_COMPILER on your-Visual-Studio-installation path /VC/bin/cl.exe
Install CMAKE_C_COMPILER on your-Visual-Studio-installation path /VC/bin/cl.exe
Install CMAKE_RC_COMPILER in any path-your-RC.exe file-is-in / RC.Exe (search in the "Program Files" folder and you will most likely find rc.exe)
Click "configure" and this may cause an error that it could not find mspdb100.dll
Copy the mspdb100.dll file from your-Visual-Studio-installation path \ Common7 \ IDE and paste it into your-Visual-Studio-installation path \ VC \ bin (not the right way to do this, but ok ...; This file , which you later may need to be removed if an error is displayed during the Ogre build process, such as "database manager mismatch")
After completing the settings, click “generate”, which will generate either the ogre.sln file or the “.dsw” file, which when you click on it will create your ogre.sln file. See below for more details. Note: Cmake supports cache. To reconfigure cmake at any time, you need to clear the cache. Cmake 2.8 has the ability to clear the cache in the menu. If you installed cmake 2.6.4, you can clear the cache with the button at the bottom of the window. Once you clear the cache, you can choose your compiler. I chose VS2006 and did not change any option for my own compiler. Just left it as it is.
Note2: When I installed Visual C ++ 2006, the C and C ++ compilers can now compile the cmake test file, but cmake cannot find the specific DLL that is in the bin folder ogre_src_v1-7-3. He was browsing the \ tpcsed.com \ projectshare \ mapex \ OGRE3D folder, so I copied the bin folder to the \ tpcsed.com \ projectshare \ mapex \ OGRE3D folder. Then everything went fine.
If your version of Visual Studio cannot complete the configuration described above, you may need to install VS2006 to be able to specify the correct c1.exe and rc.exe files. VS2010 c1.exe and rc.exe did not work for me.
To compile any dependencies:
Extract OgreDependencies_MSVC_20101231.zip Goto the-root \ Ogre \ ogre_src_v1-7-3 \ Dependencies \ src Open OgreDependencies.VS2010.sln with VS2010 (or the sln file that matches your VS) Right-click on the solution and create a debugging solution and create a debug solution (right-click> Properties> Configuration> Configuration Manager Button> Layout the configuration of the active solution)
Ogre building:
Click the file your-root \ Ogre \ ogre_src_v1-7-3 \ bin \ ogre.dsw and make sure that it opens in the version of VS that you are using. In my case, it was VS2010 (if you used VS2006 in CMake, you will have a dsw file that will convert the solution to your version of VS)
The ogre.sln file will be created. Double click on it. Right-click the ALL_BUILD project and select Build. You should do this for both Release and Debug, but doing this for debugging was enough for me (for now).
Right-click the INSTALL project and select Build. You should do this for both Release and Debug, but doing this for debugging was enough for me (for now).
Either follow the above 2 steps, or just click "Clear" and build the whole solution.
If you find errors, search for projects that failed to build, read the errors, and fix them. All projects should be successfully built, at least for debugging.
If the builds fail, clean the projects and rebuild them. Or start again with the cmake step.
If there are build errors, find out why this happens by looking at the errors listed. Perhaps this is due to the fact that you did not install the DirectX SDK on your system or due to an incorrect path in the properties of ogre.sln projects. Check all values to make sure all paths are correct.
It!
Additional dependencies such as TBB, Boost, etc. I did not try to install. Ogre works without him.
Running:
Try the small Ogre app. The simplest one you can run:
#include <Ogre.h> //code is from http://blog.tidalware.com/2009/06/ogre-and-visual-studio-beginners-faq/ int main(int argc, char* argv[]) { Ogre::Root* root = new Ogre::Root("plugins.cfg", "ogre.cfg", "Ogre.log"); delete root; return 0; }
Right-click on the solution, specify the inclusion path to the headers that you used in your program.
In the configuration settings> general> character set, specify it as "Use multibyte character set". This prevents errors due to the old wchar typedef.
If necessary, specify additional library directories for the linker. In Linker> Input add OgreMain_d.lib; OIS_d.lib for Ogre and if using OpenGL add "opengl32.lib; glu32.lib"
If you encounter other problems, check to see if your working directory matches your output directory.
It! Your program should build and compile.
Some errors that may occur when starting your program: If OgreMain_d.dll is not found, just find it in the Ogre soure directory and paste it into the Debug directory of the project. You may need to copy many other Ogre resource files to the Debug project directory (depending on which of these files is required for your program) for portability reasons.
To view the paths of variables such as $(TargetPath)
, etc., simply click on the combo box that appears when you click on any of the property values and a small dialog box will open. Click and select "Macros →" to see values / paths.
It helps to set the Windows OGRE_HOME environment variable. Right-click My Computer, select Properties> Advanced> Environment> System Variables> Create.
Create a new environment variable named OGRE_HOME and give it a value that is the path to the Ogre source folder ogre_src_v1-7-3. You can use this variable in VS whenever you specify paths. You can use it as $(OGRE_HOME)
.
Please add additional information to this file if you have done something more or found errors and found a solution for this.
My colleagues helped a lot during this build. I got more help from here: http://blog.tidalware.com/2009/08/building-ogre-with-visual-studio/
and here: http://blog.tidalware.com/2009/06/ogre-and-visual-studio-beginners-faq/
and on the official Ogre website. You will also get a lot of help finding Google. Especially when you encounter build errors.
The best brave developer !:-)