ogre icon indicating copy to clipboard operation
ogre copied to clipboard

MSVC Debug build expects assimp release library to be present

Open Timmeey86 opened this issue 4 years ago • 4 comments

Reproducer on Windows 10 64Bit, VS2019:

  1. Get current master code
  2. Create a build directory
  3. Build using 'cmake -DCMAKE_BUILD_TYPE=Debug ..'

=> The build fails on:

CMake Error at build_debug/Dependencies/lib/cmake/assimp-5.0/assimpTargets.cmake:85 (message): The imported target "assimp::assimp" references the file

"H:/Code/Ogre/ogre-master/build_debug/Dependencies/lib/assimp-vc142-mt.lib"

but this file does not exist.

The mentioned directory correctly contains assimp-vc142-mtd.lib, but the build seems to be looking for the release libary instead

Timmeey86 avatar Mar 22 '21 06:03 Timmeey86

The target and file in question is generated by assimp, so you rather should file an issue there.

paroj avatar Mar 22 '21 23:03 paroj

I believe I have found the issue in the Ogre CMake files:

The following line removes the script which finds the debug library:

https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMake/Dependencies.cmake#L218-L220

`OGRE_DEBUG_MODE is set in:

https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMake/ConfigureBuild.cmake#L15-L19

However, the Dependencies script is included way before the ConfigureBuild script in the main CMakeLists

(Compare https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMakeLists.txt#L290 and https://github.com/OGRECave/ogre/blob/375a66cb8da973a3859b931126d353c70830e8ab/CMakeLists.txt#L436).

Additionally, it looks like in debug mode, the assimpTargets-release.cmake had to be removed instead, as CMake will otherwise look for both the debug and release libraries

Timmeey86 avatar Mar 23 '21 07:03 Timmeey86

I can confirm that changing OgreDependencies.cmake to:

  if(NOT OGRE_DEBUG_MODE)
    file(REMOVE ${OGREDEPS_PATH}/lib/cmake/assimp-5.0/assimpTargets-debug.cmake)
  else()
    file(REMOVE ${OGREDEPS_PATH}/lib/cmake/assimp-5.0/assimpTargets-release.cmake)
  endif()

and setting OGRE_DEBUG_MODE to 1 anywhere before that line fixes this issue. I'm not really sure which kind of place would be the right one for setting OGRE_DEBUG_MODE, though. Also, this would break a debug and release build, in case it is supported anyway.

Timmeey86 avatar Mar 23 '21 07:03 Timmeey86

thanks for investigating.

however, for ogre this is merely a workaround. This change should actually be made in the assimp project.

paroj avatar Mar 24 '21 01:03 paroj

fixed in assimp

paroj avatar Feb 02 '24 14:02 paroj