|
| 1 | +## ======================================================================================= ## |
| 2 | +## Copyright 2014-2015 Texas Advanced Computing Center, The University of Texas at Austin ## |
| 3 | +## All rights reserved. ## |
| 4 | +## ## |
| 5 | +## Licensed under the BSD 3-Clause License, (the "License"); you may not use this file ## |
| 6 | +## except in compliance with the License. ## |
| 7 | +## A copy of the License is included with this software in the file LICENSE. ## |
| 8 | +## If your copy does not contain the License, you may obtain a copy of the License at: ## |
| 9 | +## ## |
| 10 | +## http://opensource.org/licenses/BSD-3-Clause ## |
| 11 | +## ## |
| 12 | +## Unless required by applicable law or agreed to in writing, software distributed under ## |
| 13 | +## the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ## |
| 14 | +## KIND, either express or implied. ## |
| 15 | +## See the License for the specific language governing permissions and limitations under ## |
| 16 | +## limitations under the License. ## |
| 17 | +## ======================================================================================= ## |
| 18 | + |
| 19 | + |
| 20 | +############################################################################### |
| 21 | +# Find OSPRay |
| 22 | +# defines: |
| 23 | +# OSPRAY_FOUND |
| 24 | +# OSPRAY_INCLUDE_DIRS |
| 25 | +# OSPRAY_LIBRARIES |
| 26 | + |
| 27 | +set(OSPRAY_INSTALL_DIR "" CACHE PATH "install location of ospray") |
| 28 | +mark_as_advanced(OSPRAY_INSTALL_DIR) |
| 29 | +set(OSPRAY_BUILD_DIR "" CACHE PATH "build location of ospray") |
| 30 | +mark_as_advanced(OSPRAY_BUILD_DIR) |
| 31 | +if (OSPRAY_INSTALL_DIR AND OSPRAY_BUILD_DIR) |
| 32 | + message("Ignoring the ospray build location in favor of the intall location.") |
| 33 | +endif() |
| 34 | + |
| 35 | +if (OSPRAY_INSTALL_DIR) |
| 36 | + |
| 37 | + find_package(ospray CONFIG REQUIRED HINTS ${OSPRAY_INSTALL_DIR}) |
| 38 | + |
| 39 | +else() |
| 40 | + |
| 41 | + if (OSPRAY_BUILD_DIR) |
| 42 | + #find corresponding source directory |
| 43 | + load_cache(${OSPRAY_BUILD_DIR} READ_WITH_PREFIX OSP_ |
| 44 | + CMAKE_HOME_DIRECTORY |
| 45 | + embree_DIR |
| 46 | + ) |
| 47 | + set(OSPRAY_SOURCE_DIR ${OSP_CMAKE_HOME_DIRECTORY}) |
| 48 | + |
| 49 | + set(OSPRAY_INCLUDE_DIRS |
| 50 | + ${OSPRAY_BUILD_DIR} |
| 51 | + ${OSPRAY_BUILD_DIR}/include |
| 52 | + ${OSPRAY_SOURCE_DIR} |
| 53 | + ${OSPRAY_SOURCE_DIR}/ospray/include |
| 54 | + ) |
| 55 | + |
| 56 | + # message(${OSP_embree_DIR}) |
| 57 | + # message(${OSP_embree_DIR}/bin) |
| 58 | + # set(LIB_OSPRAY_EMBREE LIB_OSPRAY_EMBREE-NOTFOUND) |
| 59 | + # find_library(LIB_OSPRAY_EMBREE NAMES ospray_embree embree |
| 60 | + # PATHS ${OSPRAY_BUILD_DIR} ${OSPRAY_BUILD_DIR}/Release |
| 61 | + # ${OSP_embree_DIR} ${OSP_embree_DIR}/bin NO_DEFAULT_PATH) |
| 62 | + # mark_as_advanced(LIB_OSPRAY_EMBREE) |
| 63 | + |
| 64 | + set(LIB_OSPRAY_COMMON LIB_OSPRAY_COMMON-NOTFOUND) |
| 65 | + find_library(LIB_OSPRAY_COMMON ospray_common |
| 66 | + PATHS ${OSPRAY_BUILD_DIR} ${OSPRAY_BUILD_DIR}/Release NO_DEFAULT_PATH) |
| 67 | + mark_as_advanced(LIB_OSPRAY_COMMON) |
| 68 | + |
| 69 | + set(LIB_OSPRAY LIB_OSPRAY-NOTFOUND) |
| 70 | + find_library(LIB_OSPRAY ospray PATHS ${OSPRAY_BUILD_DIR} ${OSPRAY_BUILD_DIR}/Release NO_DEFAULT_PATH) |
| 71 | + mark_as_advanced(LIB_OSPRAY) |
| 72 | + |
| 73 | + set(OSPRAY_LIBRARIES ${LIB_OSPRAY_COMMON} ${LIB_OSPRAY}) |
| 74 | + |
| 75 | + else() |
| 76 | + |
| 77 | + message("Supply OSPRAY_INSTALL_DIR or OSPRAY_BUILD_DIR to find OSPRay") |
| 78 | + |
| 79 | + endif() |
| 80 | + |
| 81 | +endif() |
0 commit comments