forked from FreeCAD/FreeCAD
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFindRift.cmake
100 lines (89 loc) · 3.17 KB
/
FindRift.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Find OCULUS
#
# This module defines
# OCULUS_FOUND
# OCULUS_INCLUDE_DIRS
# OCULUS_LIBRARIES
#
# Copyright (c) 2012 I-maginer
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA, or go to
# http://www.gnu.org/copyleft/lesser.txt
#
# On a new cmake run, we do not need to be verbose
IF(OCULUS_INCLUDE_DIR AND OCULUS_LIBRARY)
SET(OCULUS_FIND_QUIETLY FALSE)
ENDIF()
# If OCULUS_ROOT was defined in the environment, use it.
if (NOT OCULUS_ROOT)
if(NOT "$ENV{OCULUS_ROOT}" STREQUAL "")
set(OCULUS_ROOT $ENV{OCULUS_ROOT})
else()
set(OCULUS_ROOT $ENV{SCOL_DEPENDENCIES_PATH}/oculus/LibOVR)
endif()
endif()
# concat all the search paths
IF(OCULUS_ROOT)
SET(OCULUS_INCLUDE_SEARCH_DIRS
${OCULUS_INCLUDE_SEARCH_DIRS}
${OCULUS_ROOT}/include
)
SET(OCULUS_LIBRARY_SEARCH_RELEASE_DIRS
${OCULUS_LIBRARY_SEARCH_DIRS}
${OCULUS_ROOT}/Lib/x64/VS2012
)
SET(OCULUS_LIBRARY_SEARCH_DEBUG_DIRS
${OCULUS_LIBRARY_SEARCH_DIRS}
${OCULUS_ROOT}/Lib/x64/VS2012
)
ENDIF()
# log message
IF (NOT OCULUS_FIND_QUIETLY)
MESSAGE(STATUS "Checking for OCULUS library")
ENDIF()
# Search for header files
FIND_PATH(OCULUS_INCLUDE_DIR OVR.h
PATHS ${OCULUS_INCLUDE_SEARCH_DIRS})
# Search for libraries files (release mode)
FIND_LIBRARY(OCULUS_LIBRARY_RELEASE libovr64
PATHS ${OCULUS_LIBRARY_SEARCH_RELEASE_DIRS})
# Search for libraries files (debug mode)
FIND_LIBRARY(OCULUS_LIBRARY_DEBUG libovr64d
PATHS ${OCULUS_LIBRARY_SEARCH_DEBUG_DIRS})
# Configure libraries for debug/release
SET(OCULUS_INCLUDE_DIRS ${OCULUS_INCLUDE_DIR} CACHE PATH "Directory containing OCULUS header files")
SET(OCULUS_LIBRARY debug ${OCULUS_LIBRARY_DEBUG} optimized ${OCULUS_LIBRARY_RELEASE})
SET(OCULUS_LIBRARIES ${OCULUS_LIBRARY} CACHE STRING "OCULUS libraries files")
#IF(OCULUS_INCLUDE_DIR AND OCULUS_LIBRARY)
SET(OCULUS_FOUND TRUE)
#ENDIF()
# Hide those variables in GUI
SET(OCULUS_INCLUDE_DIR ${OCULUS_INCLUDE_DIR} CACHE INTERNAL "")
SET(OCULUS_LIBRARY_RELEASE ${OCULUS_LIBRARY_RELEASE} CACHE INTERNAL "")
SET(OCULUS_LIBRARY_DEBUG ${OCULUS_LIBRARY_DEBUG} CACHE INTERNAL "")
SET(OCULUS_LIBRARY ${OCULUS_LIBRARY} CACHE INTERNAL "")
# log find result
IF(OCULUS_FOUND)
IF(NOT OCULUS_FIND_QUIETLY)
MESSAGE(STATUS " libraries: ${OCULUS_LIBRARIES}")
MESSAGE(STATUS " includes: ${OCULUS_INCLUDE_DIRS}")
ENDIF()
ELSE(OCULUS_FOUND)
IF(NOT OCULUS_LIBRARIES)
MESSAGE(STATUS, "OCULUS library or one of it dependencies could not be found.")
ENDIF()
IF(NOT OCULUS_INCLUDE_DIRS)
MESSAGE(STATUS "OCULUS include files could not be found.")
ENDIF()
ENDIF(OCULUS_FOUND)