cleanup and refactoring

This commit is contained in:
CDaut 2024-05-25 11:53:25 +02:00
parent 2302158928
commit 76f6bf62a4
Signed by: clara
GPG key ID: 223391B52FAD4463
1285 changed files with 757994 additions and 8 deletions

View file

@ -0,0 +1,19 @@
include(FindPackageHandleStandardArgs)
find_path( GLM_INCLUDE_DIR glm/glm.hpp HINTS ${GLM_LOCATION}
$ENV{GLM_LOCATION}
${BASE_DIRECTORY}/nvpro_core/third_party/glm
$ENV{VK_SDK_PATH}/include
${VULKAN_HEADERS_OVERRIDE_INCLUDE_DIR}
${Vulkan_INCLUDE_DIR} )
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIR)
# Define GLM_INCLUDE_DIRS
if (GLM_FOUND)
set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
endif()
# Hide some variables
mark_as_advanced(GLM_INCLUDE_DIR)

View file

@ -0,0 +1,71 @@
# Try to find KIT_SDK project so and include file
#
unset(KIT_SDK_LIBRARIES CACHE)
unset(KIT_SDK_INCLUDE_DIR CACHE)
unset(KIT_SDK_LIBRARY_DIR CACHE)
unset(KIT_SDK_FOUND CACHE)
unset(KIT_SDK_ALL_DEPS_FILE CACHE)
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
endif()
if(USE_PACKMAN)
message(STATUS "attempting to using packman to source kit-sdk")
pull_dependencies(DEPENDENCY_FILE "kit-sdk-deps.packman.xml")
set(KitSDK_DIR "${BASE_DIRECTORY}/nvpro_core/OV/downloaded/kit")
find_file(KIT_SDK_ALL_DEPS_FILE
NAMES all-deps.packman.xml
PATHS ${KitSDK_DIR}/dev
)
if (NOT KIT_SDK_ALL_DEPS_FILE)
message(WARNING "Kit all-deps.packman.xml not found.")
endif()
endif()
if (WIN32)
find_file(KIT_SDK_LAUNCH_SCRIPT
NAMES omni.app.full.bat
PATHS ${KitSDK_DIR}
)
find_file(KIT_APP
NAMES kit.exe
PATHS ${KitSDK_DIR}
)
elseif(UNIX)
find_file(KIT_SDK_LAUNCH_SCRIPT
NAMES omni.app.full.sh
PATHS ${KitSDK_DIR}
)
find_file(KIT_APP
NAMES kit
PATHS ${KitSDK_DIR}
)
endif()
if(KIT_SDK_LAUNCH_SCRIPT)
message(STATUS " Kit launch script found at ${KIT_SDK_LAUNCH_SCRIPT}")
else(KIT_SDK_LAUNCH_SCRIPT)
message(WARNING "
Kit launch script not found.")
endif(KIT_SDK_LAUNCH_SCRIPT)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(KitSDK DEFAULT_MSG
KIT_SDK_LAUNCH_SCRIPT
KIT_APP
KitSDK_DIR
KIT_SDK_ALL_DEPS_FILE
)
# Do we have to rewrite the variable here...
set(KIT_SDK_LAUNCH_SCRIPT ${KIT_SDK_LAUNCH_SCRIPT} CACHE FILEPATH "filepath")
set(KIT_APP ${KIT_APP} CACHE FILEPATH "filepath")
set(KitSDK_DIR ${KitSDK_DIR} CACHE PATH "path")
mark_as_advanced( KIT_SDK_FOUND )

View file

@ -0,0 +1,114 @@
# Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#------------------------------------------------------------------------------
# Try to find NVML.
# Once done this will define
#
# NVML_FOUND - whether all of the components of NVML were found
# NVML_INCLUDE_DIRS - same as the CUDA include dir
# NVML_LIBRARIES - the linker library for NVML
#
# The NVML headers and linker library are distributed as part of the CUDA SDK.
# We use the variables set by finding CUDA
# (see https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html and
# https://cmake.org/cmake/help/v3.3/module/FindCUDA.html)
# However, the shared library (DLL on Windows) should be found at runtime.
#
# Please note that on Windows, NVML is only available for 64-bit systems.
set(NVML_FOUND OFF)
# FindCUDAToolkit is the new module to use here, but it's only available in
# CMake 3.17+.
# FindCUDA is available until 3.27. So we switch between the two
# depending on the CMake version:
if(${CMAKE_VERSION} VERSION_LESS 3.17.0)
find_package(CUDA)
if(WIN32) # Windows
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_ARCH "x64")
else()
message(FATAL_ERROR "FindNVML.cmake was called with a 32-bit platform on \
Windows, but NVML and nvpro_core are not available for 32-bit systems on \
Windows. Did you mean to use a 64-bit platform?")
endif()
endif()
set(_CUDA_LIB_DIR ${CUDA_TOOLKIT_ROOT_DIR}/lib/${_ARCH})
set(_CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_ROOT_DIR}/include)
else() # CMake >= 3.17.0
find_package(CUDAToolkit)
set(_CUDA_LIB_DIR ${CUDAToolkit_LIBRARY_DIR})
set(_CUDA_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIRS})
endif()
# Finding CUDA doesn't guarantee that NVML was installed with CUDA, since
# one can turn that off during installation. Search for NVML in a number of
# locations:
find_library(NVML_LIBRARIES NAMES nvml nvidia-ml PATHS ${_CUDA_LIB_DIR})
if(NOT NVML_LIBRARIES)
if(WIN32)
message(WARNING "CMake couldn't locate the NVML library, so compilation \
will likely fail. You may need to install the CUDA toolkit.")
else()
message(WARNING "CMake couldn't locate the nvidia-ml library, so \
compilation will likely fail. You may need to install NVML using your OS' \
package manager; for instance, by running `sudo apt install libnvidia-ml-dev`.")
endif()
endif()
find_path(NVML_INCLUDE_DIRS nvml.h
${NVML_LOCATION}
$ENV{NVML_LOCATION}
${_CUDA_INCLUDE_DIRS}
# if no CUDA, let's try to find nvml locally in our third_party supplement.
# FindNVML.cmake is located in nvpro_core/cmake/find.
${CMAKE_CURRENT_LIST_DIR}/../../third_party/binaries/nvml
)
if(NOT NVML_INCLUDE_DIRS)
message(WARNING "
NVML headers not found. To explicitly locate it, set NVML_LOCATION,
which should be a folder containing nvml.h."
)
endif()
if(NVML_LIBRARIES AND NVML_INCLUDE_DIRS)
set(NVML_FOUND ON)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(NVML DEFAULT_MSG
NVML_INCLUDE_DIRS
NVML_LIBRARIES
)
mark_as_advanced(
NVML_INCLUDE_DIRS
NVML_LIBRARIES
)

