Code: Select all
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media' of type 'FileSystem' to resource group 'General'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/Main' of type 'FileSystem' to resource group 'OgreInternal'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/Terrain' of type 'FileSystem' to resource group 'OgreInternal'
Added resource location 'D:/Projects/Ogre3D/ogre/build/sdk/Media/RTShaderLib' of type 'FileSystem' to resource group 'OgreInternal'
Check the "resources.cfg" file if you can just change them there to relative. Otherwise, debug the code where this actually happens, because there is no need for absolute file paths.
I don't know how to link the sdk to my CMake Project
You should not add those files to visual studio that way, I would remove them if I were you.
Here is how I link my project to my built Ogre SDK built from source:
Project -> Properties -> C/C++ -> General -> Additional Include Directories:
C:\OgreSDK\include\OGRE
C:\OgreSDK\include\OGRE\Overlay
C:\OgreSDK\include
C:\OgreSDK\include\OGRE\MeshLodGenerator
Project -> Properties -> Linker -> General -> Additional Library Directories:
C:\OgreSDK\ogre\build\lib\$(Configuration)
C:\OgreSDK\ogre\build\Dependencies\lib
Then you also need to copy all the .dll files you want to use to where your .exe file is, and I use these (the _d are for your debug directory instead):
Code: Select all
Codec_STBI_d.dll
Codec_STBI.dll
OgreMain_d.dll
OgreMain.dll
OgreMeshLodGenerator_d.dll
OgreMeshLodGenerator.dll
OgreOverlay_d.dll
OgreOverlay.dll
Plugin_OctreeSceneManager_d.dll
Plugin_OctreeSceneManager.dll
Plugin_ParticleFX_d.dll
Plugin_ParticleFX.dll
RenderSystem_Direct3D9_d.dll
RenderSystem_Direct3D9.dll
RenderSystem_Direct3D11_d.dll
RenderSystem_Direct3D11.dll
zlib.dll
zlib.dll
I also have a bat file that copies those automatically to all my projects that should use the Ogre source, since otherwise it would be very hard to have to manually copy all of them each time I alter something in the Ogre source code (which does happen time to time), but that bat file is too specific to post here.
Note that I usually gather my files with a bat file to easily be able to get everything in one place. Below is a bat file to gather all include files and directories into a single place (which is needed if you use the same Additional Include Directories as above):
Code: Select all
xcopy /s /v /y "C:\OgreSDK\ogre\OgreMain\include" "C:\OgreSDK\include\OGRE"
xcopy /s /v /y "C:\OgreSDK\ogre\build\include" "C:\OgreSDK\include\OGRE"
xcopy /s /v /y "C:\OgreSDK\ogre\Samples\Common\include\ListenerFactoryLogic.h" "C:\OgreSDK\include\OGRE"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Bites\include" "C:\OgreSDK\include\OGRE\Bites"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\HLMS\include" "C:\OgreSDK\include\OGRE\HLMS"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\MeshLodGenerator\include" "C:\OgreSDK\include\OGRE\MeshLodGenerator"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Overlay\include" "C:\OgreSDK\include\OGRE\Overlay"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Paging\include" "C:\OgreSDK\include\OGRE\Paging"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Property\include" "C:\OgreSDK\include\OGRE\Property"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\RTShaderSystem\include" "C:\OgreSDK\include\OGRE\RTShaderSystem"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Terrain\include" "C:\OgreSDK\include\OGRE\Terrain"
xcopy /s /v /y "C:\OgreSDK\ogre\Components\Volume\include" "C:\OgreSDK\include\OGRE\Volume"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\BSPSceneManager\include" "C:\OgreSDK\include\OGRE\Plugins\BSPSceneManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\CgProgramManager\include" "C:\OgreSDK\include\OGRE\Plugins\CgProgramManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\FreeImageCodec\include" "C:\OgreSDK\include\OGRE\Plugins\FreeImageCodec"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\OctreeSceneManager\include" "C:\OgreSDK\include\OGRE\Plugins\OctreeSceneManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\OctreeZone\include" "C:\OgreSDK\include\OGRE\Plugins\OctreeZone"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\ParticleFX\include" "C:\OgreSDK\include\OGRE\Plugins\ParticleFX"
xcopy /s /v /y "C:\OgreSDK\ogre\build\include\OgreParticleFXPrerequisites.h" "C:\OgreSDK\include\OGRE\Plugins\ParticleFX"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\PCZSceneManager\include" "C:\OgreSDK\include\OGRE\Plugins\PCZSceneManager"
xcopy /s /v /y "C:\OgreSDK\ogre\PlugIns\STBICodec\include" "C:\OgreSDK\include\OGRE\Plugins\STBICodec"
xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\Direct3D9\include" "C:\OgreSDK\include\OGRE\RenderSystems\Direct3D9"
xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\Direct3D11\include" "C:\OgreSDK\include\OGRE\RenderSystems\Direct3D11"
xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\GL\include" "C:\OgreSDK\include\OGRE\RenderSystems\GL"
xcopy /s /v /y "C:\OgreSDK\ogre\RenderSystems\GL3Plus\include" "C:\OgreSDK\include\OGRE\RenderSystems\GL3Plus"
xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\zzip" "C:\OgreSDK\include\zzip"
xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\freetype2\ft2build.h" "C:\OgreSDK\include"
xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\zconf.h" "C:\OgreSDK\include"
xcopy /s /v /y "C:\OgreSDK\ogre\build\Dependencies\include\zlib.h" "C:\OgreSDK\include"
After all this, you must also include what .h files from Ogre that you might need, and I use these in my Stdafx.h:
Code: Select all
__pragma(warning(push))
__pragma(warning(disable:4305)) // 'initializing': truncation from 'double' to 'const Ogre::Real'
__pragma(warning(disable:4996)) // 'Ogre::Skeleton::getLinkedSkeletonAnimationSourceIterator': was declared deprecated
__pragma(warning(disable:4267)) // 'Ogre::Skeleton::getLinkedSkeletonAnimationSourceIterator': was declared deprecated
#include <Ogre.h>
#include <OgreStringConverter.h>
#include <OgreException.h>
#include "OgreLodConfig.h"
#include "OgreDistanceLodStrategy.h"
#include "OgreMeshLodGenerator.h"
#include <Overlay\OgreOverlaySystem.h>
#include <overlay/OgreOverlay.h>
#include <overlay/OgreOverlayManager.h>
#include <overlay/OgreTextAreaOverlayElement.h>
#include <overlay/OgreBorderPanelOverlayElement.h>
#include <overlay/OgreFontManager.h>
__pragma(warning(pop))
#define OGRE_IGNORE_DEPRECATED_BEGIN __pragma(warning(push)) \
__pragma(warning(disable:4996))
#define OGRE_IGNORE_DEPRECATED_END __pragma(warning(pop))
// THESE MIGHT NOT WORK FOR YOU, I BUILT SDL2 SPECIFICALLY INSTEAD:
__pragma(warning(push))
__pragma(warning(disable:4244)) // '=': conversion from 'const SDL_FingerID' to 'int', possible loss of data
#include "SDL2/SDL.h"
#include "SDL2/SDL_syswm.h"
__pragma(warning(pop))