nvpro-samples / optix_advanced_samples

417 stars 87 forks source link

Could NOT find DevIL (missing: IL_LIBRARIES ILU_LIBRARIES IL_INCLUDE_DIR) #15

Closed rjhuang27 closed 3 years ago

rjhuang27 commented 3 years ago

I have set like this in FindOptiX.cmake: set(OptiX_INSTALL_DIR D:/develop/library/OptiX SDK 6.0.0/) set(ILU_LIBRARIES D:/develop/library/DevIL/lib/x64/Release/ILU.lib) set(IL_LIBRARIES D:/develop/library/DevIL/lib/x64/Release/DevIL.lib) set(ILUT_LIBRARIES D:/develop/library/DevIL/lib/x64/Release/ILUT.lib)

the Cmake-gui Configure error: Could NOT find DevIL (missing: IL_LIBRARIES ILU_LIBRARIES IL_INCLUDE_DIR) CMake Error at CMake/FindOptiX.cmake:121 (message): OptiX library not found. Please set OptiX_INSTALL_DIR to locate it automatically. Call Stack (most recent call first): CMake/FindOptiX.cmake:130 (OptiX_report_error) CMakeLists.txt:203 (find_package)

droettger commented 3 years ago

Normally you run the CMake Configure inside the CMake GUI and then fill in the missing paths there once. Please look for these five CMake variables inside CMake GUI: OptiX_INSTALL_DIR, IL_INCLUDE_DIR, IL_LIBRARIES, ILU_LIBRARIES, ILUT_LIBRARIES

Set them to your local paths where you have installed these if any of them is not filled in. These are cached and only need to be set once, unless you delete the CMake cache.

DevIL is tried to be found by using the FindDevIL.cmake script which is shipped with your CMake installation. Under Linux that should work out-of-the-box, but since you can install SDKs under Windows almost anywhere you like, that manual step is required in these old OptiX 5.1.0 based examples. (I have a better way, read till the end.)

The find_package(DevIL) which does that is called inside the top-level optix_advanced_samples/src/CMakeLists.txt file in line 135. Also if that FindDevIL.cmake isn't used, then IL_FOUND is not set. That IL_FOUND in turn is used inside the optix_advanced_samples\src\optixIntroduction\CMakeLists.txt to determine if the introduction examples 7 to 10 can be built because these require DevIL to load images into textures.

If you want to replace that method to find DevIL with a hardcoded setting like you did above, then you must comment out that find_package(DevIL) there and replace it with your respective settings for IL_INCLUDE_DIR, IL_LIBRARIES, ILU_LIBRARIES, ILUT_LIBRARIES, and IL_FOUND!

In any case, note that these older OptiX examples are written against the outdated OptiX 5.1.0 version. While the projects are working with OptiX SDK versions up to OptiX 6.5.0 (recommended version when using OptiX 6 at all), they are not using the RT cores available on RTX boards, means they could be much faster.

Instead when starting new projects with OptiX, please use OptiX 7 versions (7.3.0 at this time) which use a more modern API which is faster, explicit, multi-threading safe, all resource management in pure CUDA host code. Older versions cannot be supported the same way.

To show how existing OptiX applications can be ported from that ten year old API to the new OptiX 7 API, I ported some of these OptiX Introduction examples over here: https://github.com/NVIDIA/OptiX_Apps

That repository is also prepared to download most third party dependencies automatically, and then uses custom *.cmake scripts to find them. Means if you follow the README.md there by the letter, DevIL is automatically found.

For more OptiX 7 samples please follow the links in this sticky post on the OptiX developer forum: https://forums.developer.nvidia.com/t/optix-7-3-release/175373

rjhuang27 commented 3 years ago

Thank you for your detailed answer,I made it.

droettger commented 3 years ago

You're welcome. Closing.