Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/tutorialHS08/cmake/FindOpenAL.cmake @ 8983

Last change on this file since 8983 was 1776, checked in by landauf, 16 years ago

Many changes in almost all FindXYZ.cmake files. They now throw errors if something wasn't found.

  • Property svn:eol-style set to native
File size: 4.0 KB
Line 
1# - Locate OpenAL
2# This module defines
3#  OPENAL_LIBRARY
4#  OPENAL_FOUND, if false, do not try to link to OpenAL
5#  OPENAL_INCLUDE_DIR, where to find the headers
6#
7# $OPENALDIR is an environment variable that would
8# correspond to the ./configure --prefix=$OPENALDIR
9# used in building OpenAL.
10#
11# Several changes and additions by Fabian 'x3n' Landau
12#                 > www.orxonox.net <
13
14IF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
15  SET(OPENAL_FIND_QUIETLY TRUE)
16ENDIF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
17
18# Created by Eric Wing. This was influenced by the FindSDL.cmake module.
19# On OSX, this will prefer the Framework version (if found) over others.
20# People will have to manually change the cache values of
21# OPENAL_LIBRARY to override this selection.
22# Tiger will include OpenAL as part of the System.
23# But for now, we have to look around.
24# Other (Unix) systems should be able to utilize the non-framework paths.
25FIND_PATH(OPENAL_INCLUDE_DIR AL/al.h
26  $ENV{OPENALDIR}/include
27  ~/Library/Frameworks/OpenAL.framework/Headers
28  /Library/Frameworks/OpenAL.framework/Headers
29  /System/Library/Frameworks/OpenAL.framework/Headers # Tiger
30  /usr/pack/openal-0.0.8-cl/include # Tardis specific hack
31  /usr/local/include/
32  /usr/local/include/OpenAL
33  /usr/local/include
34  /usr/include/
35  /usr/include/OpenAL
36  /usr/include
37  /sw/include # Fink
38  /sw/include/OpenAL
39  /sw/include
40  /opt/local/include # DarwinPorts
41  /opt/local/include/OpenAL
42  /opt/local/include
43  /opt/csw/include # Blastwave
44  /opt/csw/include/OpenAL
45  /opt/csw/include
46  /opt/include
47  /opt/include/OpenAL
48  /opt/include
49  ../libs/openal-0.0.8/common/include
50  )
51# I'm not sure if I should do a special casing for Apple. It is
52# unlikely that other Unix systems will find the framework path.
53# But if they do ([Next|Open|GNU]Step?),
54# do they want the -framework option also?
55IF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
56  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" OPENAL_FRAMEWORK_PATH_TMP ${OPENAL_INCLUDE_DIR})
57  IF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
58      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
59      )
60    # String is in default search path, don't need to use -F
61    SET (OPENAL_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
62  ELSE("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
63      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
64      )
65    # String is not /Library/Frameworks, need to use -F
66    SET(OPENAL_LIBRARY "-F${OPENAL_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
67  ENDIF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
68    OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
69    )
70  # Clear the temp variable so nobody can see it
71  SET(OPENAL_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
72
73ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
74  FIND_LIBRARY(OPENAL_LIBRARY
75    NAMES openal al OpenAL32
76    PATHS
77    $ENV{OPENALDIR}/lib
78    $ENV{OPENALDIR}/libs
79    /usr/pack/openal-0.0.8-cl/i686-debian-linux3.1/lib
80    /usr/local/lib
81    /usr/lib
82    /sw/lib
83    /opt/local/lib
84    /opt/csw/lib
85    /opt/lib
86    ../libs/openal-0.0.8/src/.libs
87    )
88ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
89
90SET (OPENAL_FOUND "NO")
91
92IF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
93  SET (OPENAL_FOUND "YES")
94  IF (NOT OPENAL_FIND_QUIETLY)
95    MESSAGE (STATUS "OpenAL was found.")
96    IF (VERBOSE_FIND)
97      MESSAGE (STATUS "  include path: ${OPENAL_INCLUDE_DIR}")
98      MESSAGE (STATUS "  library path: ${OPENAL_LIBRARY}")
99      MESSAGE (STATUS "  libraries:    openal al OpenAL32")
100    ENDIF (VERBOSE_FIND)
101  ENDIF (NOT OPENAL_FIND_QUIETLY)
102ELSE (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
103  IF (NOT OPENAL_INCLUDE_DIR)
104    MESSAGE (SEND_ERROR "OpenAL include path was not found.")
105  ENDIF (NOT OPENAL_INCLUDE_DIR)
106  IF (NOT OPENAL_LIBRARY)
107    MESSAGE (SEND_ERROR "OpenAL library was not found.")
108  ENDIF (NOT OPENAL_LIBRARY)
109ENDIF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
110
111
Note: See TracBrowser for help on using the repository browser.