[1505] | 1 | # - Locate FreeAlut |
---|
| 2 | # This module defines |
---|
| 3 | # ALUT_LIBRARY |
---|
| 4 | # ALUT_FOUND, if false, do not try to link to Alut |
---|
| 5 | # ALUT_INCLUDE_DIR, where to find the headers |
---|
| 6 | # |
---|
| 7 | # $ALUTDIR is an environment variable that would |
---|
| 8 | # correspond to the ./configure --prefix=$ALUTDIR |
---|
| 9 | # used in building Alut. |
---|
| 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 | # ALUT_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. |
---|
[1776] | 18 | # |
---|
| 19 | # Several changes and additions by Fabian 'x3n' Landau |
---|
[2509] | 20 | # Some simplifications by Adrian Friedli |
---|
[1776] | 21 | # > www.orxonox.net < |
---|
| 22 | |
---|
[2583] | 23 | INCLUDE(FindPackageHandleStandardArgs) |
---|
| 24 | INCLUDE(HandleLibraryTypes) |
---|
| 25 | |
---|
[2579] | 26 | SET(ALUT_PATHS |
---|
| 27 | $ENV{ALUTDIR} |
---|
| 28 | /usr/local |
---|
| 29 | /usr |
---|
| 30 | /sw # Fink |
---|
| 31 | /opt/local # DarwinPorts |
---|
| 32 | /opt/csw # Blastwave |
---|
| 33 | /opt |
---|
| 34 | ) |
---|
| 35 | |
---|
[1505] | 36 | FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h |
---|
[2509] | 37 | PATHS |
---|
[2579] | 38 | ${ALUT_PATHS} |
---|
[2509] | 39 | ~/Library/Frameworks/OpenAL.framework |
---|
| 40 | /Library/Frameworks/OpenAL.framework |
---|
| 41 | /System/Library/Frameworks/OpenAL.framework # Tiger |
---|
| 42 | PATH_SUFFIXES include include/OpenAL include/AL Headers |
---|
[2579] | 43 | ) |
---|
[1776] | 44 | |
---|
[1505] | 45 | # I'm not sure if I should do a special casing for Apple. It is |
---|
| 46 | # unlikely that other Unix systems will find the framework path. |
---|
| 47 | # But if they do ([Next|Open|GNU]Step?), |
---|
| 48 | # do they want the -framework option also? |
---|
| 49 | IF(${ALUT_INCLUDE_DIR} MATCHES ".framework") |
---|
[2579] | 50 | |
---|
[1505] | 51 | STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR}) |
---|
| 52 | IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" |
---|
| 53 | OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" |
---|
| 54 | ) |
---|
| 55 | # String is in default search path, don't need to use -F |
---|
[2579] | 56 | SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX") |
---|
[1505] | 57 | ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" |
---|
| 58 | OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" |
---|
| 59 | ) |
---|
| 60 | # String is not /Library/Frameworks, need to use -F |
---|
[2579] | 61 | SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX") |
---|
[1505] | 62 | ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" |
---|
| 63 | OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" |
---|
| 64 | ) |
---|
| 65 | # Clear the temp variable so nobody can see it |
---|
| 66 | SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") |
---|
| 67 | |
---|
| 68 | ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework") |
---|
[2579] | 69 | FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED |
---|
[1505] | 70 | NAMES alut |
---|
[2579] | 71 | PATHS ${ALUT_PATHS} |
---|
[2509] | 72 | PATH_SUFFIXES lib libs |
---|
[2579] | 73 | ) |
---|
| 74 | FIND_LIBRARY(ALUT_LIBRARY_DEBUG |
---|
[2583] | 75 | NAMES alut${LIBRARY_DEBUG_POSTFIX} |
---|
[2579] | 76 | PATHS ${ALUT_PATHS} |
---|
| 77 | PATH_SUFFIXES lib libs |
---|
| 78 | ) |
---|
[1505] | 79 | ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework") |
---|
| 80 | |
---|
[2509] | 81 | # handle the QUIETLY and REQUIRED arguments and set ALUT_FOUND to TRUE if |
---|
| 82 | # all listed variables are TRUE |
---|
[2579] | 83 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG |
---|
| 84 | ALUT_LIBRARY_OPTIMIZED |
---|
| 85 | ALUT_INCLUDE_DIR |
---|
| 86 | ) |
---|
[1505] | 87 | |
---|
[2579] | 88 | # Set optimized and debug libraries |
---|
| 89 | HandleLibraryTypes(ALUT) |
---|
| 90 | |
---|
| 91 | MARK_AS_ADVANCED( |
---|
| 92 | ALUT_LIBRARY |
---|
| 93 | ALUT_LIBRARY_OPTIMIZED |
---|
| 94 | ALUT_LIBRARY_DEBUG |
---|
| 95 | ALUT_INCLUDE_DIR |
---|
| 96 | ) |
---|