Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FindALUT.cmake 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # - try to find the OpenAL ALUT library
  2. #
  3. # Users may optionally supply:
  4. # ALUT_ROOT_DIR - a prefix to start searching.
  5. #
  6. # Cache Variables: (probably not for direct use in your scripts)
  7. # ALUT_INCLUDE_DIR
  8. # ALUT_LIBRARY
  9. #
  10. # Non-cache variables you might use in your CMakeLists.txt:
  11. # ALUT_FOUND
  12. # ALUT_INCLUDE_DIRS
  13. # ALUT_LIBRARIES
  14. # ALUT_WORKAROUND_INCLUDE_DIRS - add these to your include path with
  15. # include_directories(${ALUT_WORKAROUND_INCLUDE_DIRS} ${ALUT_INCLUDE_DIRS})
  16. # so you can always #include <AL/al.h> and #include <AL/alut.h> even on
  17. # Mac where the paths might differ.
  18. #
  19. # Requires these CMake modules:
  20. # FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
  21. #
  22. # Original Author:
  23. # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
  24. # http://academic.cleardefinition.com
  25. # Iowa State University HCI Graduate Program/VRAC
  26. #
  27. # Copyright Iowa State University 2009-2010.
  28. # Distributed under the Boost Software License, Version 1.0.
  29. # (See accompanying file LICENSE_1_0.txt or copy at
  30. # http://www.boost.org/LICENSE_1_0.txt)
  31. set(ALUT_ROOT_DIR
  32. "${ALUT_ROOT_DIR}"
  33. CACHE
  34. PATH
  35. "Path to search for ALUT library")
  36. # Share search paths with OpenAL
  37. if(NOT "$ENV{OPENALDIR}" STREQUAL "")
  38. if(NOT ALUT_ROOT_DIR)
  39. set(ALUT_ROOT_DIR "$ENV{OPENALDIR}")
  40. endif()
  41. else()
  42. if(ALUT_ROOT_DIR)
  43. set(ENV{OPENALDIR} "${ALUT_ROOT_DIR}")
  44. endif()
  45. endif()
  46. ###
  47. # Configure ALUT
  48. ###
  49. find_path(ALUT_INCLUDE_DIR
  50. NAMES
  51. alut.h
  52. HINTS
  53. "${ALUT_ROOT_DIR}"
  54. PATH_SUFFIXES
  55. AL
  56. alut
  57. OpenAL
  58. include
  59. include/alut
  60. include/freealut
  61. include/AL
  62. include/OpenAL
  63. PATHS
  64. /usr/local
  65. /opt/local
  66. /sw)
  67. mark_as_advanced(ALUT_INCLUDE_DIR)
  68. find_library(ALUT_LIBRARY
  69. NAMES
  70. alut
  71. HINTS
  72. "${ALUT_ROOT_DIR}"
  73. PATH_SUFFIXES
  74. lib
  75. lib64
  76. PATHS
  77. /usr/local
  78. /opt/local
  79. /sw)
  80. mark_as_advanced(ALUT_LIBRARY)
  81. ###
  82. # Prereq: OpenAL
  83. ###
  84. # On Mac OS X, the ALUT headers were in the OpenAL framework until 10.4.7
  85. # If we found ALUT headers elsewhere, it's probably freealut which may
  86. # define the same symbols as the library in the framework (?)
  87. # so we might want to save/restore the CMake variable that controls searching
  88. # in frameworks
  89. find_package(OpenAL QUIET)
  90. # handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if
  91. # all listed variables are TRUE
  92. include(FindPackageHandleStandardArgs)
  93. find_package_handle_standard_args(ALUT
  94. DEFAULT_MSG
  95. ALUT_LIBRARY
  96. ALUT_INCLUDE_DIR
  97. OPENAL_FOUND)
  98. if(ALUT_FOUND)
  99. set(ALUT_INCLUDE_DIRS "${OPENAL_INCLUDE_DIR}" "${ALUT_INCLUDE_DIR}")
  100. set(ALUT_LIBRARIES "${OPENAL_LIBRARY}" ${ALUT_LIBRARY})
  101. if(APPLE)
  102. get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH)
  103. if("${OPENAL_INCLUDE_DIR}" MATCHES "\\.framework$")
  104. # OpenAL is in a framework - need a workaround
  105. set(OPENAL_WORKAROUND_INCLUDE_DIR
  106. "${_moddir}/workarounds/mac-openal")
  107. list(APPEND
  108. ALUT_WORKAROUND_INCLUDE_DIRS
  109. "${OPENAL_WORKAROUND_INCLUDE_DIR}")
  110. endif()
  111. if("${ALUT_INCLUDE_DIR}" MATCHES "\\.framework$")
  112. # ALUT is in the OpenAL framework - need a workaround
  113. set(ALUT_WORKAROUND_INCLUDE_DIR
  114. "${_moddir}/workarounds/mac-alut-framework")
  115. list(APPEND
  116. ALUT_WORKAROUND_INCLUDE_DIRS
  117. "${ALUT_WORKAROUND_INCLUDE_DIR}")
  118. endif()
  119. endif()
  120. if("${ALUT_INCLUDE_DIR}" MATCHES "AL$")
  121. get_filename_component(_parent "${ALUT_INCLUDE_DIR}/.." ABSOLUTE)
  122. list(APPEND ALUT_INCLUDE_DIRS "${_parent}")
  123. endif()
  124. mark_as_advanced(ALUT_ROOT_DIR)
  125. endif()