Compiling Ogre3D V2.1 for dummies

来源:互联网 发布:mysql limit 动态参数 编辑:程序博客网 时间:2024/05/24 05:31
I've got a new PC and jumped on the 2.1 train. I know that several people already posted some info, but I decided to describe the process step by step. I've added it to the forum and not on the wiki, because I expect that things will change:

Preconditions: 
:arrow: Base system is Windows 10
:arrow: Visual Studio Community Free 2015 is used for compilation (64 bit)
:arrow: These instructions only apply to Ogre3D V2.1

DirectX:
If you want to use DirectX in Ogre3D, the 'Windows Software Development Kit (SDK) for Windows 10' is required.
Mandatory for compiling SDL2 however, is the use of the DirectX Software Development Kit 'DirectX 9 SDK (DX SDK June 2010)'; this version is not used by
Ogre3D V2.1 (because it doesn't use DirectX 9 anymore), but it is only used for SDL2 :( 
:arrow: 1. Get the Windows Software Development Kit (SDK) for Windows 10 from https://dev.windows.com/en-us/downloads/windows-10-sdk
:arrow: 2. Download 'sdksetup.exe' and install the SDK (this will take some time)
:arrow: 3. Get the DirectX Software Development Kit from https://www.microsoft.com/en-us/download/confirmation.aspx?id=6812; this is the 'DirectX 9 SDK (DX SDK June 2010)'
:arrow: 4. Run the downloaded 'DXSDK_Jun10.exe'
:arrow: 5. This results in an error 'Setup failed'. Just ignore it and press 'Finish'.


Get Visual Studio Community Free 2015 and install it:
:arrow: 1. Download 'Visual Studio Community Free' from https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx
:arrow: 2. Run 'vs_community_ENU.exe' (installation takes about half and hour)


Get Ogre 3D V2.1:
The easiest way to download Ogre3D is to grab the zip file directly from Bitbucket.
:arrow: 1. Go to https://bitbucket.org/sinbad/ogre/downloads
:arrow: 2. Select the tab 'Branches'
:arrow: 3. Download branch 'v2-1'
:arrow: 4. This downloads file 'sinbad-ogre-xxxxxxxxxxxx.zip'
:arrow: 5. Create a subdirectory in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects' named 'Ogre2.1'
Use your own name as a replacement for 'LoggedInUser'
:arrow: 6. Extract the zip file (everything in 'sinbad-ogre-xxxxxxxxxxxx') in the directory 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1'
So, do not include 'sinbad-ogre-xxxxxxxxxxxx'.


Get the dependencies:
:arrow: 1. Make a subdirectory in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1' named 'Dependencies'
:arrow: 2. Download the dependencies from 'https://bitbucket.org/cabalistic/ogredeps/downloads'
:arrow: 3. Select the tab 'Branches'
:arrow: 4. Download 'default'; this downloads the file 'cabalistic-ogredeps-zzzzzzzzzzzz.zip'
:arrow: 5. Extract the content of this file in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies'
:arrow: 6. Get SDL from 'https://www.libsdl.org/download-2.0.php'. To be sure, compile it yourself. Download 'SDL2-2.0.3.zip - GPG signed' (this is currently the highest version)
:arrow: 5. Extract the content of this file in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src'
:arrow: 6. Rename the subdir 'SDL2-2.0.3' to 'SDL2' to please CMake
The structure in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\' is:
AMD_Quad_Buffer_SDK_v11
Cg
FreeImage
freetype
NVAPI-R313-developer
ois
SDL2
zlib
zziplib
CMakeLists.txt


Get CMake and install it:
:arrow: 1. Download CMake from https://cmake.org/
:arrow: 2. No 64 bit installer was provided, so the 32 bit version was downloaded (cmake-3.4.1-win32-x86.exe)
:arrow: 3. Install 'cmake-3.4.1-win32-x86.exe'


Compile the dependencies:
:arrow: 1. Start CMake
:arrow: 2. Fill in for 'where is the source code' the path 'C:/Users/LoggedInUser/Documents/Visual Studio 2015/Projects/Ogre2.1/Dependencies'
:arrow: 3. Fill in for 'where to build the binaries' the path 'C:/Users/LoggedInUser/Documents/Visual Studio 2015/Projects/Ogre2.1/Dependencies'
:arrow: 4. Press button 'Configure'
:arrow: 5. Select for 'Specify the generator for this project' the appropriate compiler; in this case it is 'Visual Studio 14 2015 Win 64'
:arrow: 6. Set radiobutton to 'use default native compilers' and press button 'Finish' (if you get errors because it cannot find the compiler (CMAKE_CXX_COMPILER), use 'specify native compilers')
:arrow: 7. Notice that all lines are red. Just press 'Configure' again. The lines are blank now
:arrow: 8. Press button 'Generate'
:arrow: 9. Start 'Visual Studio 2015'
:arrow: 10. Open the solution located in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\OGREDEPS.sln'
:arrow: 11. Build the solution (both Debug and Release, both in x64).

Note, intially the build resulted in '========== Build: 6 succeeded, 2 failed, 0 up-to-date, 0 skipped =========='

One error was:
'CUSTOMBUILD : *** error : DIRECTX requires the $DXSDK_DIR environment variable to be set'.
This can be ignored, and it was because 'Windows Software Development Kit (SDK) for Windows 10' does not set the DXSDK_DIR environment variable.
It was part of 'DirectX 9 SDK (DX SDK June 2010)', which was not installed during the first attempt.

The other error was in freeimage:
'C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration'
I've updated the file 'tif_config.h' and commented the following lines from line 85:
#ifdef _WIN32
#define snprintf _snprintf
#define lfind _lfind
#endif // _WIN32
This had to be done manually, because an incorrect version of the Dependecies was used; the 'default' branch of the dependencies did not result in this error.


:arrow: 12. OIS_d.dll and OIS.dll are in C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\bin\... When running an Ogre3D sample, this results in an error, because it cannot find the dll files.
For convenience, copy the 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\bin\' directory to 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\bin\src\'

Compile SDL2 separately:
SDL2 is not compiled as part of the compilation of the OGREDEPS.sln solution. Just compile it separately:
:arrow: 1. Start 'Visual Studio 2015' (if not yet started)
:arrow: 2. Open the solution located in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\VisualC\SDL_VS2013.sln'
:arrow: 3. Visual Studio 2015 automatically upgrades the 2013 solution
:arrow: 4. Build the solution (both Debug and Release, both in x64).


Compile Ogre3D:
:arrow: 1. Start CMake (do not forget to clear the cache by means of File > Delete Cache)
:arrow: 2. Fill in for 'where is the source code' the path 'C:/Users/LoggedInUser/Documents/Visual Studio 2015/Projects/Ogre2.1'
:arrow: 3. Fill in for 'where to build the binaries' the path 'C:/Users/LoggedInUser/Documents/Visual Studio 2015/Projects/Ogre2.1/VCBuild'
:arrow: 4. Press button 'Configure'. Choose for button 'Yes' on the question 'Build directory does not exist; should I create it?'
:arrow: 5. Select for 'Specify the generator for this project' the appropriate compiler; in this case it is 'Visual Studio 14 2015 Win 64'
:arrow: 6. Set radiobutton to 'use default native compilers' and press button 'Finish'
:arrow: 7. Notice that some lines are red and an error is displayed 'error in configuration process; project files may be invalid'. This is because it cannot find SDL2MAIN_LIBRARY, SDL2_INCLUDE_DIR and SDL2_LIBRARY_TEMP
CODE: SELECT ALL
   Set the following values to these items:   SDL2MAIN_LIBRARY = C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\VisualC\SDLmain\x64\Release\SDL2main.lib   SDL2_INCLUDE_DIR = C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\include   SDL2_LIBRARY_TEMP = C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\VisualC\SDL\x64\Release\SDL2.lib

:arrow: 8. Check 'OGRE_BUILD_SAMPLES2'
:arrow: 9. Uncheck 'OGRE_INSTALL_SAMPLES'
:arrow: 10. Press 'Configure' until all lines are blank
:arrow: 11. Press button 'Generate'
:arrow: 12. Start 'Visual Studio 2015' (if not yet started)
:arrow: 13. Open the solution located in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\VCBuild\OGRE.sln'
:arrow: 14. Build the solution (both Debug and Release, both in x64).

Run Ogre3D:
:arrow: 1. Apparently, SDL2.dll was not copied, so manually copy 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\Dependencies\src\SDL2\VisualC\SDL\x64\Release\SDL2.dll' to
'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\VCBuild\bin\Debug\' and 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\VCBuild\bin\Release\'
:arrow: 2. Run the samples in 'C:\Users\LoggedInUser\Documents\Visual Studio 2015\Projects\Ogre2.1\VCBuild\bin\Release\'
0 0
原创粉丝点击