[344] | 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 | # |
---|
[377] | 11 | |
---|
[344] | 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. |
---|
[377] | 19 | FIND_PATH(OPENAL_INCLUDE_DIR AL/al.h |
---|
[344] | 20 | $ENV{OPENALDIR}/include |
---|
| 21 | ~/Library/Frameworks/OpenAL.framework/Headers |
---|
| 22 | /Library/Frameworks/OpenAL.framework/Headers |
---|
| 23 | /System/Library/Frameworks/OpenAL.framework/Headers # Tiger |
---|
[377] | 24 | /usr/pack/openal-0.0.8-cl/include # Tardis specific hack |
---|
| 25 | /usr/local/include/ |
---|
[344] | 26 | /usr/local/include/OpenAL |
---|
| 27 | /usr/local/include |
---|
[377] | 28 | /usr/include/ |
---|
[344] | 29 | /usr/include/OpenAL |
---|
| 30 | /usr/include |
---|
[377] | 31 | /sw/include # Fink |
---|
[344] | 32 | /sw/include/OpenAL |
---|
| 33 | /sw/include |
---|
[377] | 34 | /opt/local/include # DarwinPorts |
---|
[344] | 35 | /opt/local/include/OpenAL |
---|
| 36 | /opt/local/include |
---|
[377] | 37 | /opt/csw/include # Blastwave |
---|
[344] | 38 | /opt/csw/include/OpenAL |
---|
| 39 | /opt/csw/include |
---|
[377] | 40 | /opt/include |
---|
[344] | 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? |
---|
| 48 | IF(${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 | |
---|
| 66 | ELSE(${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 |
---|
[377] | 72 | /usr/pack/openal-0.0.8-cl/i686-debian-linux3.1/lib |
---|
[344] | 73 | /usr/local/lib |
---|
| 74 | /usr/lib |
---|
| 75 | /sw/lib |
---|
| 76 | /opt/local/lib |
---|
| 77 | /opt/csw/lib |
---|
| 78 | /opt/lib |
---|
| 79 | ) |
---|
| 80 | ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework") |
---|
| 81 | |
---|
| 82 | SET(OPENAL_FOUND "NO") |
---|
| 83 | IF(OPENAL_LIBRARY) |
---|
| 84 | SET(OPENAL_FOUND "YES") |
---|
[409] | 85 | MESSAGE(STATUS "OpenAL was found.") |
---|
[344] | 86 | ENDIF(OPENAL_LIBRARY) |
---|
| 87 | |
---|
| 88 | |
---|