Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/lod/cmake/FindOpenAL.cmake @ 2764

Last change on this file since 2764 was 1872, checked in by rgrieder, 16 years ago
  • Modified cmake files to support library finding when using Visual Studio precompiled dependencies
  • Removed vorbisenc executable from library dependency
  • 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  ${DEPENDENCY_DIR}/openal-1.1/include
51  )
52# I'm not sure if I should do a special casing for Apple. It is
53# unlikely that other Unix systems will find the framework path.
54# But if they do ([Next|Open|GNU]Step?),
55# do they want the -framework option also?
56IF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
57  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" OPENAL_FRAMEWORK_PATH_TMP ${OPENAL_INCLUDE_DIR})
58  IF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
59      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
60      )
61    # String is in default search path, don't need to use -F
62    SET (OPENAL_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
63  ELSE("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
64      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
65      )
66    # String is not /Library/Frameworks, need to use -F
67    SET(OPENAL_LIBRARY "-F${OPENAL_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
68  ENDIF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
69    OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
70    )
71  # Clear the temp variable so nobody can see it
72  SET(OPENAL_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
73
74ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
75  FIND_LIBRARY(OPENAL_LIBRARY
76    NAMES openal al OpenAL32
77    PATHS
78    $ENV{OPENALDIR}/lib
79    $ENV{OPENALDIR}/libs
80    /usr/pack/openal-0.0.8-cl/i686-debian-linux3.1/lib
81    /usr/local/lib
82    /usr/lib
83    /sw/lib
84    /opt/local/lib
85    /opt/csw/lib
86    /opt/lib
87    ../libs/openal-0.0.8/src/.libs
88    ${DEPENDENCY_DIR}/openal-1.1/lib
89    )
90ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
91
92SET (OPENAL_FOUND "NO")
93
94IF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
95  SET (OPENAL_FOUND "YES")
96  IF (NOT OPENAL_FIND_QUIETLY)
97    MESSAGE (STATUS "OpenAL was found.")
98    IF (VERBOSE_FIND)
99      MESSAGE (STATUS "  include path: ${OPENAL_INCLUDE_DIR}")
100      MESSAGE (STATUS "  library path: ${OPENAL_LIBRARY}")
101      MESSAGE (STATUS "  libraries:    openal al OpenAL32")
102    ENDIF (VERBOSE_FIND)
103  ENDIF (NOT OPENAL_FIND_QUIETLY)
104ELSE (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
105  IF (NOT OPENAL_INCLUDE_DIR)
106    MESSAGE (SEND_ERROR "OpenAL include path was not found.")
107  ENDIF (NOT OPENAL_INCLUDE_DIR)
108  IF (NOT OPENAL_LIBRARY)
109    MESSAGE (SEND_ERROR "OpenAL library was not found.")
110  ENDIF (NOT OPENAL_LIBRARY)
111ENDIF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
112
113
Note: See TracBrowser for help on using the repository browser.