From b029846e81f104789d001e56ca0d83fe8c9e93cd Mon Sep 17 00:00:00 2001
From: "Mark Palange (Mani)" <palange@lindenlab.com>
Date: Tue, 28 Jul 2009 13:20:23 -0700
Subject: [PATCH] DEV-35399 - Making the server build llcommon.dll compatible.
 Now using RunBuildTest.cmake to run tut and lscript_lsl tests, inorder to set
 path to llcommon.dll Exported a few llcommon apis needed by server
 components/tests.

---
 indra/cmake/LLCommon.cmake            |  2 +-
 indra/cmake/Linking.cmake             |  2 +-
 indra/llcommon/lldate.h               |  4 ++--
 indra/llcommon/lldependencies.h       |  2 +-
 indra/llcommon/llliveappconfig.h      |  2 +-
 indra/test/CMakeLists.txt             | 23 +++++++++++++++++------
 indra/test/llsdmessagebuilder_tut.cpp |  3 ++-
 7 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake
index 19d61008dae..d1ab264a413 100644
--- a/indra/cmake/LLCommon.cmake
+++ b/indra/cmake/LLCommon.cmake
@@ -19,5 +19,5 @@ add_definitions(${TCMALLOC_FLAG})
 
 set(LLCOMMON_LINK_SHARED ON CACHE BOOL "Build the llcommon target as a shared library.")
 if(LLCOMMON_LINK_SHARED)
-    add_definitions(-DLL_COMMON_LINK_SHARED=1)
+  add_definitions(-DLL_COMMON_LINK_SHARED=1)
 endif(LLCOMMON_LINK_SHARED)
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index 4063034837d..578edf99894 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -5,7 +5,7 @@ if (NOT STANDALONE)
     set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib)
     set(ARCH_PREBUILT_DIRS_RELEASE ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/release)
     set(ARCH_PREBUILT_DIRS_DEBUG ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib/debug)
-    set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs)
+    set(SHARED_LIB_STAGING_DIR ${CMAKE_BINARY_DIR}/sharedlibs CACHE FILEPATH "Location of staged DLLs")
   elseif (LINUX)
     if (VIEWER)
       set(ARCH_PREBUILT_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/lib_release_client)
diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h
index d6982fbd9e0..4dffaafc7d6 100644
--- a/indra/llcommon/lldate.h
+++ b/indra/llcommon/lldate.h
@@ -155,10 +155,10 @@ class LL_COMMON_API LLDate
 };
 
 // Helper function to stream out a date
-std::ostream& operator<<(std::ostream& s, const LLDate& date);
+LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLDate& date);
 
 // Helper function to stream in a date
-std::istream& operator>>(std::istream& s, LLDate& date);
+LL_COMMON_API std::istream& operator>>(std::istream& s, LLDate& date);
 
 
 const static std::string weekdays[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h
index bd4bd7c96ab..754557cf31e 100644
--- a/indra/llcommon/lldependencies.h
+++ b/indra/llcommon/lldependencies.h
@@ -81,7 +81,7 @@ struct instance_from_range: public TYPE
  * LLDependencies components that should not be reinstantiated for each KEY,
  * NODE specialization
  */
-class LLDependenciesBase
+class LL_COMMON_API LLDependenciesBase
 {
 public:
     virtual ~LLDependenciesBase() {}
diff --git a/indra/llcommon/llliveappconfig.h b/indra/llcommon/llliveappconfig.h
index a6ece6e8b39..73b3a233527 100644
--- a/indra/llcommon/llliveappconfig.h
+++ b/indra/llcommon/llliveappconfig.h
@@ -45,7 +45,7 @@
  * loop.  The traditional name for it is live_config.  Be sure to call
  * <code>live_config.checkAndReload()</code> periodically.
  */
-class LLLiveAppConfig : public LLLiveFile
+class LL_COMMON_API LLLiveAppConfig : public LLLiveFile
 {
 public:
 
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index 42a32f95b1a..7ccd554be4e 100644
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -13,7 +13,7 @@ include(LLXML)
 include(LScript)
 include(Linking)
 include(Tut)
-include(Boost)
+
 
 include_directories(
     ${LLCOMMON_INCLUDE_DIRS}
@@ -124,6 +124,7 @@ target_link_libraries(test
     ${LLXML_LIBRARIES}
     ${LSCRIPT_LIBRARIES}
     ${LLCOMMON_LIBRARIES}
+	${EXPAT_LIBRARIES}
     ${APRICONV_LIBRARIES}
     ${PTHREAD_LIBRARY}
     ${WINDOWS_LIBRARIES}
@@ -143,16 +144,26 @@ endif (WINDOWS)
 
 get_target_property(TEST_EXE test LOCATION)
 
-add_custom_command(
+IF(WINDOWS)
+  set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
+ELSE(WINDOWS)
+  set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:/usr/lib)
+ENDIF(WINDOWS)
+
+SET(TEST_CMD ${TEST_EXE} --output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt --touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt)
+
+ADD_CUSTOM_COMMAND(
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
-  COMMAND ${TEST_EXE}
+  COMMAND ${CMAKE_COMMAND}
   ARGS
-    --output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt
-    --touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
+    -DLD_LIBRARY_PATH=${LD_LIBRARY_PATH}
+    -DTEST_CMD:STRING="${TEST_CMD}" 
+    -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake
+      
   DEPENDS test
   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
   COMMENT "C++ unit tests"
-  )
+ )
 
 set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt)
 
diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp
index 9edb9157034..f4457b6d15e 100755
--- a/indra/test/llsdmessagebuilder_tut.cpp
+++ b/indra/test/llsdmessagebuilder_tut.cpp
@@ -44,7 +44,8 @@
 #include "v3dmath.h"
 #include "v3math.h"
 #include "v4math.h"
-#include "llsdutil.cpp"
+#include "llsdutil.h"
+//#include "llsdutil.cpp"
 #include "llsdutil_math.cpp"
 #include "lltemplatemessagebuilder.h"
 
-- 
GitLab