View file

@ -0,0 +1,99 @@
#
# Copyright (c) 2021 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#.rst:
# FindNsightAftermath
# ----------
#
# Try to find the NVIDIA Nsight Aftermath SDK based on the NSIGHT_AFTERMATH_SDK environment variable
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``NsightAftermath::NsightAftermath``, if
# the NVIDIA Nsight Aftermath SDK has been found.
#
# Result Variables
# ^^^^^^^^^^^^^^^^
#
# This module defines the following variables::
#
# NsightAftermath_FOUND - True if the NVIDIA Nsight Aftermath SDK was found
# NsightAftermath_INCLUDE_DIRS - include directories for the NVIDIA Nsight Aftermath SDK
# NsightAftermath_LIBRARIES - link against this library to use the NVIDIA Nsight Aftermath SDK
# NsightAftermath_DLLS - .dll or .so files needed for distribution
#
# The module will also define two cache variables::
#
# NsightAftermath_INCLUDE_DIR - the NVIDIA Nsight Aftermath SDK include directory
# NsightAftermath_LIBRARY - the path to the NVIDIA Nsight Aftermath SDK library
#
if(WIN32 OR UNIX)
find_path(NsightAftermath_INCLUDE_DIR
NAMES GFSDK_Aftermath.h
PATHS
"${NSIGHT_AFTERMATH_SDK}/include"
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(NsightAftermath_LIBRARY
NAMES GFSDK_Aftermath_Lib.x64
PATHS
"${NSIGHT_AFTERMATH_SDK}/lib/x64"
NO_SYSTEM_ENVIRONMENT_PATH
)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
find_library(NsightAftermath_LIBRARY
NAMES GFSDK_Aftermath_Lib.x86
PATHS
"${NSIGHT_AFTERMATH_SDK}/lib/x86"
NO_SYSTEM_ENVIRONMENT_PATH
)
endif()
else()
find_path(NsightAftermath_INCLUDE_DIR
NAMES GFSDK_Aftermath.h
PATHS
"${NSIGHT_AFTERMATH_SDK}/include")
find_library(NsightAftermath_LIBRARY
NAMES GFSDK_Aftermath_Lib
PATHS
"${NSIGHT_AFTERMATH_SDK}/lib")
endif()
string(REPLACE ".lib" ".dll" NsightAftermath_DLLS ${NsightAftermath_LIBRARY})
set(NsightAftermath_LIBRARIES ${NsightAftermath_LIBRARY})
set(NsightAftermath_INCLUDE_DIRS ${NsightAftermath_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(NsightAftermath
DEFAULT_MSG
NsightAftermath_LIBRARY NsightAftermath_INCLUDE_DIR)
mark_as_advanced(NsightAftermath_INCLUDE_DIR NsightAftermath_LIBRARY)
if(NsightAftermath_FOUND AND NOT TARGET NsightAftermath::NsightAftermath)
add_library(NsightAftermath::NsightAftermath UNKNOWN IMPORTED)
set_target_properties(NsightAftermath::NsightAftermath PROPERTIES
IMPORTED_LOCATION "${NsightAftermath_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${NsightAftermath_INCLUDE_DIRS}")
endif()
if(NOT NsightAftermath_FOUND)
message("NSIGHT_AFTERMATH_SDK environment variable not set to a valid location (value: ${NSIGHT_AFTERMATH_SDK})")
endif()

View file

@ -0,0 +1,53 @@
# Try to find OMNI_USD_RESOLVER project so and include file
#
unset(OMNI_USD_RESOLVER_LIBRARIES CACHE)
unset(OMNI_USD_RESOLVER_INCLUDE_DIR CACHE)
unset(OMNI_USD_RESOLVER_LIBRARY_DIR CACHE)
unset(OMNI_USD_RESOLVER_FOUND CACHE)
if ("nopy" IN_LIST OmniUsdResolver_FIND_COMPONENTS OR (DEFINED PYTHON_VERSION AND PYTHON_VERSION EQUAL "nopy"))
set(INCLUDE_PYTHON 0)
set(PYTHON_VERSION "nopy")
elseif()
set(INCLUDE_PYTHON 1)
if (NOT DEFINED PYTHON_VERSION)
message(STATUS "PYTHON_VERSION must be set to compatible python version string ['py37, 'py310', or 'nopy']")
message(STATUS "Defaulting PYTHON_VERSION to 'py37'")
set(PYTHON_VERSION "py37")
endif()
endif()
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
endif()
if(USE_PACKMAN)
message(STATUS "attempting to using packman to source omni usd resolver")
pull_dependencies(DEPENDENCY_FILE "omniusdresolver-deps.packman.xml")
set(OMNI_USD_RESOLVER_DIR "${BASE_DIRECTORY}/nvpro_core/OV/downloaded/omni_usd_resolver")
endif()
#message("OMNI_USD_RESOLVER_DIR: " ${OMNI_USD_RESOLVER_DIR})
if(OMNI_USD_RESOLVER_DIR)
set(OMNI_USD_RESOLVER_PLUGINS_DIR "${OMNI_USD_RESOLVER_DIR}/$<IF:$<CONFIG:Debug>,debug,release>")
set(OMNI_USD_RESOLVER_RESOURCES_DIR "${OMNI_USD_RESOLVER_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/usd/omniverse/resources")
else(OMNI_USD_RESOLVER_DIR)
message(WARNING "Omni usd resolver plugin not found.")
endif(OMNI_USD_RESOLVER_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OmniUsdResolver DEFAULT_MSG
OMNI_USD_RESOLVER_PLUGINS_DIR
OMNI_USD_RESOLVER_RESOURCES_DIR
)
# Do we have to rewrite the variable here...
set(OMNI_USD_RESOLVER_PLUGINS_DIR ${OMNI_USD_RESOLVER_PLUGINS_DIR} CACHE PATH "path")
set(OMNI_USD_RESOLVER_RESOURCES_DIR ${OMNI_USD_RESOLVER_RESOURCES_DIR} CACHE PATH "path")
mark_as_advanced( OMNI_USD_RESOLVER_FOUND )

View file

@ -0,0 +1,171 @@
# Try to find OptiX project dll/so and headers
#
# outputs
unset(OPTIX_DLL CACHE)
unset(OPTIX_LIB CACHE)
unset(OPTIX_FOUND CACHE)
unset(OPTIX_INCLUDE_DIR CACHE)
# OPTIX_LOCATION can be setup to search versions somewhere else
macro ( folder_list result curdir substring )
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*${substring}*)
SET(dirlist "")
foreach ( child ${children})
IF(IS_DIRECTORY ${curdir}/${child})
LIST(APPEND dirlist ${child})
ENDIF()
ENDFOREACH()
SET(${result} ${dirlist})
ENDMACRO()
macro(_find_version_path targetVersion targetPath rootName searchList )
unset ( targetVersion )
unset ( targetPath )
SET ( bestver "0.0.0" )
SET ( bestpath "" )
foreach ( basedir ${searchList} )
folder_list ( dirList ${basedir} ${rootName} )
foreach ( checkdir ${dirList} )
string ( REGEX MATCH "${rootName}(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$" result "${checkdir}" )
if ( "${result}" STREQUAL "${checkdir}" )
# found a path with versioning
SET ( ver "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${CMAKE_MATCH_4}" )
if ( ver VERSION_GREATER bestver )
SET ( bestver ${ver} )
SET ( bestmajorver ${CMAKE_MATCH_2})
SET ( bestminorver ${CMAKE_MATCH_3})
SET ( bestpath "${basedir}/${checkdir}" )
endif ()
endif()
endforeach ()
endforeach ()
SET ( ${targetVersion} "${bestver}" )
SET ( ${targetPath} "${bestpath}" )
endmacro()
macro(_find_files targetVar incDir dllName dllName64 folder)
unset ( fileList )
if(ARCH STREQUAL "x86")
file(GLOB fileList "${${incDir}}/../${folder}${dllName}")
list(LENGTH fileList NUMLIST)
if(NUMLIST EQUAL 0)
file(GLOB fileList "${${incDir}}/${folder}${dllName}")
endif()
else()
file(GLOB fileList "${${incDir}}/../${folder}${dllName64}")
list(LENGTH fileList NUMLIST)
if(NUMLIST EQUAL 0)
file(GLOB fileList "${${incDir}}/${folder}${dllName64}")
endif()
endif()
list(LENGTH fileList NUMLIST)
if(NUMLIST EQUAL 0)
message(STATUS "MISSING: unable to find ${targetVar} files (${folder}${dllName}, ${folder}${dllName64})" )
set (${targetVar} "NOTFOUND")
endif()
list(APPEND ${targetVar} ${fileList} )
# message ( "File list: ${${targetVar}}" ) #-- debugging
endmacro()
if (DEFINED OPTIX_LOCATION OR DEFINED ENV{OPTIX_LOCATION} )
Message(STATUS "using OPTIX_LOCATION (${OPTIX_LOCATION})...")
if(NOT DEFINED OPTIX_LOCATION)
if(DEFINED ENV{OPTIX_LOCATION})
set(OPTIX_LOCATION $ENV{OPTIX_LOCATION})
endif()
endif()
# Locate by version failed. Handle user override for OPTIX_LOCATION.
string ( REGEX MATCH ".*([0-9]+).([0-9]+).([0-9]+)(.*)$" result "${OPTIX_LOCATION}" )
if ( "${result}" STREQUAL "${OPTIX_LOCATION}" )
SET ( bestver "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" )
SET ( bestmajorver ${CMAKE_MATCH_1})
SET ( bestminorver ${CMAKE_MATCH_2})
Message(STATUS "found version ${bestver}")
else()
Message(WARNING "Could NOT extract the version from OptiX folder : ${result}")
endif()
find_path( OPTIX_INCLUDE_DIR optix.h ${OPTIX_LOCATION}/include )
if ( OPTIX_INCLUDE_DIR )
set (OPTIX_ROOT_DIR ${OPTIX_INCLUDE_DIR}/../ )
endif()
endif()
if(NOT DEFINED OPTIX_ROOT_DIR)
# Locate OptiX by version
set ( SEARCH_PATHS
$ENV{OPTIX_LOCATION}
${OPTIX_LOCATION}
${PROJECT_SOURCE_DIR}/../LocalPackages/Optix
${PROJECT_SOURCE_DIR}/../../LocalPackages/Optix
${PROJECT_SOURCE_DIR}/../../../LocalPackages/Optix
C:/ProgramData/NVIDIA\ Corporation
)
_find_version_path ( OPTIX_VERSION OPTIX_ROOT_DIR "OptiX" "${SEARCH_PATHS}" )
message ( STATUS "OptiX version: ${OPTIX_VERSION}")
endif()
if (OPTIX_ROOT_DIR)
if (WIN32)
#-------- Locate DLLS
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/optix.${bestmajorver}.${bestminorver}.0.dll" "bin64/optix.${bestmajorver}.${bestminorver}.0.dll" "")
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/optixu.${bestmajorver}.${bestminorver}.0.dll" "bin64/optixu.${bestmajorver}.${bestminorver}.0.dll" "")
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/optix_prime.${bestmajorver}.${bestminorver}.0.dll" "bin64/optix_prime.${bestmajorver}.${bestminorver}.0.dll" "")
#-------- Locate LIBS
_find_files( OPTIX_LIB OPTIX_ROOT_DIR "lib/optix.${bestmajorver}.${bestminorver}.0.lib" "lib64/optix.${bestmajorver}.${bestminorver}.0.lib" "")
_find_files( OPTIX_LIB OPTIX_ROOT_DIR "lib/optixu.${bestmajorver}.${bestminorver}.0.lib" "lib64/optixu.${bestmajorver}.${bestminorver}.0.lib" "")
_find_files( OPTIX_LIB OPTIX_ROOT_DIR "lib/optix_prime.${bestmajorver}.${bestminorver}.0.lib" "lib64/optix_prime.${bestmajorver}.${bestminorver}.0.lib" "")
if(NOT OPTIX_LIB)
message(STATUS "setting OPTIX_LIB to ${OPTIX_LIB}" )
endif()
endif(WIN32)
if (UNIX)
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/liboptix.so" "lib64/liboptix.so" "" )
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/liboptixu.so" "lib64/liboptixu.so" "" )
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/liboptix_prime.so" "lib64/liboptix_prime.so" "" )
set(OPTIX_LIB ${OPTIX_DLL})
endif(UNIX)
#-------- Locate HEADERS
_find_files( OPTIX_HEADERS OPTIX_ROOT_DIR "optix.h" "optix.h" "include/" )
if(OPTIX_DLL)
set( OPTIX_FOUND "YES" )
else()
message(STATUS "setting OPTIX_DLL to ${OPTIX_DLL}" )
endif(OPTIX_DLL)
else(OPTIX_ROOT_DIR)
message(WARNING "
OPTIX not found.
The OPTIX folder you would specify with OPTIX_LOCATION should contain:
- lib[64] folder: containing the Optix[64_]*.dll or *.so
- include folder: containing the include files"
)
endif(OPTIX_ROOT_DIR)
include(FindPackageHandleStandardArgs)
SET(OPTIX_DLL ${OPTIX_DLL} CACHE PATH "path")
SET(OPTIX_LIB ${OPTIX_LIB} CACHE PATH "path")
SET(OPTIX_INCLUDE_DIR "${OPTIX_ROOT_DIR}/include" CACHE PATH "path")
add_definitions("-DOPTIX_PATH=R\"(${OPTIX_ROOT_DIR})\"")
add_definitions("-DOPTIX_VERSION_STR=\"${OPTIX_VERSION}\"")
find_package_handle_standard_args(OPTIX DEFAULT_MSG
OPTIX_INCLUDE_DIR
OPTIX_DLL
)
mark_as_advanced( OPTIX_FOUND )

View file

@ -0,0 +1,134 @@
# Try to find OptiX project dll/so and headers
#
# outputs
unset(OPTIX7_DLL CACHE)
unset(OPTIX7_LIB CACHE)
unset(OPTIX7_FOUND CACHE)
unset(OPTIX7_INCLUDE_DIR CACHE)
# OPTIX7_LOCATION can be setup to search versions somewhere else
macro ( folder_list result curdir substring )
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*${substring}*)
SET(dirlist "")
foreach ( child ${children})
IF(IS_DIRECTORY ${curdir}/${child})
LIST(APPEND dirlist ${child})
ENDIF()
ENDFOREACH()
SET(${result} ${dirlist})
ENDMACRO()
macro(_find_version_path targetVersion targetPath rootName searchList )
unset ( targetVersion )
unset ( targetPath )
SET ( bestver "0.0.0" )
SET ( bestpath "" )
foreach ( basedir ${searchList} )
folder_list ( dirList ${basedir} ${rootName} )
foreach ( checkdir ${dirList} )
string ( REGEX MATCH "${rootName}(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$" result "${checkdir}" )
if ( "${result}" STREQUAL "${checkdir}" )
# found a path with versioning
SET ( ver "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${CMAKE_MATCH_4}" )
if ( ver VERSION_GREATER bestver )
SET ( bestver ${ver} )
SET ( bestmajorver ${CMAKE_MATCH_2})
SET ( bestminorver ${CMAKE_MATCH_3})
SET ( bestpath "${basedir}/${checkdir}" )
endif ()
endif()
endforeach ()
endforeach ()
SET ( ${targetVersion} "${bestver}" )
SET ( ${targetPath} "${bestpath}" )
endmacro()
macro(_find_files targetVar incDir dllName dllName64 folder)
unset ( fileList )
if(ARCH STREQUAL "x86")
file(GLOB fileList "${${incDir}}/../${folder}${dllName}")
list(LENGTH fileList NUMLIST)
if(NUMLIST EQUAL 0)
file(GLOB fileList "${${incDir}}/${folder}${dllName}")
endif()
else()
file(GLOB fileList "${${incDir}}/../${folder}${dllName64}")
list(LENGTH fileList NUMLIST)
if(NUMLIST EQUAL 0)
file(GLOB fileList "${${incDir}}/${folder}${dllName64}")
endif()
endif()
list(LENGTH fileList NUMLIST)
if(NUMLIST EQUAL 0)
message(STATUS "MISSING: unable to find ${targetVar} files (${folder}${dllName}, ${folder}${dllName64})" )
set (${targetVar} "NOTFOUND")
endif()
list(APPEND ${targetVar} ${fileList} )
# message ( "File list: ${${targetVar}}" ) #-- debugging
endmacro()
if (DEFINED OPTIX7_LOCATION OR DEFINED ENV{OPTIX7_LOCATION} )
Message(STATUS "using OPTIX7_LOCATION (${OPTIX7_LOCATION})...")
if(NOT DEFINED OPTIX7_LOCATION)
if(DEFINED ENV{OPTIX7_LOCATION})
set(OPTIX7_LOCATION $ENV{OPTIX7_LOCATION})
endif()
endif()
# Locate by version failed. Handle user override for OPTIX7_LOCATION.
string ( REGEX MATCH ".*([7]+).([0-9]+).([0-9]+)(.*)$" result "${OPTIX7_LOCATION}" )
if ( "${result}" STREQUAL "${OPTIX7_LOCATION}" )
SET ( bestver "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" )
SET ( bestmajorver ${CMAKE_MATCH_1})
SET ( bestminorver ${CMAKE_MATCH_2})
Message(STATUS "found version ${bestver}")
else()
Message(WARNING "Could NOT extract the version from OptiX7 folder : ${result}")
endif()
find_path( OPTIX7_INCLUDE_DIR optix.h ${OPTIX7_LOCATION}/include )
if ( OPTIX7_INCLUDE_DIR )
set (OPTIX7_ROOT_DIR ${OPTIX7_INCLUDE_DIR}/../ )
endif()
endif()
if(NOT DEFINED OPTIX7_ROOT_DIR)
# Locate OptiX by version
set ( SEARCH_PATHS
$ENV{OPTIX7_LOCATION}
${OPTIX7_LOCATION}
${PROJECT_SOURCE_DIR}/../LocalPackages/Optix
${PROJECT_SOURCE_DIR}/../../LocalPackages/Optix
${PROJECT_SOURCE_DIR}/../../../LocalPackages/Optix
C:/ProgramData/NVIDIA\ Corporation
)
_find_version_path ( OPTIX7_VERSION OPTIX7_ROOT_DIR "OptiX" "${SEARCH_PATHS}" )
message ( STATUS "OptiX version: ${OPTIX7_VERSION}")
endif()
if (OPTIX7_ROOT_DIR)
#-------- Locate HEADERS
_find_files( OPTIX7_HEADERS OPTIX7_ROOT_DIR "optix.h" "optix.h" "include/" )
include(FindPackageHandleStandardArgs)
SET(OPTIX7_INCLUDE_DIR "${OPTIX7_ROOT_DIR}/include" CACHE PATH "path")
add_definitions("-DOPTIX7_PATH=R\"(${OPTIX7_ROOT_DIR})\"")
add_definitions("-DOPTIX7_VERSION_STR=\"${OPTIX7_VERSION}\"")
else(OPTIX7_ROOT_DIR)
message(WARNING "
OPTIX not found.
The OPTIX folder you would specify with OPTIX7_LOCATION should contain:
- lib[64] folder: containing the Optix[64_]*.dll or *.so
- include folder: containing the include files"
)
endif(OPTIX7_ROOT_DIR)
find_package_handle_standard_args(Optix7 DEFAULT_MSG OPTIX7_ROOT_DIR)
mark_as_advanced( OPTIX7_FOUND )

View file

@ -0,0 +1,48 @@
# Try to find PYBIND11 project so and include file
#
set(PYBIND11_LOCATION "" CACHE STRING "Set to location of pybind11 library/headers")
unset(PYBIND11_INCLUDE_DIR CACHE)
unset(PYBIND11_FOUND CACHE)
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
endif()
if(USE_PACKMAN)
message(STATUS "attempting to using packman to source pybind11")
pull_dependencies(DEPENDENCY_FILE "pybind11-deps.packman.xml")
set(PYBIND11_LOCATION "${BASE_DIRECTORY}/nvpro_core/OV/downloaded/pybind11")
endif()
if (NOT DEFINED PYBIND11_LOCATION)
message(WARNING "PYBIND11_LOCATION is not defined")
elseif(NOT EXISTS ${PYBIND11_LOCATION})
message(WARNING "PYBIND11_LOCATION doesn't exist")
endif()
find_path(PYBIND11_INCLUDE_DIR
NAMES pybind11/pybind11.h
PATHS ${PYBIND11_LOCATION}
)
if(PYBIND11_INCLUDE_DIR)
message(STATUS " pybind11.h found in ${PYBIND11_INCLUDE_DIR}")
set( PYBIND11_FOUND "YES" )
else(PYBIND11_INCLUDE_DIR)
message(WARNING "
pybind11 not found.")
endif(PYBIND11_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Pybind11 DEFAULT_MSG
PYBIND11_INCLUDE_DIR
)
set(PYBIND11_INCLUDE_DIR ${PYBIND11_INCLUDE_DIR} CACHE PATH "path")
mark_as_advanced( PYBIND11_FOUND )