From 8ba2b388769e245ec1b49b7d6d4b0372d684ff86 Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Thu, 13 Sep 2012 10:25:48 +0000
Subject: [PATCH] Fleshed out target_link_libraries dependencies between
 libraries.  Appearance utility now reads avatar_lad.xml during stubbed out
 params processing.

---
 indra/appearance_utility/CMakeLists.txt       | 21 ++-------------
 .../llappappearanceutility.cpp                | 27 +++++++++++++++++++
 indra/appearance_utility/llbakingavatar.h     | 10 +++++++
 indra/appearance_utility/llprocessparams.cpp  |  1 +
 indra/linux_updater/CMakeLists.txt            |  2 ++
 indra/llappearance/CMakeLists.txt             | 25 +++++++++--------
 indra/llappearance/llavatarappearance.cpp     |  8 ++++++
 indra/llappearance/llavatarappearance.h       |  3 ++-
 indra/llappearance/llwearabletype.cpp         | 16 +++++++++--
 indra/llappearance/llwearabletype.h           | 10 +++++++
 indra/llaudio/CMakeLists.txt                  |  4 +++
 indra/llcharacter/CMakeLists.txt              |  9 +++++++
 indra/llimage/CMakeLists.txt                  | 12 ++++++++-
 indra/llinventory/CMakeLists.txt              |  6 +++++
 indra/llkdu/CMakeLists.txt                    |  5 +++-
 indra/llmath/CMakeLists.txt                   |  4 +++
 indra/llmessage/CMakeLists.txt                |  5 +++-
 indra/llprimitive/CMakeLists.txt              |  9 +++++++
 indra/llrender/CMakeLists.txt                 |  9 ++++++-
 indra/llvfs/CMakeLists.txt                    |  1 +
 indra/llwindow/CMakeLists.txt                 | 10 ++++++-
 indra/llxml/CMakeLists.txt                    |  7 ++---
 indra/mac_updater/CMakeLists.txt              |  2 ++
 indra/newview/CMakeLists.txt                  | 11 --------
 indra/newview/llappviewer.cpp                 | 17 ++++++++++++
 indra/newview/llvoavatar.cpp                  |  3 ---
 26 files changed, 180 insertions(+), 57 deletions(-)

diff --git a/indra/appearance_utility/CMakeLists.txt b/indra/appearance_utility/CMakeLists.txt
index dec71feea20..92898fa48bf 100644
--- a/indra/appearance_utility/CMakeLists.txt
+++ b/indra/appearance_utility/CMakeLists.txt
@@ -3,38 +3,27 @@
 project(appearance_utility)
 
 include(00-Common)
-include(CURL)
-include(CARes)
-include(OpenSSL)
-include(UI)
 include(LLAppearance)
 include(LLCharacter)
 include(LLCommon)
 include(LLImage)
 include(LLInventory)
 include(LLMath)
-include(LLKDU)
 include(LLRender)
 include(LLVFS)
 include(LLXML)
-include(LLUI)
 include(Linking)
+include(GooglePerfTools)
 
 include_directories(
     ${LLCOMMON_INCLUDE_DIRS}
     ${LLVFS_INCLUDE_DIRS}
     ${LLXML_INCLUDE_DIRS}
-    ${LLUI_INCLUDE_DIRS}
     ${LLCHARACTER_INCLUDE_DIRS}
-    ${LLKDU_INCLUDE_DIRS}
     ${LLIMAGE_INCLUDE_DIRS}
     ${LLMATH_INCLUDE_DIRS}
     ${LLINVENTORY_INCLUDE_DIRS}
     ${LLRENDER_INCLUDE_DIRS}
-    ${CURL_INCLUDE_DIRS}
-    ${CARES_INCLUDE_DIRS}
-    ${OPENSSL_INCLUDE_DIRS}
-    ${UI_INCLUDE_DIRS}
     ${LLAPPEARANCE_INCLUDE_DIRS}
     )
 
