Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added FindOpenAL.cmake
needs some modifications

File size: 2.9 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/local/include/AL
24  /usr/local/include/OpenAL
25  /usr/local/include
26  /usr/include/AL
27  /usr/include/OpenAL
28  /usr/include
29  /sw/include/AL # Fink
30  /sw/include/OpenAL
31  /sw/include
32  /opt/local/include/AL # DarwinPorts
33  /opt/local/include/OpenAL
34  /opt/local/include
35  /opt/csw/include/AL # Blastwave
36  /opt/csw/include/OpenAL
37  /opt/csw/include
38  /opt/include/AL
39  /opt/include/OpenAL
40  /opt/include
41  )
42# I'm not sure if I should do a special casing for Apple. It is
43# unlikely that other Unix systems will find the framework path.
44# But if they do ([Next|Open|GNU]Step?),
45# do they want the -framework option also?
46IF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
47  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" OPENAL_FRAMEWORK_PATH_TMP ${OPENAL_INCLUDE_DIR})
48  IF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
49      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
50      )
51    # String is in default search path, don't need to use -F
52    SET (OPENAL_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
53  ELSE("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
54      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
55      )
56    # String is not /Library/Frameworks, need to use -F
57    SET(OPENAL_LIBRARY "-F${OPENAL_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
58  ENDIF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
59    OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
60    )
61  # Clear the temp variable so nobody can see it
62  SET(OPENAL_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
63
64ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
65  FIND_LIBRARY(OPENAL_LIBRARY
66    NAMES openal al OpenAL32
67    PATHS
68    $ENV{OPENALDIR}/lib
69    $ENV{OPENALDIR}/libs
70    /usr/local/lib
71    /usr/lib
72    /sw/lib
73    /opt/local/lib
74    /opt/csw/lib
75    /opt/lib
76    )
77ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
78
79SET(OPENAL_FOUND "NO")
80IF(OPENAL_LIBRARY)
81  SET(OPENAL_FOUND "YES")
82ENDIF(OPENAL_LIBRARY)
83
84
Note: See TracBrowser for help on using the repository browser.