Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/audio/cmake/FindOpenAL.cmake @ 350

Last change on this file since 350 was 345, checked in by nicolasc, 17 years ago

some minor changes

File size: 3.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# Created by Eric Wing. This was influenced by the FindSDL.cmake module.
12# On OSX, this will prefer the Framework version (if found) over others.
13# People will have to manually change the cache values of
14# OPENAL_LIBRARY to override this selection.
15# Tiger will include OpenAL as part of the System.
16# But for now, we have to look around.
17# Other (Unix) systems should be able to utilize the non-framework paths.
18FIND_PATH(OPENAL_INCLUDE_DIR al.h
19  $ENV{OPENALDIR}/include
20  ~/Library/Frameworks/OpenAL.framework/Headers
21  /Library/Frameworks/OpenAL.framework/Headers
22  /System/Library/Frameworks/OpenAL.framework/Headers # Tiger
23  /usr/pack/openal-0.0.8-cl/include/AL # Tardis specific hack
24  /usr/local/include/AL
25  /usr/local/include/OpenAL
26  /usr/local/include
27  /usr/include/AL
28  /usr/include/OpenAL
29  /usr/include
30  /sw/include/AL # Fink
31  /sw/include/OpenAL
32  /sw/include
33  /opt/local/include/AL # DarwinPorts
34  /opt/local/include/OpenAL
35  /opt/local/include
36  /opt/csw/include/AL # Blastwave
37  /opt/csw/include/OpenAL
38  /opt/csw/include
39  /opt/include/AL
40  /opt/include/OpenAL
41  /opt/include
42  )
43# I'm not sure if I should do a special casing for Apple. It is
44# unlikely that other Unix systems will find the framework path.
45# But if they do ([Next|Open|GNU]Step?),
46# do they want the -framework option also?
47IF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
48  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" OPENAL_FRAMEWORK_PATH_TMP ${OPENAL_INCLUDE_DIR})
49  IF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
50      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
51      )
52    # String is in default search path, don't need to use -F
53    SET (OPENAL_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
54  ELSE("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
55      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
56      )
57    # String is not /Library/Frameworks, need to use -F
58    SET(OPENAL_LIBRARY "-F${OPENAL_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
59  ENDIF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
60    OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
61    )
62  # Clear the temp variable so nobody can see it
63  SET(OPENAL_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
64
65ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
66  FIND_LIBRARY(OPENAL_LIBRARY
67    NAMES openal al OpenAL32
68    PATHS
69    $ENV{OPENALDIR}/lib
70    $ENV{OPENALDIR}/libs
71    /usr/local/lib
72    /usr/lib
73    /sw/lib
74    /opt/local/lib
75    /opt/csw/lib
76    /opt/lib
77    )
78ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
79
80SET(OPENAL_FOUND "NO")
81IF(OPENAL_LIBRARY)
82  SET(OPENAL_FOUND "YES")
83ENDIF(OPENAL_LIBRARY)
84
85
Note: See TracBrowser for help on using the repository browser.