summaryrefslogtreecommitdiff
path: root/indra/cmake/OPENAL.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'indra/cmake/OPENAL.cmake')
-rw-r--r--indra/cmake/OPENAL.cmake54
1 files changed, 30 insertions, 24 deletions
diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake
index 1bbfff6f98..0b6a7c2853 100644
--- a/indra/cmake/OPENAL.cmake
+++ b/indra/cmake/OPENAL.cmake
@@ -2,31 +2,37 @@
include(Linking)
include(Prebuilt)
-if (LINUX)
- set(OPENAL ON CACHE BOOL "Enable OpenAL")
-else (LINUX)
- set(OPENAL OFF CACHE BOOL "Enable OpenAL")
-endif (LINUX)
+include_guard()
+
+# ND: Turn this off by default, the openal code in the viewer isn't very well maintained, seems
+# to have memory leaks, has no option to play music streams
+# It probably makes sense to to completely remove it
+
+set(USE_OPENAL OFF CACHE BOOL "Enable OpenAL")
+# ND: To streamline arguments passed, switch from OPENAL to USE_OPENAL
+# To not break all old build scripts convert old arguments but warn about it
+if(OPENAL)
+ message( WARNING "Use of the OPENAL argument is deprecated, please switch to USE_OPENAL")
+ set(USE_OPENAL ${OPENAL})
+endif()
+
+if (USE_OPENAL)
+ add_library( ll::openal INTERFACE IMPORTED )
+ target_include_directories( ll::openal SYSTEM INTERFACE "${LIBS_PREBUILT_DIR}/include/AL")
+ target_compile_definitions( ll::openal INTERFACE LL_OPENAL=1)
+ use_prebuilt_binary(openal)
-if (OPENAL)
- set(OPENAL_LIB_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/AL")
- if (USESYSTEMLIBS)
- include(FindPkgConfig)
- include(FindOpenAL)
- pkg_check_modules(OPENAL_LIB REQUIRED openal)
- pkg_check_modules(FREEALUT_LIB REQUIRED freealut)
- else (USESYSTEMLIBS)
- use_prebuilt_binary(openal)
- endif (USESYSTEMLIBS)
if(WINDOWS)
- set(OPENAL_LIBRARIES
- OpenAL32
- alut
- )
+ target_link_libraries( ll::openal INTERFACE
+ OpenAL32
+ alut
+ )
+ elseif(LINUX)
+ target_link_libraries( ll::openal INTERFACE
+ openal
+ alut
+ )
else()
- set(OPENAL_LIBRARIES
- openal
- alut
- )
+ message(FATAL_ERROR "OpenAL is not available for this platform")
endif()
-endif (OPENAL)
+endif ()