From 211caf0618d2722f3eea86e8ac191da2bbea570d Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Thu, 1 Oct 2020 20:46:21 -0400
Subject: [PATCH] Add support for setting channel via environmental vars

---
 indra/cmake/Variables.cmake | 44 +++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index c6078664863..abcd9e3b923 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -23,9 +23,23 @@ set(LIBS_OPEN_PREFIX)
 set(SCRIPTS_PREFIX ../scripts)
 set(VIEWER_PREFIX)
 set(INTEGRATION_TESTS_PREFIX)
-set(LL_TESTS ON CACHE BOOL "Build and run unit and integration tests (disable for build timing runs to reduce variation")
-set(INCREMENTAL_LINK OFF CACHE BOOL "Use incremental linking on win32 builds (enable for faster links on some machines)")
-set(ENABLE_MEDIA_PLUGINS ON CACHE BOOL "Turn off building media plugins if they are imported by third-party library mechanism")
+
+option(LL_TESTS "Build and run unit and integration tests (disable for build timing runs to reduce variation" ON)
+option(ENABLE_MEDIA_PLUGINS "Turn off building media plugins if they are imported by third-party library mechanism" ON)
+
+# Compiler and toolchain options
+option(INCREMENTAL_LINK "Use incremental linking on win32 builds (enable for faster links on some machines)" OFF)
+option(USE_LTO "Enable global and interprocedural optimizations" OFF)
+option(FULL_DEBUG_SYMS "Enable Generation of full pdb on msvc" OFF)
+option(USE_ASAN "Enable address sanitizer for detection of memory issues" OFF)
+option(USE_LEAKSAN "Enable address sanitizer for detection of memory leaks" OFF)
+option(USE_UBSAN "Enable undefined behavior sanitizer" OFF)
+option(USE_THDSAN "Enable thread sanitizer for detection of thread data races and mutexing issues" OFF)
+if(USE_ASAN AND USE_LEAKSAN)
+  message(FATAL_ERROR "You may only enable either USE_ASAN or USE_LEAKSAN not both")
+elseif((USE_ASAN OR USE_LEAKSAN) AND USE_THDSAN)
+  message(FATAL_ERROR "Address and Leak sanitizers are incompatible with thread sanitizer")
+endif(USE_ASAN AND USE_LEAKSAN)
 set(VIEWER_SYMBOL_FILE "" CACHE STRING "Name of tarball into which to place symbol files")
 set(BUGSPLAT_DB "" CACHE STRING "BugSplat database name, if BugSplat crash reporting is desired")
 
@@ -199,7 +213,29 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # Default deploy grid
 set(GRID agni CACHE STRING "Target Grid")
 
-set(VIEWER_CHANNEL "Alchemy Test" CACHE STRING "Viewer Channel Name")
+if (DEFINED ENV{VIEWER_CHANNEL_BASE})
+  set(VIEWER_CHANNEL_BASE $ENV{VIEWER_CHANNEL_BASE} CACHE STRING "Viewer Channel Base Name" FORCE)
+else()
+  set(VIEWER_CHANNEL_BASE "Alchemy" CACHE STRING "Viewer Channel Base Name")
+endif()
+
+if (DEFINED ENV{VIEWER_CHANNEL_TYPE})
+  set(VIEWER_CHANNEL_TYPE $ENV{VIEWER_CHANNEL_TYPE} CACHE STRING "Viewer Channel Type Name" FORCE)
+else()
+  set(VIEWER_CHANNEL_TYPE "Test" CACHE STRING "Viewer Channel Type Name")
+endif()
+
+if (DEFINED ENV{VIEWER_CHANNEL_CODENAME})
+  set(VIEWER_CHANNEL_CODENAME $ENV{VIEWER_CHANNEL_CODENAME} CACHE STRING "Viewer Channel Code Name for Project type" FORCE)
+else()
+  set(VIEWER_CHANNEL_CODENAME "Default" CACHE STRING "Viewer Channel Code Name for Project type")
+endif()
+
+if("${VIEWER_CHANNEL_TYPE}" STREQUAL "Project")
+  set(VIEWER_CHANNEL "${VIEWER_CHANNEL_BASE} ${VIEWER_CHANNEL_TYPE} ${VIEWER_CHANNEL_CODENAME}")
+else()
+  set(VIEWER_CHANNEL "${VIEWER_CHANNEL_BASE} ${VIEWER_CHANNEL_TYPE}")
+endif()
 
 set(ENABLE_SIGNING OFF CACHE BOOL "Enable signing the viewer")
 set(SIGNING_IDENTITY "" CACHE STRING "Specifies the signing identity to use, if necessary.")
-- 
GitLab