The following changes were tested against building with a master copy.
For a more detailed report, please read the followings below:
The flags that were checked were the ones checked by default + the following:
ASSIMP_BUILD_ASSIMP_VIEW
ASSIMP_BUILD_SAMPLES
The list of compilable projects in Visual Studio were the following:
- assimp
- assimp_cmd
- assimp_simpleogl
- assimp_simpletextureddirectx11
- assimp_simpletexturedogl
- assimp_viewer
- INSTALL
- IrrXML
- uninstall
- unit
- UpdateAssimpLibsDebugSymbolsAndDLLs
- ZERO_CHECK
- zlib
- zlibstatic
The solution that was generated with the new changes comprised the same number of projects as the one from the master, unmodified. All projects except UpdateAssimpLibsDebugSymbolsAndDLLs were built without any error. All tests were run.
UpdateAssimpLibsDebugSymbolsAndDLLs could not be built because of the reasons explained in issue #3004.
- Added function "cleanup" to centralize release of resources.
- Added function "freeTextureIds" to free textureIds memory.
- Added call to freeTextureIds in LoadGLTextures to free memory before it is allocated again.
- Made several changes in KillGLWindow to prevent certain Win32 handle/resources
from being released more than once.
Several places in the sample's code were calling Unicode versions of Win32 functions with "multibyte" strings. A few changes were required to fix it.
I added a class "UTFConverter", which handles calls to unicode/multibyte string conversions. This should help minimize the impacts on code change in case C++'s codecvt_utf8 ever changes.
In addition, seveal memory leaks have been found, but these fixes will come in another PR because it goes beyond the scope of this PR.
DevIL.lib was removed in CMakeFiles.txt, as it is unused in the sample.
Here is a list of the changes:
- Fixed MB string calls to Unicode functions.
- Added class UTFConverter to handle string conversions.
- Removed reference to DevIL.lib.
- Fixed compile warnings.
The following changes were tested with the following projects:
- assimp DLL
- unit tests
- tools/assimp_cmd
- tools/assimp viewer
- samples/SimpleOpenGL
- samples/SimpleTexturedDirectx11
- samples/SimpleTexturedOpenGL
For each program listed above, the results were tested when (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) is true and false.
Also, the "lib" in SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_HOME_DIRECTORY}/lib") was changed to "bin" to allow DLLs to be written to executables/launchables programs directory.