Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OptiX not found problem] CMakeLists.txt is not compatible with FindOptiX.cmake within OptiX package. #27

Closed
somisawa opened this issue Jan 17, 2022 · 2 comments

Comments

@somisawa
Copy link

Question: Was my way correct? Or do there exist other solutions you suppose?

Environment: Ubuntu 20.04
Objective package: OptiX™ SDK 7.4.0 downloaded from here.

In this part, you use find_package but path/to/NVIDIA-OptiX-SDK-7.4.0-linux64-x86_64/SDK/CMake/FindOptiX.cmake does not set OptiX_FOUND even if optix.h exists in OptiX_INSTALL_DIR or OptiX_INSTALL_DIR/include.

instant-ngp/CMakeLists.txt

Lines 162 to 174 in 06ee0a2

find_package(OptiX)
# set OptiX_INSTALL_DIR via your environment if it's not found automatically
if (OptiX_FOUND)
include_directories("${OptiX_INCLUDE}")
add_definitions(-DNGP_OPTIX)
else()
message(WARNING
"OptiX was not found. Neural graphics primitives will still compile "
"and run correctly. However, SDF training in 'raystab' and 'pathescape' "
"modes will be significantly slower."
)
endif()

I've solved this problem by adding the following code at the end of path/to/NVIDIA-OptiX-SDK-7.4.0-linux64-x86_64/SDK/CMake/FindOptiX.cmake so that find_package correctly set OptiX_FOUND.

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OptiX
  REQUIRED_VARS
    OptiX_INCLUDE
  )

if(OptiX_FOUND AND NOT TARGET OptiX::OptiX)
  add_library(OptiX::OptiX UNKNOWN IMPORTED)
  set_target_properties(OptiX::OptiX PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${OptiX_INCLUDE}"
    )
endif()
@Tom94
Copy link
Collaborator

Tom94 commented Jan 17, 2022

Apologies for this, I had forgotten to include the relevant cmake/FindOptiX.cmake file in this repository and only remedied the issue 2 hours ago. (see 8bd9ff4)

OptiX should now be found out-of-the-box (assuming OptiX_INSTALL_DIR is set)

@somisawa
Copy link
Author

Oh, I missed your recent update. Thank you so much for fixing. I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants