OGRECave / ogrewater

OgreWater is a water module for Ogre3D that is simple to use!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build issues with OGRE 13.6.1 (Win10)

ohlidalp opened this issue · comments

Hello.

I've cloned OGRE repo, checked out the v13.6.1 tag and built with -D "CMAKE_BUILD_TYPE=Debug", then "Build->Build Solution" in Visual Studio.

When configuring ogrewater, I got the following error:

Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
CMake Error at C:/Users/Petr/builds/ogre/cmake/OGREConfig.cmake:33 (message):
  File or directory C:/Users/Petr/builds/ogre/Media referenced by variable
  OGRE_MEDIA_DIR does not exist !
Call Stack (most recent call first):
  C:/Users/Petr/builds/ogre/cmake/OGREConfig.cmake:50 (set_and_check)
  CMakeLists.txt:6 (find_package)


Configuring incomplete, errors occurred!
See also "C:/Users/Petr/builds/ogrewater/CMakeFiles/CMakeOutput.log".

I looked for the "Media" directory and indeed it was in source location rather than build location.
I worked this around by editing OGREConfig.cmake to use set_and_check(OGRE_MEDIA_DIR "C:/users/petr/source/ogre/Media").
But then I got another cmake error and gave up:

Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
CMake Error at C:/Users/Petr/builds/ogre/cmake/OGREConfig.cmake:91 (include):
  include could not find requested file:

    C:/Users/Petr/builds/ogre/cmake/OgreTargets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)


Found OGRE
  static     : OFF
  components : Bites;MeshLodGenerator;Overlay;Paging;Property;RTShaderSystem;Terrain;Volume
  plugins    : Plugin_BSPSceneManager;Plugin_OctreeSceneManager;Plugin_PCZSceneManager;Plugin_ParticleFX;RenderSystem_GL;RenderSystem_GLES2;RenderSystem_GL3Plus;RenderSystem_Direct3D11;Codec_STBI
  media      : C:/users/petr/source/ogre/Media
Configuring incomplete, errors occurred!
See also "C:/Users/Petr/builds/ogrewater/CMakeFiles/CMakeOutput.log".

My system:
Microsoft Windows 10 Pro, v10.0.19044 Build 19044
Microsoft Visual Studio Community 2022 (64-bit) - Version 17.2.6
cmake 3.24.3

Thank you, after building the INSTALL target and setting OGRE_DIR=c:\Users\Petr\builds\ogre\sdk\cmake, configuring and building went smoothly.

To run, I had to manually copy DLLs and CFGs from ogre bin/Debug dir to Ogrewater bin/Debug dir, I assume this is expected.

However, with D3d11 I got this on startup:
obrazek
The log shows countless shader compilation errors:
OgreWater-d3d11.zip

Call stack:

>	OgreMain_d.dll!Ogre::ExceptionFactory::_throwException(Ogre::Exception::ExceptionCodes code, int number, const std::string & desc, const std::string & src, const char * file, long line) Line 264	C++
 	OgreMain_d.dll!Ogre::ExceptionFactory::throwException(Ogre::Exception::ExceptionCodes code, const std::string & desc, const std::string & src, const char * file, long line) Line 281	C++
 	OgreMain_d.dll!Ogre::ParticleSystemManager::createSystemImpl(const std::string & name, const std::string & templateName) Line 231	C++
 	OgreMain_d.dll!Ogre::ParticleSystemFactory::createInstanceImpl(const std::string & name, const std::map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string const ,std::string>>> * params) Line 386	C++
 	OgreMain_d.dll!Ogre::MovableObjectFactory::createInstance(const std::string & name, Ogre::SceneManager * manager, const std::map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string const ,std::string>>> * params) Line 448	C++
 	OgreMain_d.dll!Ogre::SceneManager::createMovableObject(const std::string & name, const std::string & typeName, const std::map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string const ,std::string>>> * params) Line 3534	C++
 	OgreMain_d.dll!Ogre::SceneManager::createParticleSystem(const std::string & name, const std::string & templateName) Line 595	C++
 	OgreWaterApp.exe!OgreWater::Water::createWaterDust() Line 628	C++
 	OgreWaterApp.exe!OgreWater::Water::setWaterDustEnabled(bool enable) Line 616	C++
 	OgreWaterApp.exe!OgreWater::Application::go() Line 162	C++
 	OgreWaterApp.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * __formal, char * strCmdLine, int __formal) Line 47	C++

ah, yes.. you also need to copy OgreWater/build/resources.cfg to OgreWater/build/debug/resources.cfg

Did not bother doing that via CMake

Silly mistake, figured it out myself just as you replied...

However, the generated 'resources.cfg' contains an error:

FileSystem=C:/users/petr/source/ogre/Media/materials/textures
FileSystem=C:/users/petr/source/ogre/Media/materials/textures/terrain

These lines need to point either to /builds/ogre/sdk/Media or /source/ogre/samples/Media

So to summarize:

  1. when building OGRE yourself (using VisualStudio), make sure you do the INSTALL step and set the OGRE_DIR to the sdk/cmake directory, not the buildroot/cmake directory.
  2. Before running, copy all DLLs and CFGs from OGRE bin dir to OgreWater bin dir, except 'resources.cfg'
  3. Copy 'resources.cfg' from the OgreWater build root to bin dir and edit the texture paths from /source/ogre/Media to /source/ogre/samples/Media

However, the generated 'resources.cfg' contains an error:

they should point to sdk/Media. Probably the file did not get regenerated when you switched to sdk/cmake