@@ -70,13 +59,7 @@ add_executable(appearance-utility-bin ${appearance_utility_SOURCE_FILES})
 
 target_link_libraries(appearance-utility-bin
     ${LLAPPEARANCE_LIBRARIES}
-    ${LLCHARACTER_LIBRARIES}
-    ${LLRENDER_LIBRARIES}
-    ${LLUI_LIBRARIES}
-    ${UI_LIBRARIES}
-    ${LLIMAGE_LIBRARIES}
-    ${LLKDU_LIBRARIES}
-    ${KDU_LIBRARY}
+    ${TCMALLOC_LIBRARIES}
     )
 
 add_custom_target(appearance-utility-bin-target ALL
diff --git a/indra/appearance_utility/llappappearanceutility.cpp b/indra/appearance_utility/llappappearanceutility.cpp
index b49e9548306..66e59e1b89a 100644
--- a/indra/appearance_utility/llappappearanceutility.cpp
+++ b/indra/appearance_utility/llappappearanceutility.cpp
@@ -37,6 +37,10 @@
 #include "llsdserialize.h"
 #include "llsdutil.h"
 
+// appearance includes
+#include "llavatarappearance.h"
+#include "llwearabletype.h"
+
 // project includes
 #include "llappappearanceutility.h"
 #include "llbakingprocess.h"
@@ -375,20 +379,43 @@ void LLAppAppearanceUtility::initializeIO()
 	/////  END INPUT PARSING ////
 }
 
+class LLPassthroughTranslationBridge : public LLTranslationBridge
+{
+public:
+	virtual std::string getString(const std::string &xml_desc)
+	{
+		// Just pass back the input string.
+		return xml_desc;
+	}
+};
+
+
 bool LLAppAppearanceUtility::init()
 {
 	parseArguments();
 
+	bool log_to_stderr = true;
+	LLError::initForApplication("", log_to_stderr);
 	// *TODO: Add debug mode(s).  Skip this in debug mode.
 	LLError::setDefaultLevel(LLError::LEVEL_WARN);
 
 	validateArguments();
 	initializeIO();
+
+	// Initialize classes.
+	LLWearableType::initClass(new LLPassthroughTranslationBridge());
+
+	// *TODO: Create a texture bridge?
+	LLAvatarAppearance::initClass();
+
 	return true;
 }
 
 bool LLAppAppearanceUtility::cleanup()
 {
+	LLAvatarAppearance::cleanupClass();
+	LLWearableType::cleanupClass();
+
 	if (mProcess)
 	{
 		delete mProcess;
diff --git a/indra/appearance_utility/llbakingavatar.h b/indra/appearance_utility/llbakingavatar.h
index 65ff65521e9..7f20d316749 100644
--- a/indra/appearance_utility/llbakingavatar.h
+++ b/indra/appearance_utility/llbakingavatar.h
@@ -38,6 +38,16 @@ class LLBakingAvatar : public LLAvatarAppearance
  **                    INITIALIZATION
  **/
 public:
+	void* operator new(size_t size)
+	{
+		return ll_aligned_malloc_16(size);
+	}
+
+	void operator delete(void* ptr)
+	{
+		ll_aligned_free_16(ptr);
+	}
+
 	LLBakingAvatar(LLWearableData* wearable_data);
 	virtual ~LLBakingAvatar();
 
diff --git a/indra/appearance_utility/llprocessparams.cpp b/indra/appearance_utility/llprocessparams.cpp
index 439c403ded8..723bae0dd63 100644
--- a/indra/appearance_utility/llprocessparams.cpp
+++ b/indra/appearance_utility/llprocessparams.cpp
@@ -43,6 +43,7 @@ void LLProcessParams::process(LLSD& input, std::ostream& output)
 {
 	LLWearableData wearable_data;
 	LLBakingAvatar avatar(&wearable_data);
+	avatar.initInstance();
 
 	LLSD result;
 	result["success"] = true;
diff --git a/indra/linux_updater/CMakeLists.txt b/indra/linux_updater/CMakeLists.txt
index 4377a6333c3..c4e25f4a04e 100644
--- a/indra/linux_updater/CMakeLists.txt
+++ b/indra/linux_updater/CMakeLists.txt
@@ -8,6 +8,7 @@ include(CARes)
 include(OpenSSL)
 include(UI)
 include(LLCommon)
+include(LLMessage)
 include(LLVFS)
 include(LLXML)
 include(LLUI)
@@ -40,6 +41,7 @@ target_link_libraries(linux-updater
     ${CARES_LIBRARIES}
     ${OPENSSL_LIBRARIES}
     ${CRYPTO_LIBRARIES}
+    ${LLMESSAGE_LIBRARIES}
     ${UI_LIBRARIES}
     ${LLXML_LIBRARIES}
     ${LLUI_LIBRARIES}
diff --git a/indra/llappearance/CMakeLists.txt b/indra/llappearance/CMakeLists.txt
index adce620372a..c570f0c93b4 100644
--- a/indra/llappearance/CMakeLists.txt
+++ b/indra/llappearance/CMakeLists.txt
@@ -4,37 +4,24 @@ project(llappearance)
 
 include(00-Common)
 include(LLCommon)
-include(LLAudio)
 include(LLCharacter)
-include(LLCommon)
 include(LLImage)
-include(LLImageJ2COJ)
 include(LLInventory)
 include(LLMath)
 include(LLMessage)
-include(LLPhysicsExtensions)
-include(LLPlugin)
-include(LLPrimitive)
 include(LLRender)
-include(LLUI)
 include(LLVFS)
 include(LLWindow)
 include(LLXML)
 include(Linking)
-include(LLKDU)
-include(ViewerMiscLibs)
-include(LLLogin)
 
 include_directories(
     ${LLCOMMON_INCLUDE_DIRS}
     ${LLCHARACTER_INCLUDE_DIRS}
-    ${LLPHYSICS_INCLUDE_DIRS}
     ${LLIMAGE_INCLUDE_DIRS}
-    ${LLKDU_INCLUDE_DIRS}
     ${LLINVENTORY_INCLUDE_DIRS}
     ${LLMATH_INCLUDE_DIRS}
     ${LLRENDER_INCLUDE_DIRS}
-    ${LLUI_INCLUDE_DIRS}
     ${LLVFS_INCLUDE_DIRS}
     ${LLWINDOW_INCLUDE_DIRS}
     ${LLXML_INCLUDE_DIRS}
@@ -90,6 +77,18 @@ list(APPEND llappearance_SOURCE_FILES ${llappearance_HEADER_FILES})
 
 add_library (llappearance ${llappearance_SOURCE_FILES})
 
+target_link_libraries(llappearance
+    ${LLCHARACTER_LIBRARIES}
+    ${LLINVENTORY_LIBRARIES}
+    ${LLIMAGE_LIBRARIES}
+    ${LLRENDER_LIBRARIES}
+    ${LLVFS_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLXML_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLCOMMON_LIBRARIES}
+    )
+
 #add unit tests
 #if (LL_TESTS)
 #    INCLUDE(LLAddBuildTest)
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp
index 19c656044c9..824f0a1e322 100644
--- a/indra/llappearance/llavatarappearance.cpp
+++ b/indra/llappearance/llavatarappearance.cpp
@@ -419,6 +419,14 @@ void LLAvatarAppearance::initClass()
 	}
 }
 
+void LLAvatarAppearance::cleanupClass()
+{
+	deleteAndClear(sAvatarXmlInfo);
+	// *TODO: What about sAvatarSkeletonInfo ???
+	sSkeletonXMLTree.cleanup();
+	sXMLTree.cleanup();
+}
+
 using namespace LLAvatarAppearanceDefines;
 
 //------------------------------------------------------------------------
diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h
index 06607ef899f..5726ff62d10 100644
--- a/indra/llappearance/llavatarappearance.h
+++ b/indra/llappearance/llavatarappearance.h
@@ -65,7 +65,8 @@ class LLAvatarAppearance : public LLCharacter
 	LLAvatarAppearance(LLWearableData* wearable_data);
 	virtual ~LLAvatarAppearance();
 
-	static void initClass(); // initializes static members
+	static void			initClass(); // initializes static members
+	static void			cleanupClass();	// Cleanup data that's only init'd once per class.
 	virtual void 		initInstance(); // Called after construction to initialize the instance.
 	virtual BOOL		loadSkeletonNode();
 	BOOL				loadMeshNodes();
diff --git a/indra/llappearance/llwearabletype.cpp b/indra/llappearance/llwearabletype.cpp
index aa0afe348a7..618e2a1941b 100644
--- a/indra/llappearance/llwearabletype.cpp
+++ b/indra/llappearance/llwearabletype.cpp
@@ -27,7 +27,19 @@
 #include "linden_common.h"
 #include "llwearabletype.h"
 #include "llinventorytype.h"
-#include "lltrans.h"
+
+static LLTranslationBridge* sTrans = NULL;
+
+// static
+void LLWearableType::initClass(LLTranslationBridge* trans)
+{
+	sTrans = trans;
+}
+
+void LLWearableType::cleanupClass()
+{
+	delete sTrans;
+}
 
 struct WearableEntry : public LLDictionaryEntry
 {
@@ -40,7 +52,7 @@ struct WearableEntry : public LLDictionaryEntry
 		LLDictionaryEntry(name),
 		mAssetType(assetType),
 		mDefaultNewName(default_new_name),
-		mLabel(LLTrans::getString(name)),
+		mLabel(sTrans->getString(name)),
 		mIconName(iconName),
 		mDisableCameraSwitch(disable_camera_switch),
 		mAllowMultiwear(allow_multiwear)
diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h
index 78008c27ea2..e51e6731d38 100644
--- a/indra/llappearance/llwearabletype.h
+++ b/indra/llappearance/llwearabletype.h
@@ -32,6 +32,13 @@
 #include "llinventorytype.h"
 #include "llsingleton.h"
 
+class LLTranslationBridge
+{
+public:
+	virtual std::string getString(const std::string &xml_desc) = 0;
+};
+
+
 class LLWearableType
 {
 public: 
@@ -59,6 +66,9 @@ class LLWearableType
 		WT_NONE		  = -1,
 	};
 
+	static void			initClass(LLTranslationBridge* trans); // initializes static members
+	static void			cleanupClass(); // initializes static members
+
 	static const std::string& 			getTypeName(EType type);
 	static const std::string& 			getTypeDefaultNewName(EType type);
 	static const std::string& 			getTypeLabel(EType type);
diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt
index 632e5d46e33..24d25311065 100644
--- a/indra/llaudio/CMakeLists.txt
+++ b/indra/llaudio/CMakeLists.txt
@@ -88,6 +88,10 @@ list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES})
 add_library (llaudio ${llaudio_SOURCE_FILES})
 target_link_libraries(
     llaudio
+    ${LLCOMMON_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLMESSAGE_LIBRARIES}
+    ${LLVFS_LIBRARIES}
     ${VORBISENC_LIBRARIES}
     ${VORBISFILE_LIBRARIES}
     ${VORBIS_LIBRARIES}
diff --git a/indra/llcharacter/CMakeLists.txt b/indra/llcharacter/CMakeLists.txt
index a1712699eb2..607cdf6d356 100644
--- a/indra/llcharacter/CMakeLists.txt
+++ b/indra/llcharacter/CMakeLists.txt
@@ -76,6 +76,15 @@ list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES})
 
 add_library (llcharacter ${llcharacter_SOURCE_FILES})
 
+target_link_libraries(
+    llcharacter
+    ${LLCOMMON_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLMESSAGE_LIBRARIES}
+    ${LLVFS_LIBRARIES}
+    ${LLXML_LIBRARIES}
+    )
+
 
 # Add tests
 if (LL_TESTS)
diff --git a/indra/llimage/CMakeLists.txt b/indra/llimage/CMakeLists.txt
index ea8c1a1107e..706464a7707 100644
--- a/indra/llimage/CMakeLists.txt
+++ b/indra/llimage/CMakeLists.txt
@@ -7,6 +7,8 @@ include(LLCommon)
 include(LLImage)
 include(LLMath)
 include(LLVFS)
+include(LLKDU)
+include(LLImageJ2COJ)
 include(ZLIB)
 include(LLAddBuildTest)
 include(Tut)
@@ -56,8 +58,16 @@ list(APPEND llimage_SOURCE_FILES ${llimage_HEADER_FILES})
 add_library (llimage ${llimage_SOURCE_FILES})
 # Libraries on which this library depends, needed for Linux builds
 # Sort by high-level to low-level
+if (USE_KDU)
+    target_link_libraries(llimage ${LLKDU_LIBRARIES})
+else (USE_KDU)
+    target_link_libraries(llimage ${LLIMAGEJ2COJ_LIBRARIES})
+endif (USE_KDU)
+
 target_link_libraries(llimage
-    llcommon
+    ${LLVFS_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLCOMMON_LIBRARIES}
     ${JPEG_LIBRARIES}
     ${PNG_LIBRARIES}
     ${ZLIB_LIBRARIES}
diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt
index e45c809e7e5..f2dd0b06f5f 100644
--- a/indra/llinventory/CMakeLists.txt
+++ b/indra/llinventory/CMakeLists.txt
@@ -58,6 +58,12 @@ list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES})
 
 add_library (llinventory ${llinventory_SOURCE_FILES})
 
