From eb3de8543e5580cb353230577f9f6606e71002f2 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Thu, 24 Feb 2011 20:57:34 -0800
Subject: [PATCH] STORM-1023 (was OPEN-4) and STORM-1022 (was OPEN-24) : fmod
 and kdu changes : cmake changes making possible to use Findxxx when
 INSTALL_PROPRIETARY is OFF and STANDALONE is OFF too, simplify cmake scripts
 around INSTALL_PROPRIETARY, add fmodex to FindFMOD

---
 indra/cmake/FMOD.cmake     | 25 ++++++++++++---------
 indra/cmake/FindFMOD.cmake |  2 +-
 indra/cmake/LLKDU.cmake    | 11 +++++-----
 indra/cmake/Prebuilt.cmake | 45 ++++++++++++--------------------------
 4 files changed, 36 insertions(+), 47 deletions(-)

diff --git a/indra/cmake/FMOD.cmake b/indra/cmake/FMOD.cmake
index dcf44cd6423..6a4322df9be 100644
--- a/indra/cmake/FMOD.cmake
+++ b/indra/cmake/FMOD.cmake
@@ -1,17 +1,23 @@
 # -*- cmake -*-
 
-set(FMOD ON CACHE BOOL "Use FMOD sound library.")
+# FMOD can be set when launching the make using the argument -DFMOD:BOOL=ON
+# When building using proprietary binaries though (i.e. having access to LL private servers),
+# we always build with FMOD.
+# Open source devs should use the -DFMOD:BOOL=ON then if they want to build with FMOD, whether
+# they are using STANDALONE or not.
+if (INSTALL_PROPRIETARY)
+  set(FMOD ON CACHE BOOL "Use FMOD sound library.")
+endif (INSTALL_PROPRIETARY)
 
 if (FMOD)
-  if (STANDALONE)
+  if (NOT INSTALL_PROPRIETARY)
+    # This cover the STANDALONE case and the NOT STANDALONE but not using proprietary libraries
+	# This should then be invoke by all open source devs outside LL
     set(FMOD_FIND_REQUIRED ON)
     include(FindFMOD)
-  else (STANDALONE)
-    if (INSTALL_PROPRIETARY)
-      include(Prebuilt)
-      use_prebuilt_binary(fmod)
-    endif (INSTALL_PROPRIETARY)
-    
+  else (NOT INSTALL_PROPRIETARY)
+	include(Prebuilt)
+	use_prebuilt_binary(fmod)    
     if (WINDOWS)
       set(FMOD_LIBRARY fmod)
     elseif (DARWIN)
@@ -19,8 +25,7 @@ if (FMOD)
     elseif (LINUX)
       set(FMOD_LIBRARY fmod-3.75)
     endif (WINDOWS)
-
     SET(FMOD_LIBRARIES ${FMOD_LIBRARY})
     set(FMOD_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
-  endif (STANDALONE)
+  endif (NOT INSTALL_PROPRIETARY)
 endif (FMOD)
diff --git a/indra/cmake/FindFMOD.cmake b/indra/cmake/FindFMOD.cmake
index e60b386027a..1ebbc8c96e5 100644
--- a/indra/cmake/FindFMOD.cmake
+++ b/indra/cmake/FindFMOD.cmake
@@ -11,7 +11,7 @@
 
 FIND_PATH(FMOD_INCLUDE_DIR fmod.h PATH_SUFFIXES fmod)
 
-SET(FMOD_NAMES ${FMOD_NAMES} fmod fmodvc fmod-3.75)
+SET(FMOD_NAMES ${FMOD_NAMES} fmod fmodvc fmodex fmod-3.75)
 FIND_LIBRARY(FMOD_LIBRARY
   NAMES ${FMOD_NAMES}
   PATH_SUFFIXES fmod
diff --git a/indra/cmake/LLKDU.cmake b/indra/cmake/LLKDU.cmake
index 13c2b86e2fa..e478b01f84a 100644
--- a/indra/cmake/LLKDU.cmake
+++ b/indra/cmake/LLKDU.cmake
@@ -1,13 +1,14 @@
 # -*- cmake -*-
-include(Prebuilt)
 
 # USE_KDU can be set when launching cmake as an option using the argument -DUSE_KDU:BOOL=ON
-# When building using proprietary binaries though (i.e. having access to LL private servers), we always build with KDU
-if (INSTALL_PROPRIETARY AND NOT STANDALONE)
-  set(USE_KDU ON)
-endif (INSTALL_PROPRIETARY AND NOT STANDALONE)
+# When building using proprietary binaries though (i.e. having access to LL private servers), 
+# we always build with KDU
+if (INSTALL_PROPRIETARY)
+  set(USE_KDU ON CACHE BOOL "Use Kakadu library.")
+endif (INSTALL_PROPRIETARY)
 
 if (USE_KDU)
+  include(Prebuilt)
   use_prebuilt_binary(kdu)
   if (WINDOWS)
     set(KDU_LIBRARY kdu.lib)
diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake
index 9b758b03f03..1b60d176f11 100644
--- a/indra/cmake/Prebuilt.cmake
+++ b/indra/cmake/Prebuilt.cmake
@@ -11,38 +11,21 @@ macro (use_prebuilt_binary _binary)
     if(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
       if(INSTALL_PROPRIETARY)
         include(FindSCP)
-        if(DEBUG_PREBUILT)
-          message("cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install
-          --install-dir=${AUTOBUILD_INSTALL_DIR}
-          #--scp="${SCP_EXECUTABLE}"
-          --skip-license-check
-          ${_binary} ")
-        endif(DEBUG_PREBUILT)
-        execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}"
-          install
-          --install-dir=${AUTOBUILD_INSTALL_DIR}
-          #--scp="${SCP_EXECUTABLE}"
-          --skip-license-check
-          ${_binary}
-          WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
-          RESULT_VARIABLE ${_binary}_installed
-          )
-      else(INSTALL_PROPRIETARY)
-        if(DEBUG_PREBUILT)
-          message("cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install
-          --install-dir=${AUTOBUILD_INSTALL_DIR}
-          --skip-license-check
-          ${_binary} ")
-        endif(DEBUG_PREBUILT)
-        execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}"
-          install
-          --install-dir=${AUTOBUILD_INSTALL_DIR}
-          --skip-license-check
-          ${_binary}
-          WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
-          RESULT_VARIABLE ${_binary}_installed
-          )
       endif(INSTALL_PROPRIETARY)
+	  if(DEBUG_PREBUILT)
+		message("cd ${CMAKE_SOURCE_DIR} && ${AUTOBUILD_EXECUTABLE} install
+		--install-dir=${AUTOBUILD_INSTALL_DIR}
+		--skip-license-check
+		${_binary} ")
+	  endif(DEBUG_PREBUILT)
+	  execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}"
+		install
+		--install-dir=${AUTOBUILD_INSTALL_DIR}
+		--skip-license-check
+		${_binary}
+		WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
+		RESULT_VARIABLE ${_binary}_installed
+		)
       file(WRITE ${CMAKE_BINARY_DIR}/temp/${_binary}_installed "${${_binary}_installed}")
     else(${CMAKE_BINARY_DIR}/temp/sentinel_installed IS_NEWER_THAN ${CMAKE_BINARY_DIR}/temp/${_binary}_installed)
       set(${_binary}_installed 0)
-- 
GitLab