From 786b291d9c6b784c7ce6ceef0e38a4ec76ea14db Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 16:32:52 +0200 Subject: Move CMake files to modernized cmake syntax, step 1. Change projects to cmake targetsto get rid of havig to hardcore include directories and link libraries in consumer projects. --- indra/cmake/OPENAL.cmake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 1bbfff6f98..ab2d258a12 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -9,7 +9,12 @@ else (LINUX) endif (LINUX) if (OPENAL) - set(OPENAL_LIB_INCLUDE_DIRS "${LIBS_PREBUILT_DIR}/include/AL") + if( TARGET openal::openal ) + return() + endif() + create_target( openal::openal ) + set_target_include_dirs( openal::openal "${LIBS_PREBUILT_DIR}/include/AL") + if (USESYSTEMLIBS) include(FindPkgConfig) include(FindOpenAL) @@ -18,13 +23,14 @@ if (OPENAL) else (USESYSTEMLIBS) use_prebuilt_binary(openal) endif (USESYSTEMLIBS) + if(WINDOWS) - set(OPENAL_LIBRARIES + set_target_libraries( openal::openal OpenAL32 alut ) else() - set(OPENAL_LIBRARIES + set_target_libraries( openal::openal openal alut ) -- cgit v1.2.3 From 603ad5a4f2450f67d2d253f199b3f6a216b30248 Mon Sep 17 00:00:00 2001 From: Nicky Date: Thu, 7 Apr 2022 02:34:32 +0200 Subject: OpenAL is not avaiable for OSX, error out in case someone selects ot. --- indra/cmake/OPENAL.cmake | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index ab2d258a12..a5058b4bc3 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -12,6 +12,7 @@ if (OPENAL) if( TARGET openal::openal ) return() endif() + create_target( openal::openal ) set_target_include_dirs( openal::openal "${LIBS_PREBUILT_DIR}/include/AL") @@ -26,13 +27,15 @@ if (OPENAL) if(WINDOWS) set_target_libraries( openal::openal - OpenAL32 - alut - ) - else() + OpenAL32 + alut + ) + elseif(LINUX) set_target_libraries( openal::openal - openal - alut - ) + openal + alut + ) + else() + message(FATAL_ERROR "OpenAL is not available for this platform") endif() endif (OPENAL) -- cgit v1.2.3 From d3521b4462195cfe882b2cc8eb4e7c5e948c0fb6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 10:28:46 +0200 Subject: Remove obsolete and unmaintained USE_SYSTEMLIBS --- indra/cmake/OPENAL.cmake | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index a5058b4bc3..ec60876419 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -16,14 +16,7 @@ if (OPENAL) create_target( openal::openal ) set_target_include_dirs( openal::openal "${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) + use_prebuilt_binary(openal) if(WINDOWS) set_target_libraries( openal::openal -- cgit v1.2.3 From 241919e7f7986c11586a49bff53cf19c2c0e0ea6 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 13 Apr 2022 19:21:55 +0200 Subject: Rework cmake, the original plan was to maybe be able to use conan targets with the same name (that's why 3ps had names like apr::apr), but it's safer and saner to put the LL 3ps under the ll:: prefix. This also allows means it is possible to get rid of that bad "if( TRAGET ...) return() endif()" pattern and rather use include_guard(). --- indra/cmake/OPENAL.cmake | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index ec60876419..9904f6d1c0 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -2,6 +2,8 @@ include(Linking) include(Prebuilt) +include_guard() + if (LINUX) set(OPENAL ON CACHE BOOL "Enable OpenAL") else (LINUX) @@ -9,22 +11,18 @@ else (LINUX) endif (LINUX) if (OPENAL) - if( TARGET openal::openal ) - return() - endif() - - create_target( openal::openal ) - set_target_include_dirs( openal::openal "${LIBS_PREBUILT_DIR}/include/AL") + create_target( ll::openal ) + set_target_include_dirs( ll::openal "${LIBS_PREBUILT_DIR}/include/AL") use_prebuilt_binary(openal) if(WINDOWS) - set_target_libraries( openal::openal + set_target_libraries( ll::openal OpenAL32 alut ) elseif(LINUX) - set_target_libraries( openal::openal + set_target_libraries( ll::openal openal alut ) -- cgit v1.2.3 From a950940adb1508908313253a9e5118801b2f6d89 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 22:57:09 +0200 Subject: Streamline fmodstudio/openal targets: - Targets now define the appropriate c++ defines, no more hand magic needed for llstartup.cpp - Switch cmakeflage to USE_xxx rather than xxx as it was before. I personally find the USE_X notion more intuitive and it follows how KDU is used. - To be backward compatible OPENAL/FMODSTUDIO flag will be mapped to USE_OPENAL/USE_FMODSTUDIO --- indra/cmake/OPENAL.cmake | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 9904f6d1c0..b50610c554 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -4,16 +4,17 @@ include(Prebuilt) include_guard() -if (LINUX) - set(OPENAL ON CACHE BOOL "Enable OpenAL") -else (LINUX) - set(OPENAL OFF CACHE BOOL "Enable OpenAL") -endif (LINUX) +# 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 (OPENAL) +if (USE_OPENAL) create_target( ll::openal ) set_target_include_dirs( ll::openal "${LIBS_PREBUILT_DIR}/include/AL") - + target_compile_definitions( ll::openal INTERFACE LL_OPENAL=1) use_prebuilt_binary(openal) if(WINDOWS) @@ -29,4 +30,4 @@ if (OPENAL) else() message(FATAL_ERROR "OpenAL is not available for this platform") endif() -endif (OPENAL) +endif () -- cgit v1.2.3 From 6d0bba9c03da0d8aca5e88fcb9289cb2f89f3467 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 17:32:14 +0200 Subject: Switch over to standard target_link_libraries (cmake requirements are high enough now). --- indra/cmake/OPENAL.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index b50610c554..8bbb657aea 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -18,12 +18,12 @@ if (USE_OPENAL) use_prebuilt_binary(openal) if(WINDOWS) - set_target_libraries( ll::openal + target_link_libraries( ll::openal INTERFACE OpenAL32 alut ) elseif(LINUX) - set_target_libraries( ll::openal + target_link_libraries( ll::openal INTERFACE openal alut ) -- cgit v1.2.3 From e0cf0cdfd49e5a946dcd202a083fb23f01e4f1fe Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 18:04:57 +0200 Subject: Switch to target_include_directories All 3Ps include dirs are treated as SYSTEM, this will stop compilers stop emitting warnings from those files and greatly helps having high warning levels and not being swamped by warnings that come from external libraries. --- indra/cmake/OPENAL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 8bbb657aea..faa247769b 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -13,7 +13,7 @@ endif() if (USE_OPENAL) create_target( ll::openal ) - set_target_include_dirs( ll::openal "${LIBS_PREBUILT_DIR}/include/AL") + 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) -- cgit v1.2.3 From 363f2df4fa22b3eb95ff4603d73b7a042f3fefd1 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 17 Apr 2022 18:28:55 +0200 Subject: Remove function create_target and instead directly use add_library --- indra/cmake/OPENAL.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index faa247769b..84dad367b7 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -12,7 +12,7 @@ if(OPENAL) endif() if (USE_OPENAL) - create_target( ll::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) -- cgit v1.2.3 From 4c34a0275192cea26d1d63f59639275d1cbeda20 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 23 Apr 2022 18:36:49 +0200 Subject: Setting openal option in cache had gone poof. --- indra/cmake/OPENAL.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/cmake/OPENAL.cmake') diff --git a/indra/cmake/OPENAL.cmake b/indra/cmake/OPENAL.cmake index 84dad367b7..0b6a7c2853 100644 --- a/indra/cmake/OPENAL.cmake +++ b/indra/cmake/OPENAL.cmake @@ -4,6 +4,11 @@ include(Prebuilt) 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) -- cgit v1.2.3