+target_link_libraries(llinventory
+    ${LLCOMMON_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLMESSAGE_LIBRARIES}
+    ${LLXML_LIBRARIES}
+    )
 
 
 #add unit tests
diff --git a/indra/llkdu/CMakeLists.txt b/indra/llkdu/CMakeLists.txt
index bdac2eded7e..b8f8b420c32 100644
--- a/indra/llkdu/CMakeLists.txt
+++ b/indra/llkdu/CMakeLists.txt
@@ -41,7 +41,10 @@ set_source_files_properties(${llkdu_HEADER_FILES}
 list(APPEND llkdu_SOURCE_FILES ${llkdu_HEADER_FILES})
 
 if (USE_KDU)
-  add_library (${LLKDU_LIBRARIES} ${llkdu_SOURCE_FILES})
+  add_library (llkdu ${llkdu_SOURCE_FILES})
+
+  target_link_libraries(llkdu
+    ${KDU_LIBRARY})
   
   # Add tests
   if (LL_TESTS)
diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt
index 5865ae030c2..a06dea2e9ab 100644
--- a/indra/llmath/CMakeLists.txt
+++ b/indra/llmath/CMakeLists.txt
@@ -99,6 +99,10 @@ list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES})
 
 add_library (llmath ${llmath_SOURCE_FILES})
 
