RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.73k stars 160 forks source link

Fix files from different configurations overwriting on installation #192

Open sebastian-zapata opened 5 months ago

sebastian-zapata commented 5 months ago

Hello! I was looking for guidelines on contributions but didn't find any information.

Anyways,

The problem:

Installation files are overwriting each other from different configurations during installation. This will result in only "Debug" files being installed at the end and all "Release", "MinSizeRel" or "RelWithDebInfo" files will be missing. This is because the target file names and their paths are not being discriminated during installation.

This will turn linking into a nightmare because of course we get a lot of "mismatch detected for '_ITERATOR_DEBUG_LEVEL'" kind of errors when trying to build another library that depends on OIDN. This is because CMake will always link to the debug configuration of OIDN.

I'm aware of the CMAKE_BUILD_TYPE option but:

  1. It doesn't solve the problem because at the end CMake creates its own target files for each configuration.
  2. It makes the problem even worse because each "build type" will have all four configurations (Debug, Release, MinSizeRel, RelWithDebInfo) and they still collide.

I realized there's a .zip file that is generated at the end of the installation, and even this file suffers from the same problem: It's only debug files.

The solution:

I propose installing these files in separate folders, one for each configuration which is a pretty standard way of doing it. This way the won't collide with each other and one can seamlessly link OIDN to other projects using CMake targets.

Note: There's an additional file (external\mkl-dnn\src\CMakeLists.txt) that I couldn't commit. I think it's because it's from another library but it was as simple as changing one line. However, I can see the "mkl-dnn" folder in "external", but it's empty. Maybe it's being ignored from somewhere? I couldn't find the .ignore file or how you guys are handling this.

If you need additional information or any changes, please let me know!

I'm quite sleepy, so I apologize for any spelling or grammar mistakes I may have made.

Software: Windows 10 CMake 3.27.9 Visual Studio Community 2017 (15.9.58) Platform Toolset Visual Studio 2017 (v141) Windows SDK Version 10.0.22621.0 C++17 Standard