[1505] | 1 | # - Locate FreeAlut |
---|
| 2 | # This module defines |
---|
| 3 | # ALUT_LIBRARY |
---|
[2626] | 4 | # ALUT_FOUND, if false, do not try to link against Alut |
---|
[1505] | 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 |
---|
[2626] | 20 | # Some simplifications by Adrian Friedli and Reto Grieder |
---|
[1776] | 21 | # > www.orxonox.net < |
---|
| 22 | |
---|
[2583] | 23 | INCLUDE(FindPackageHandleStandardArgs) |
---|
| 24 | INCLUDE(HandleLibraryTypes) |
---|
| 25 | |
---|
[1505] | 26 | FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h |
---|
[2509] | 27 | PATHS |
---|
[2616] | 28 | $ENV{ALUTDIR} |
---|
[2509] | 29 | ~/Library/Frameworks/OpenAL.framework |
---|
| 30 | /Library/Frameworks/OpenAL.framework |
---|
| 31 | /System/Library/Frameworks/OpenAL.framework # Tiger |
---|
| 32 | PATH_SUFFIXES include include/OpenAL include/AL Headers |
---|
[2579] | 33 | ) |
---|
[1776] | 34 | |
---|
[1505] | 35 | # I'm not sure if I should do a special casing for Apple. It is |
---|
| 36 | # unlikely that other Unix systems will find the framework path. |
---|
| 37 | # But if they do ([Next|Open|GNU]Step?), |
---|
| 38 | # do they want the -framework option also? |
---|
| 39 | IF(${ALUT_INCLUDE_DIR} MATCHES ".framework") |
---|
[2579] | 40 | |
---|
[1505] | 41 | STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR}) |
---|
| 42 | IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" |
---|
| 43 | OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" |
---|
| 44 | ) |
---|
| 45 | # String is in default search path, don't need to use -F |
---|
[2579] | 46 | SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX") |
---|
[2624] | 47 | ELSE() |
---|
[1505] | 48 | # String is not /Library/Frameworks, need to use -F |
---|
[2579] | 49 | SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX") |
---|
[2624] | 50 | ENDIF() |
---|
[1505] | 51 | # Clear the temp variable so nobody can see it |
---|
| 52 | SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") |
---|
| 53 | |
---|
[2624] | 54 | ELSE() |
---|
[2579] | 55 | FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED |
---|
[1505] | 56 | NAMES alut |
---|
[2616] | 57 | PATHS $ENV{ALUTDIR} |
---|
[2509] | 58 | PATH_SUFFIXES lib libs |
---|
[2579] | 59 | ) |
---|
| 60 | FIND_LIBRARY(ALUT_LIBRARY_DEBUG |
---|
[2648] | 61 | NAMES alutd alut_d alutD alut_D |
---|
[2616] | 62 | PATHS $ENV{ALUTDIR} |
---|
[2579] | 63 | PATH_SUFFIXES lib libs |
---|
| 64 | ) |
---|
[2624] | 65 | ENDIF() |
---|
[1505] | 66 | |
---|
[2616] | 67 | # Handle the REQUIRED argument and set ALUT_FOUND |
---|
[2579] | 68 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG |
---|
[2628] | 69 | ALUT_LIBRARY_OPTIMIZED |
---|
[2616] | 70 | ALUT_INCLUDE_DIR |
---|
[2579] | 71 | ) |
---|
[1505] | 72 | |
---|
[2616] | 73 | # Collect optimized and debug libraries |
---|
[2614] | 74 | HANDLE_LIBRARY_TYPES(ALUT) |
---|
[2579] | 75 | |
---|
| 76 | MARK_AS_ADVANCED( |
---|
[2616] | 77 | ALUT_INCLUDE_DIR |
---|
[2579] | 78 | ALUT_LIBRARY_OPTIMIZED |
---|
| 79 | ALUT_LIBRARY_DEBUG |
---|
| 80 | ) |
---|