-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from Hineven/main
Update CMakeFile.txt. Fix optix finding routines. Co-Authored-By: Hineven <hinevenwob@qq.com>
- Loading branch information
Showing
4 changed files
with
65 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,39 @@ | ||
# Locate the OptiX distribution. Search relative to the SDK first, then look in the system. | ||
|
||
# Our initial guess will be within the SDK. | ||
|
||
if (DEFINED ENV{OptiX_INSTALL_DIR}) | ||
set (OptiX_INSTALL_DIR $ENV{OptiX_INSTALL_DIR}) | ||
set (searched_OptiX_INSTALL_DIR ${OptiX_INSTALL_DIR}) | ||
elseif(NOT OptiX_INSTALL_DIR) | ||
if (WIN32) | ||
find_path(searched_OptiX_INSTALL_DIR | ||
NAME include/optix.h | ||
PATHS | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 8.0.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.7.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.6.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.5.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.4.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.3.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.2.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.1.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK 7.0.0" | ||
"C:/ProgramData/NVIDIA Corporation/OptiX SDK *" | ||
) | ||
endif() | ||
################################################################################ | ||
# Optix | ||
################################################################################ | ||
if(NOT DEFINED ENV{OptiX_INSTALL_DIR} AND NOT DEFINED OptiX_INSTALL_DIR) | ||
if(NOT DEFINED ENV{OPTIX_ROOT}) | ||
message("Try to find OptiX SDK in PROGRAMDATA directory.") | ||
if(NOT DEFINED ENV{PROGRAMDATA}) | ||
message(FATAL_ERROR "PROGRAMDATA is not defined. OPTIX_ROOT has to be specified manually.") | ||
else() | ||
# Transform the path to generic style | ||
file(TO_CMAKE_PATH "$ENV{PROGRAMDATA}" PROGRAMDATA) | ||
# Find the directory with prefix of "OptiX SDK" in PROGRAMDATA directory | ||
file(GLOB OPTIX_ROOT "${PROGRAMDATA}/NVIDIA Corporation/OptiX SDK*") | ||
# If there are multiple directories, use the first one | ||
list(GET OPTIX_ROOT 0 OPTIX_ROOT) | ||
# If there is no directory, popup an error message | ||
if(NOT OPTIX_ROOT) | ||
message(FATAL_ERROR "OPTIX_ROOT has to be specified manually.") | ||
else () | ||
message(STATUS "Found OptiX SDK at ${OPTIX_ROOT}") | ||
endif() | ||
endif() | ||
else() | ||
set( OPTIX_ROOT $ENV{OPTIX_ROOT} ) | ||
endif() | ||
else() | ||
if(DEFINED ENV{OptiX_INSTALL_DIR}) | ||
set( OPTIX_ROOT $ENV{OptiX_INSTALL_DIR} ) | ||
else() | ||
set( OPTIX_ROOT ${OptiX_INSTALL_DIR} ) | ||
endif() | ||
message(STATUS "Using specified OptiX path at ${OPTIX_ROOT}") | ||
endif() | ||
mark_as_advanced(searched_OptiX_INSTALL_DIR) | ||
set(OptiX_INSTALL_DIR ${searched_OptiX_INSTALL_DIR} CACHE PATH "Path to OptiX installed location.") | ||
set(OptiX_ROOT_DIR ${searched_OptiX_INSTALL_DIR} CACHE PATH "Path to OptiX installed location.") | ||
set(OptiX_INSTALL_DIR $ENV{OptiX_INSTALL_DIR} CACHE PATH "Path to OptiX installed location.") | ||
set(OptiX_ROOT_DIR ${searched_OptiX_INSTALL_DIR} CACHE PATH "Path to OptiX installed location.") | ||
|
||
# Include | ||
find_path(OptiX_INCLUDE | ||
NAMES optix.h | ||
PATHS "${OptiX_INSTALL_DIR}/include" | ||
NO_DEFAULT_PATH | ||
) | ||
find_path(OptiX_INCLUDE | ||
NAMES optix.h | ||
) | ||
|
||
# Check to make sure we found what we were looking for | ||
function(OptiX_report_error error_message required) | ||
if(OptiX_FIND_REQUIRED AND required) | ||
message(FATAL_ERROR "${error_message}") | ||
else() | ||
if(NOT OptiX_FIND_QUIETLY) | ||
message(STATUS "${error_message}") | ||
endif(NOT OptiX_FIND_QUIETLY) | ||
endif() | ||
endfunction() | ||
|
||
if(NOT OptiX_INCLUDE) | ||
OptiX_report_error("OptiX headers (optix.h and friends) not found. Please locate before proceeding." TRUE) | ||
endif() | ||
message(STATUS "Found OptiX SDK at ${OPTIX_ROOT}") | ||
# Guess the OptiX install directory by OPTIX_ROOT | ||
set(OptiX_INSTALL_DIR ${OPTIX_ROOT} CACHE PATH "Path to OptiX installation location") | ||
# Include the OptiX header directory | ||
set(OptiX_INCLUDE_DIR ${OPTIX_ROOT}/include CACHE PATH "Path to OptiX include directory") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters