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/FMODSTUDIO.cmake | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index 8840354ac6..e8699cdecd 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -8,9 +8,17 @@ if (INSTALL_PROPRIETARY) endif (INSTALL_PROPRIETARY) if (FMODSTUDIO) + if( TARGET fmodstudio::fmodstudio ) + return() + endif() + create_target( fmodstudio::fmodstudio ) + set_target_include_dirs( openal::openal "${LIBS_PREBUILT_DIR}/include/AL") + if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If the path have been specified in the arguments, use that - set(FMODSTUDIO_LIBRARIES ${FMODSTUDIO_LIBRARY}) + + set_target_libraries(fmodstudio::fmodstudio ${FMODSTUDIO_LIBRARY}) + set_target_include_dirs(fmodstudio::fmodstudio ${FMODSTUDIO_INCLUDE_DIR}) else (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If not, we're going to try to get the package listed in autobuild.xml # Note: if you're not using INSTALL_PROPRIETARY, the package URL should be local (file:/// URL) @@ -18,21 +26,15 @@ if (FMODSTUDIO) include(Prebuilt) use_prebuilt_binary(fmodstudio) if (WINDOWS) - set(FMODSTUDIO_LIBRARY - debug fmodL_vc - optimized fmod_vc) + set_target_libraries( fmodstudio::fmodstudio fmod_vc) elseif (DARWIN) #despite files being called libfmod.dylib, we are searching for fmod - set(FMODSTUDIO_LIBRARY - debug fmodL - optimized fmod) + set_target_libraries( fmodstudio::fmodstudio fmod) elseif (LINUX) - set(FMODSTUDIO_LIBRARY - debug fmodL - optimized fmod) + set_target_libraries( fmodstudio::fmodstudio fmod) endif (WINDOWS) - set(FMODSTUDIO_LIBRARIES ${FMODSTUDIO_LIBRARY}) - set(FMODSTUDIO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodstudio) + + set_target_include_dirs(fmodstudio::fmodstudio ${LIBS_PREBUILT_DIR}/include/fmodstudio) endif (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) endif (FMODSTUDIO) -- cgit v1.2.3 From 495b35032ce5616cfe99f0fcb58c8963a7454929 Mon Sep 17 00:00:00 2001 From: Nicky Date: Wed, 6 Apr 2022 20:22:13 +0200 Subject: Remove erroneous lines. --- indra/cmake/FMODSTUDIO.cmake | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index e8699cdecd..41a75741c9 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -12,7 +12,6 @@ if (FMODSTUDIO) return() endif() create_target( fmodstudio::fmodstudio ) - set_target_include_dirs( openal::openal "${LIBS_PREBUILT_DIR}/include/AL") if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If the path have been specified in the arguments, use that -- 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/FMODSTUDIO.cmake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index 41a75741c9..653d96f86a 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -1,5 +1,7 @@ # -*- cmake -*- +include_guard() + # FMODSTUDIO can be set when launching the make using the argument -DFMODSTUDIO:BOOL=ON # When building using proprietary binaries though (i.e. having access to LL private servers), # we always build with FMODSTUDIO. @@ -8,10 +10,7 @@ if (INSTALL_PROPRIETARY) endif (INSTALL_PROPRIETARY) if (FMODSTUDIO) - if( TARGET fmodstudio::fmodstudio ) - return() - endif() - create_target( fmodstudio::fmodstudio ) + create_target( ll::fmodstudio ) if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If the path have been specified in the arguments, use that @@ -25,15 +24,15 @@ if (FMODSTUDIO) include(Prebuilt) use_prebuilt_binary(fmodstudio) if (WINDOWS) - set_target_libraries( fmodstudio::fmodstudio fmod_vc) + set_target_libraries( ll::fmodstudio fmod_vc) elseif (DARWIN) #despite files being called libfmod.dylib, we are searching for fmod - set_target_libraries( fmodstudio::fmodstudio fmod) + set_target_libraries( ll::fmodstudio fmod) elseif (LINUX) - set_target_libraries( fmodstudio::fmodstudio fmod) + set_target_libraries( ll::fmodstudio fmod) endif (WINDOWS) - set_target_include_dirs(fmodstudio::fmodstudio ${LIBS_PREBUILT_DIR}/include/fmodstudio) + set_target_include_dirs(ll::fmodstudio ${LIBS_PREBUILT_DIR}/include/fmodstudio) endif (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) endif (FMODSTUDIO) -- cgit v1.2.3 From cc48def709c2a6eca90c690bd63491011ad68d36 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 16 Apr 2022 18:03:04 +0200 Subject: Initialize variables so that calling cmake with "--warn-unused-vars --warn-uninitialized" does not make it go all crazy. --- indra/cmake/FMODSTUDIO.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index 653d96f86a..334d46caf9 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -34,5 +34,7 @@ if (FMODSTUDIO) set_target_include_dirs(ll::fmodstudio ${LIBS_PREBUILT_DIR}/include/fmodstudio) endif (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) +else() + set( FMODSTUDIO "OFF") endif (FMODSTUDIO) -- 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/FMODSTUDIO.cmake | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index 334d46caf9..b84a177748 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -6,11 +6,19 @@ include_guard() # When building using proprietary binaries though (i.e. having access to LL private servers), # we always build with FMODSTUDIO. if (INSTALL_PROPRIETARY) - set(FMODSTUDIO ON CACHE BOOL "Using FMODSTUDIO sound library.") + set(USE_FMODSTUDIO ON CACHE BOOL "Using FMODSTUDIO sound library.") endif (INSTALL_PROPRIETARY) -if (FMODSTUDIO) +# ND: To streamline arguments passed, switch from FMODSTUDIO to USE_FMODSTUDIO +# To not break all old build scripts convert old arguments but warn about it +if(FMODSTUDIO) + message( WARNING "Use of the FMODSTUDIO argument is deprecated, please switch to USE_FMODSTUDIO") + set(USE_FMODSTUDIO ${FMODSTUDIO}) +endif() + +if (USE_FMODSTUDIO) create_target( ll::fmodstudio ) + target_compile_definitions( ll::fmodstudio INTERFACE LL_FMODSTUDIO=1) if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If the path have been specified in the arguments, use that @@ -35,6 +43,6 @@ if (FMODSTUDIO) set_target_include_dirs(ll::fmodstudio ${LIBS_PREBUILT_DIR}/include/fmodstudio) endif (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) else() - set( FMODSTUDIO "OFF") -endif (FMODSTUDIO) + set( USE_FMODSTUDIO "OFF") +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/FMODSTUDIO.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index b84a177748..aec86125e8 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -23,7 +23,7 @@ if (USE_FMODSTUDIO) if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If the path have been specified in the arguments, use that - set_target_libraries(fmodstudio::fmodstudio ${FMODSTUDIO_LIBRARY}) + target_link_libraries(fmodstudio::fmodstudio INTERFACE ${FMODSTUDIO_LIBRARY}) set_target_include_dirs(fmodstudio::fmodstudio ${FMODSTUDIO_INCLUDE_DIR}) else (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If not, we're going to try to get the package listed in autobuild.xml @@ -32,12 +32,12 @@ if (USE_FMODSTUDIO) include(Prebuilt) use_prebuilt_binary(fmodstudio) if (WINDOWS) - set_target_libraries( ll::fmodstudio fmod_vc) + target_link_libraries( ll::fmodstudio INTERFACE fmod_vc) elseif (DARWIN) #despite files being called libfmod.dylib, we are searching for fmod - set_target_libraries( ll::fmodstudio fmod) + target_link_libraries( ll::fmodstudio INTERFACE fmod) elseif (LINUX) - set_target_libraries( ll::fmodstudio fmod) + target_link_libraries( ll::fmodstudio INTERFACE fmod) endif (WINDOWS) set_target_include_dirs(ll::fmodstudio ${LIBS_PREBUILT_DIR}/include/fmodstudio) -- 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/FMODSTUDIO.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index aec86125e8..a3fd9c718a 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -23,8 +23,8 @@ if (USE_FMODSTUDIO) if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If the path have been specified in the arguments, use that - target_link_libraries(fmodstudio::fmodstudio INTERFACE ${FMODSTUDIO_LIBRARY}) - set_target_include_dirs(fmodstudio::fmodstudio ${FMODSTUDIO_INCLUDE_DIR}) + target_link_libraries(ll::fmodstudio INTERFACE ${FMODSTUDIO_LIBRARY}) + target_include_directories( ll::fmodstudio SYSTEM INTERFACE ${FMODSTUDIO_INCLUDE_DIR}) else (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) # If not, we're going to try to get the package listed in autobuild.xml # Note: if you're not using INSTALL_PROPRIETARY, the package URL should be local (file:/// URL) @@ -40,7 +40,7 @@ if (USE_FMODSTUDIO) target_link_libraries( ll::fmodstudio INTERFACE fmod) endif (WINDOWS) - set_target_include_dirs(ll::fmodstudio ${LIBS_PREBUILT_DIR}/include/fmodstudio) + target_include_directories( ll::fmodstudio SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/fmodstudio) endif (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) else() set( USE_FMODSTUDIO "OFF") -- 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/FMODSTUDIO.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/FMODSTUDIO.cmake') diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake index a3fd9c718a..c5b21ac4e5 100644 --- a/indra/cmake/FMODSTUDIO.cmake +++ b/indra/cmake/FMODSTUDIO.cmake @@ -17,7 +17,7 @@ if(FMODSTUDIO) endif() if (USE_FMODSTUDIO) - create_target( ll::fmodstudio ) + add_library( ll::fmodstudio INTERFACE IMPORTED ) target_compile_definitions( ll::fmodstudio INTERFACE LL_FMODSTUDIO=1) if (FMODSTUDIO_LIBRARY AND FMODSTUDIO_INCLUDE_DIR) -- cgit v1.2.3