aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/cmake/OPENAL.cmake
blob: 94fa75df09f2d4a7ea1c3c5753e972522c9f21c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -*- cmake -*-

include(Variables)
include(Linking)

set(OPENAL ON CACHE BOOL "Enable OpenAL")


if (OPENAL)

  # message(STATUS "Building with OpenAL audio support")

  # OPENAL_LIB

  if (WINDOWS)
    find_library(OPENAL_LIB
      NAMES openal32
      PATHS ${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release
      )
  elseif (DARWIN)
    # Look for for system's OpenAL.framework
    find_library(OPENAL_LIB
      NAMES openal.1
      PATHS ${ARCH_PREBUILT_DIRS_RELEASE}
      NO_DEFAULT_PATH
      )
  else (WINDOWS)
    set(OPENAL_LIB openal)
  endif (WINDOWS)
  
  if (NOT OPENAL_LIB)
    message(FATAL_ERROR "OpenAL not found!")
  else (NOT OPENAL_LIB)
    # message(STATUS "OpenAL found: ${OPENAL_LIB}")
  endif (NOT OPENAL_LIB)



  # OPENAL_INCLUDE_DIR

  if (DARWIN)
    set(OPENAL_INCLUDE_DIR "${LIBS_PREBUILT_DIR}/include/AL")        
  else (DARWIN)
    find_path(OPENAL_INCLUDE_DIR
      NAMES al.h
      PATHS ${LIBS_PREBUILT_DIR}/include/AL
      )
  endif (DARWIN)

  if (NOT OPENAL_INCLUDE_DIR)
    message(FATAL_ERROR "al.h not found!")
  else (NOT OPENAL_INCLUDE_DIR)
    # message(STATUS "al.h found in: ${OPENAL_INCLUDE_DIR}")
  endif (NOT OPENAL_INCLUDE_DIR)



  # ALUT_LIB

  if (WINDOWS)
   find_library(ALUT_LIB
     NAMES alut freealut
     PATHS ${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release
     )
  elseif (DARWIN)
    find_library( ALUT_LIB
      NAMES alut.0
      PATHS ${ARCH_PREBUILT_DIRS_RELEASE}
      NO_DEFAULT_PATH
      )
  else (WINDOWS)
    set(ALUT_LIB alut)
  endif (WINDOWS)

  if (NOT ALUT_LIB)
    message(FATAL_ERROR "ALUT not found!")
  else (NOT ALUT_LIB)
    # message(STATUS "ALUT found: ${ALUT_LIB}")
  endif (NOT ALUT_LIB)



  # ALUT_INCLUDE_DIR

  find_path(ALUT_INCLUDE_DIR
    NAMES alut.h
    PATHS ${LIBS_PREBUILT_DIR}/include/AL
    )

  if (NOT ALUT_INCLUDE_DIR)
    message(FATAL_ERROR "alut.h not found!")
  else (NOT ALUT_INCLUDE_DIR)
    # message(STATUS "alut.h found in: ${ALUT_INCLUDE_DIR}")
  endif (NOT ALUT_INCLUDE_DIR)



  set(OPENAL_LIBRARIES
    ${OPENAL_LIB}
    ${ALUT_LIB}
    )

  set(OPENAL_INCLUDE_DIRS
    ${OPENAL_INCLUDE_DIR}
    ${ALUT_INCLUDE_DIR}
    )
  

  set(OPENAL_FOUND TRUE CACHE BOOL
    "Found OpenAL and ALUT libraries successfully"
    )

endif (OPENAL)