Merge branch 'ryzom/ark-features' into main/rendor-staging
[ryzomcore.git] / CMakeModules / FindLibOVR.cmake
blob081fa0bca1f1724a51205476b1e2c01eacda98d6
1 # - Locate LibOVR library
2 # This module defines
3 #  LIBOVR_LIBRARIES, the libraries to link against
4 #  LIBOVR_FOUND, if false, do not try to link to LIBOVR
5 #  LIBOVR_INCLUDE_DIR, where to find headers.
7 IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
8   # in cache already
9   SET(LIBOVR_FIND_QUIETLY TRUE)
10 ENDIF()
12 FIND_PATH(LIBOVR_INCLUDE_DIR
13   NAMES
14   OVR.h OVR_CAPI.h
15   PATHS
16   $ENV{LIBOVR_DIR}/Include
17   /usr/local/include
18   /usr/include
19   /sw/include
20   /opt/local/include
21   /opt/csw/include
22   /opt/include
25 IF(UNIX)
26   IF(TARGET_X64)
27     SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64")
28   ELSE()
29     SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386")
30   ENDIF()
31 ELSEIF(APPLE)
32   SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release")
33 ELSEIF(WIN32)
34   IF(TARGET_X64)
35     SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64")
36   ELSE()
37     SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32")
38   ENDIF()
39 ENDIF()
41 FIND_LIBRARY(LIBOVR_LIBRARY
42   NAMES ovr libovr
43   PATHS
44   $ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH}
45   /usr/local/lib
46   /usr/lib
47   /usr/local/X11R6/lib
48   /usr/X11R6/lib
49   /sw/lib
50   /opt/local/lib
51   /opt/csw/lib
52   /opt/lib
53   /usr/freeware/lib64
56 IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
57   IF(NOT LIBOVR_FIND_QUIETLY)
58     MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}")
59   ENDIF()
60   SET(LIBOVR_FOUND "YES")
61   SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR")
62   SET(NL_STEREO_AVAILABLE ON)
63   IF(UNIX)
64     SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread)
65   ELSE()
66     SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY})
67   ENDIF()
68 ELSE()
69   IF(NOT LIBOVR_FIND_QUIETLY)
70     MESSAGE(STATUS "Warning: Unable to find LibOVR!")
71   ENDIF()
72 ENDIF()