From 2e88a3266529714efcf8ae092819a25393540c8a Mon Sep 17 00:00:00 2001
From: Dave Houlton <euclid@lindenlab.com>
Date: Mon, 19 Jul 2021 16:26:33 -0600
Subject: [PATCH] SL-15595 update viewer autobuild to import tracy lib

---
 autobuild.xml                 | 64 +++++++++++++++++++++++++++++++++++
 indra/cmake/Tracy.cmake       | 17 ++++++++++
 indra/llcommon/CMakeLists.txt |  2 ++
 indra/newview/CMakeLists.txt  |  3 ++
 4 files changed, 86 insertions(+)
 create mode 100644 indra/cmake/Tracy.cmake

diff --git a/autobuild.xml b/autobuild.xml
index 4768bd25c67..4eaa16e8d9b 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -3067,6 +3067,70 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
         <key>version</key>
         <string>4.10.0000.32327.5fc3fe7c.539691</string>
       </map>
+      <key>tracy</key>
+      <map>
+        <key>canonical_repo</key>
+        <string>https://bitbucket.org/lindenlab/3p-tracy</string>
+        <key>copyright</key>
+        <string>Copyright (c) 2017-2021, Bartosz Taudul (wolf@nereid.pl)</string>
+        <key>description</key>
+        <string>Tracy Profiler Library</string>
+        <key>license</key>
+        <string>bsd</string>
+        <key>license_file</key>
+        <string>LICENSES/tracy_license.txt</string>
+        <key>name</key>
+        <string>tracy</string>
+        <key>platforms</key>
+        <map>
+          <key>darwin64</key>
+          <map>
+            <key>archive</key>
+            <map>
+              <key>hash</key>
+              <string>c7820c2c3df46ffef6b09de4a8772f86</string>
+              <key>url</key>
+              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/84525/786813/tracy-v0.7.8.561601-darwin64-561601.tar.bz2</string>
+            </map>
+            <key>name</key>
+            <string>darwin64</string>
+          </map>
+          <key>windows</key>
+          <map>
+            <key>archive</key>
+            <map>
+              <key>hash</key>
+              <string>503a6ea5c08e17a6709f11cb55b4204a</string>
+              <key>hash_algorithm</key>
+              <string>md5</string>
+              <key>url</key>
+              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/85310/791192/tracy-v0.7.8.562170-windows-562170.tar.bz2</string>
+            </map>
+            <key>name</key>
+            <string>windows</string>
+          </map>
+          <key>windows64</key>
+          <map>
+            <key>archive</key>
+            <map>
+              <key>hash</key>
+              <string>3f61d596eee650763e3cb1d9f6869ed2</string>
+              <key>hash_algorithm</key>
+              <string>md5</string>
+              <key>url</key>
+              <string>https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/85309/791191/tracy-v0.7.8.562170-windows64-562170.tar.bz2</string>
+            </map>
+            <key>name</key>
+            <string>windows64</string>
+          </map>
+        </map>
+        <key>source</key>
+        <string>https://bitbucket.org/lindenlab/3p-tracy</string>
+        <key>source_type</key>
+        <string>git</string>
+        <key>version</key>
+        <string>v0.7.8.562170</string>
+      </map>
       <key>tut</key>
       <map>
         <key>copyright</key>
diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake
new file mode 100644
index 00000000000..bf09bccd4b7
--- /dev/null
+++ b/indra/cmake/Tracy.cmake
@@ -0,0 +1,17 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(TRACY ON CACHE BOOL "Use Tracy profiler.")
+
+if (TRACY)
+  set(TRACY_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/tracy) 
+  if (WINDOWS)
+    use_prebuilt_binary(tracy)
+    set(TRACY_LIBRARY tracy)
+  else (WINDOWS)
+    set(TRACY_LIBRARY "")
+  endif (WINDOWS)
+else (TRACY)
+  set(TRACY_LIBRARY "")
+endif (TRACY)
+
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index dd266630ea7..f1b05066595 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -13,6 +13,7 @@ include(GoogleBreakpad)
 include(Copy3rdPartyLibs)
 include(ZLIB)
 include(URIPARSER)
+include(Tracy)
 
 include_directories(
     ${EXPAT_INCLUDE_DIRS}
@@ -21,6 +22,7 @@ include_directories(
     ${ZLIB_INCLUDE_DIRS}
     ${BREAKPAD_INCLUDE_DIRECTORIES}
     ${URIPARSER_INCLUDE_DIRS}
+    ${TRACY_INCLUDE_DIR}
     )
 
 # add_executable(lltreeiterators lltreeiterators.cpp)
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 2995a006ac7..fbe75af7127 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -47,6 +47,7 @@ include(OpenGL)
 include(OpenSSL)
 include(PNG)
 include(TemplateCheck)
+include(Tracy)
 include(UI)
 include(UnixInstall)
 include(ViewerMiscLibs)
@@ -92,6 +93,7 @@ include_directories(
     ${LIBS_PREBUILT_DIR}/include/collada/1.4
     ${LLAPPEARANCE_INCLUDE_DIRS}
     ${CMAKE_CURRENT_SOURCE_DIR}
+    ${TRACY_INCLUDE_DIR}
     )
 
 include_directories(SYSTEM
@@ -2066,6 +2068,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${LLPHYSICS_LIBRARIES}
     ${LLPHYSICSEXTENSIONS_LIBRARIES}
     ${LLAPPEARANCE_LIBRARIES}
+    ${TRACY_LIBRARY}
     )
 
 if (USE_BUGSPLAT)
-- 
GitLab