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. |
---|
18 | # |
---|
19 | # Several changes and additions by Fabian 'x3n' Landau |
---|
20 | # Some simplifications by Adrian Friedli |
---|
21 | # > www.orxonox.net < |
---|
22 | |
---|
23 | IF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR) |
---|
24 | SET (ALUT_FIND_QUIETLY TRUE) |
---|
25 | ENDIF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR) |
---|
26 | |
---|
27 | FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h |
---|
28 | PATHS |
---|
29 | $ENV{ALUTDIR} |
---|
30 | ~/Library/Frameworks/OpenAL.framework |
---|
31 | /Library/Frameworks/OpenAL.framework |
---|
32 | /System/Library/Frameworks/OpenAL.framework # Tiger |
---|
33 | /usr/local |
---|
34 | /usr |
---|
35 | /sw # Fink |
---|
36 | /opt/local # DarwinPorts |
---|
37 | /opt/csw # Blastwave |
---|
38 | /opt |
---|
39 | PATH_SUFFIXES include include/OpenAL include/AL Headers |
---|
40 | ) |
---|
41 | |
---|
42 | # I'm not sure if I should do a special casing for Apple. It is |
---|
43 | # unlikely that other Unix systems will find the framework path. |
---|
44 | # But if they do ([Next|Open|GNU]Step?), |
---|
45 | # do they want the -framework option also? |
---|
46 | IF(${ALUT_INCLUDE_DIR} MATCHES ".framework") |
---|
47 | STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR}) |
---|
48 | IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" |
---|
49 | OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" |
---|
50 | ) |
---|
51 | # String is in default search path, don't need to use -F |
---|
52 | SET (ALUT_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX") |
---|
53 | ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" |
---|
54 | OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" |
---|
55 | ) |
---|
56 | # String is not /Library/Frameworks, need to use -F |
---|
57 | SET(ALUT_LIBRARY "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX") |
---|
58 | ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks" |
---|
59 | OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks" |
---|
60 | ) |
---|
61 | # Clear the temp variable so nobody can see it |
---|
62 | SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "") |
---|
63 | |
---|
64 | ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework") |
---|
65 | FIND_LIBRARY(ALUT_LIBRARY |
---|
66 | NAMES alut |
---|
67 | PATHS |
---|
68 | $ENV{ALUTDIR} |
---|
69 | /usr/local |
---|
70 | /usr |
---|
71 | /sw |
---|
72 | /opt/local |
---|
73 | /opt/csw |
---|
74 | /opt |
---|
75 | PATH_SUFFIXES lib libs |
---|
76 | ) |
---|
77 | ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework") |
---|
78 | |
---|
79 | SET (ALUT_FOUND "NO") |
---|
80 | IF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR) |
---|
81 | SET (ALUT_FOUND "YES") |
---|
82 | IF (NOT ALUT_FIND_QUIETLY) |
---|
83 | MESSAGE (STATUS "FreeAlut was found.") |
---|
84 | IF (VERBOSE_FIND) |
---|
85 | MESSAGE (STATUS " include path: ${ALUT_INCLUDE_DIR}") |
---|
86 | MESSAGE (STATUS " library path: ${ALUT_LIBRARY}") |
---|
87 | MESSAGE (STATUS " libraries: alut") |
---|
88 | ENDIF (VERBOSE_FIND) |
---|
89 | ENDIF (NOT ALUT_FIND_QUIETLY) |
---|
90 | ELSE (ALUT_LIBRARY AND ALUT_INCLUDE_DIR) |
---|
91 | IF (NOT ALUT_INCLUDE_DIR) |
---|
92 | MESSAGE (SEND_ERROR "FreeAlut include path was not found.") |
---|
93 | ENDIF (NOT ALUT_INCLUDE_DIR) |
---|
94 | IF (NOT ALUT_LIBRARY) |
---|
95 | MESSAGE (SEND_ERROR "FreeAlut library was not found.") |
---|
96 | ENDIF (NOT ALUT_LIBRARY) |
---|
97 | ENDIF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR) |
---|