+target_link_libraries(llmath
+    ${LLCOMMON_LIBRARIES}
+    )
+
 # Add tests
 if (LL_TESTS)
   include(LLAddBuildTest)
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index d98781e9e62..1a90c32fe4f 100644
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -218,6 +218,9 @@ add_library (llmessage ${llmessage_SOURCE_FILES})
 target_link_libraries(
   llmessage
   ${CURL_LIBRARIES}
+  ${LLCOMMON_LIBRARIES}
+  ${LLVFS_LIBRARES}
+  ${LLMATH_LIBRARIES}
   ${CARES_LIBRARIES}
   ${OPENSSL_LIBRARIES}
   ${CRYPTO_LIBRARIES}
@@ -243,7 +246,7 @@ if (LL_TESTS)
     ${LLVFS_LIBRARIES}
     ${LLMATH_LIBRARIES}
     ${LLCOMMON_LIBRARIES}
-      ${GOOGLEMOCK_LIBRARIES}
+    ${GOOGLEMOCK_LIBRARIES}
     )
 
   LL_ADD_INTEGRATION_TEST(
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt
index e4d9de7eb64..cf01e10577b 100644
--- a/indra/llprimitive/CMakeLists.txt
+++ b/indra/llprimitive/CMakeLists.txt
@@ -59,6 +59,15 @@ list(APPEND llprimitive_SOURCE_FILES ${llprimitive_HEADER_FILES})
 
 add_library (llprimitive ${llprimitive_SOURCE_FILES})
 
+target_link_libraries(llprimitive
+    ${LLCOMMON_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLMESSAGE_LIBRARIES}
+    ${LLXML_LIBRARIES}
+    ${LLPHYSICSEXTENSIONS_LIBRARIES}
+    )
+
+
 #add unit tests
 if (LL_TESTS)
     INCLUDE(LLAddBuildTest)
diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt
index 3418ce2dfa7..d47129a67b3 100644
--- a/indra/llrender/CMakeLists.txt
+++ b/indra/llrender/CMakeLists.txt
@@ -105,6 +105,13 @@ add_library (llrender ${llrender_SOURCE_FILES})
 # Libraries on which this library depends, needed for Linux builds
 # Sort by high-level to low-level
 target_link_libraries(llrender 
-    llimage 
+    ${LLCOMMON_INCLUDE_DIRS}
+    ${LLIMAGE_INCLUDE_DIRS}
+    ${LLMATH_INCLUDE_DIRS}
+    ${LLRENDER_INCLUDE_DIRS}
+    ${LLVFS_INCLUDE_DIRS}
+    ${LLXML_INCLUDE_DIRS}
+    ${LLVFS_INCLUDE_DIRS}
+    ${LLWINDOW_LIBRARIES}
     ${FREETYPE_LIBRARIES}
     ${OPENGL_LIBRARIES})
diff --git a/indra/llvfs/CMakeLists.txt b/indra/llvfs/CMakeLists.txt
index a819d128617..80d5dd96e63 100644
--- a/indra/llvfs/CMakeLists.txt
+++ b/indra/llvfs/CMakeLists.txt
@@ -68,6 +68,7 @@ set(vfs_BOOST_LIBRARIES
     )
 
 target_link_libraries(llvfs
+    ${LLCOMMON_LIBRARIES}
     ${vfs_BOOST_LIBRARIES}
     )
 
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 341bddfffdb..652d5cae5ab 100644
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -64,6 +64,13 @@ set(viewer_HEADER_FILES
 # Sort by high-level to low-level
 if (LINUX AND VIEWER)
   set(llwindow_LINK_LIBRARIES
+      ${LLCOMMON_LIBRARIES}
+      ${LLIMAGE_LIBRARIES}
+      ${LLMATH_LIBRARIES}
+      ${LLRENDER_LIBRARIES}
+      ${LLVFS_LIBRARIES}
+      ${LLWINDOW_LIBRARIES}
+      ${LLXML_LIBRARIES}
       ${UI_LIBRARIES}     # for GTK
       ${SDL_LIBRARY}
       fontconfig          # For FCInit and other FC* functions.
@@ -160,7 +167,8 @@ endif (SERVER AND NOT WINDOWS AND NOT DARWIN)
 if (llwindow_HEADER_FILES)
   list(APPEND llwindow_SOURCE_FILES ${llwindow_HEADER_FILES})
 endif (llwindow_HEADER_FILES)
-  list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES})
+
+list(APPEND viewer_SOURCE_FILES ${viewer_HEADER_FILES})
 
 if (VIEWER)
   add_library (llwindow
diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt
index beefcda3610..ccd83876330 100644
--- a/indra/llxml/CMakeLists.txt
+++ b/indra/llxml/CMakeLists.txt
@@ -39,9 +39,10 @@ list(APPEND llxml_SOURCE_FILES ${llxml_HEADER_FILES})
 add_library (llxml ${llxml_SOURCE_FILES})
 # Libraries on which this library depends, needed for Linux builds
 # Sort by high-level to low-level
-target_link_libraries( llxml
-    llvfs
-    llmath
+target_link_libraries(llxml
+    ${LLVFS_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLCOMMON_LIBRARIES}
     ${EXPAT_LIBRARIES}
     )
 
diff --git a/indra/mac_updater/CMakeLists.txt b/indra/mac_updater/CMakeLists.txt
index 00dcedecaa9..a644984e58f 100644
--- a/indra/mac_updater/CMakeLists.txt
+++ b/indra/mac_updater/CMakeLists.txt
@@ -7,6 +7,7 @@ include(OpenSSL)
 include(CURL)
 include(CARes)
 include(LLCommon)
+include(LLMessage)
 include(LLVFS)
 include(Linking)
 
@@ -52,6 +53,7 @@ set_target_properties(mac-updater
   )
 
 target_link_libraries(mac-updater
+    ${LLMESSAGE_LIBRARIES}
     ${LLVFS_LIBRARIES}
     ${OPENSSL_LIBRARIES}
     ${CRYPTO_LIBRARIES}
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 9215b7b670b..b12853b014c 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1824,17 +1824,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${LLAPPEARANCE_LIBRARIES}
     )
 
-if (USE_KDU)
-    target_link_libraries(${VIEWER_BINARY_NAME}
-        ${LLKDU_LIBRARIES}
-        ${KDU_LIBRARY}
-        )
-else (USE_KDU)
-    target_link_libraries(${VIEWER_BINARY_NAME}
-        ${LLIMAGEJ2COJ_LIBRARIES}
-        )
-endif (USE_KDU)
-
 build_version(viewer)
 
 set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index fbf15ff5ce4..587435301da 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -668,6 +668,15 @@ LLAppViewer::~LLAppViewer()
 	removeMarkerFile();
 }
 
+class LLUITranslationBridge : public LLTranslationBridge
+{
+public:
+	virtual std::string getString(const std::string &xml_desc)
+	{
+		return LLTrans::getString(xml_desc);
+	}
+};
+
 bool LLAppViewer::init()
 {	
 	//
@@ -679,6 +688,10 @@ bool LLAppViewer::init()
 	//
 	LLFastTimer::reset();
 
+	// initialize LLWearableType translation bridge.
+	// Memory will be cleaned up in ::cleanupClass()
+	LLWearableType::initClass(new LLUITranslationBridge());
+
 	// initialize SSE options
 	LLVector4a::initClass();
 
@@ -1797,6 +1810,8 @@ bool LLAppViewer::cleanup()
 	llinfos << "Cleaning up Objects" << llendflush;
 	
 	LLViewerObject::cleanupVOClasses();
+
+	LLAvatarAppearance::cleanupClass();
 	
 	LLPostProcess::cleanupClass();
 
@@ -2030,6 +2045,8 @@ bool LLAppViewer::cleanup()
 	llinfos << "Cleaning up LLProxy." << llendl;
 	LLProxy::cleanupClass();
 
+	LLWearableType::cleanupClass();
+
 	LLMainLoopRepeater::instance().stop();
 
 	//release all private memory pools.
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index fa1f9c95aba..0d16d039da8 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1039,9 +1039,6 @@ void LLVOAvatar::initClass()
 
 void LLVOAvatar::cleanupClass()
 {
-	deleteAndClear(sAvatarXmlInfo);
-	sSkeletonXMLTree.cleanup();
-	sXMLTree.cleanup();
 }
 
 // virtual
-- 
GitLab