Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/cmake/FindOpenAL.cmake @ 402

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

merged audio into FICN

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