From 291d76b3f0759eaa514d7dcdd48597fbf3ecb139 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Fri, 16 Dec 2022 20:08:34 -0500
Subject: [PATCH] Enable Havok in CI config for darwin and windows

---
 .gitlab-ci.yml                        | 18 +++++++++---------
 autobuild.xml                         |  4 ----
 indra/cmake/DiscordSDK.cmake          |  2 +-
 indra/cmake/FMODSTUDIO.cmake          |  2 +-
 indra/cmake/LLKDU.cmake               |  6 +++---
 indra/cmake/LLPhysicsExtensions.cmake |  4 ++--
 indra/cmake/NVAPI.cmake               |  6 +++++-
 indra/cmake/Sentry.cmake              | 27 +++++++++++++++++++++------
 indra/cmake/Variables.cmake           | 12 +++---------
 9 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c401b5f6da1..a113fc7abbc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,9 +32,9 @@ variables:
     - .\.venv\Scripts\activate.ps1
     - pip3 install --upgrade llbase autobuild
   script:
-    - autobuild configure -c ReleaseOS -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_DISCORD=ON -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
-    - autobuild build -c ReleaseOS --no-configure
-    - autobuild graph -c ReleaseOS --graph-file alchemy-windows${AUTOBUILD_ADDRSIZE}-dependencies.svg build-vc-64/autobuild-package.xml
+    - autobuild configure -c Release -- -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
+    - autobuild build -c Release --no-configure
+    - autobuild graph -c Release --graph-file alchemy-windows${AUTOBUILD_ADDRSIZE}-dependencies.svg build-vc-64/autobuild-package.xml
     - |
         If ($env:USE_SENTRY -eq 'TRUE') 
         {
@@ -87,9 +87,9 @@ variables:
     - source .venv/bin/activate
     - pip3 install --upgrade llbase autobuild dmgbuild
   script:
-    - autobuild configure -c ReleaseOS -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_DISCORD=ON -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
-    - autobuild build -c ReleaseOS --no-configure
-    - autobuild graph -c ReleaseOS --graph-file alchemy-darwin${AUTOBUILD_ADDRSIZE}-dependencies.svg build-darwin-64/autobuild-package.xml
+    - autobuild configure -c Release -- -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
+    - autobuild build -c Release --no-configure
+    - autobuild graph -c Release --graph-file alchemy-darwin${AUTOBUILD_ADDRSIZE}-dependencies.svg build-darwin-64/autobuild-package.xml
     - |
         if [ "$USE_SENTRY" = "TRUE" ]
         then
@@ -138,9 +138,9 @@ variables:
     - source .venv/bin/activate
     - pip3 install --upgrade llbase autobuild
   script:
-    - autobuild configure -c ReleaseOS -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_DISCORD=ON -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
-    - autobuild build -c ReleaseOS --no-configure
-    - autobuild graph -c ReleaseOS --graph-file alchemy-linuxs${AUTOBUILD_ADDRSIZE}-dependencies.svg build-linux-${AUTOBUILD_ADDRSIZE}/autobuild-package.xml
+    - autobuild configure -c Release -- -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
+    - autobuild build -c Release --no-configure
+    - autobuild graph -c Release --graph-file alchemy-linuxs${AUTOBUILD_ADDRSIZE}-dependencies.svg build-linux-${AUTOBUILD_ADDRSIZE}/autobuild-package.xml
     - |
         if [ "$USE_SENTRY" = "TRUE" ] 
         then
diff --git a/autobuild.xml b/autobuild.xml
index c58f20a1371..67dfbf0c415 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -3071,8 +3071,6 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
                   <string>-A</string>
                   <string>${AUTOBUILD_WIN_VSPLATFORM|NOTWIN}</string>
                   <string>-DUNATTENDED:BOOL=ON</string>
-                  <string>-DINSTALL_PROPRIETARY=FALSE</string>
-                  <string>-DUSE_KDU=FALSE</string>
                 </array>
               </map>
               <key>name</key>
@@ -3143,8 +3141,6 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
                   <string>${AUTOBUILD_WIN_VSPLATFORM|NOTWIN}</string>
                   <string>-T</string>
                   <string>host=x64</string>
-                  <string>-DINSTALL_PROPRIETARY=FALSE</string>
-                  <string>-DUSE_KDU=FALSE</string>
                 </array>
               </map>
               <key>name</key>
diff --git a/indra/cmake/DiscordSDK.cmake b/indra/cmake/DiscordSDK.cmake
index 717ab0b040d..ea794c60390 100644
--- a/indra/cmake/DiscordSDK.cmake
+++ b/indra/cmake/DiscordSDK.cmake
@@ -3,7 +3,7 @@ include(Linking)
 include(Prebuilt)
 
 if (INSTALL_PROPRIETARY)
-  set(USE_DISCORD ON)
+  set(USE_DISCORD ON CACHE BOOL "Use Discord SDK" FORCE)
 endif (INSTALL_PROPRIETARY)
 
 if (USE_DISCORD)
diff --git a/indra/cmake/FMODSTUDIO.cmake b/indra/cmake/FMODSTUDIO.cmake
index 20a16ecd21b..ac4a59f86a4 100644
--- a/indra/cmake/FMODSTUDIO.cmake
+++ b/indra/cmake/FMODSTUDIO.cmake
@@ -8,7 +8,7 @@ include(Prebuilt)
 # Open source devs should use the -DFMODSTUDIO:BOOL=ON then if they want to build with FMOD, whether
 # they are using STANDALONE or not.
 if (INSTALL_PROPRIETARY)
-  set(USE_FMODSTUDIO ON)
+  set(USE_FMODSTUDIO ON CACHE BOOL "Use FMOD Studio audio subsystem" FORCE)
 endif (INSTALL_PROPRIETARY)
 
 if (USE_FMODSTUDIO)
diff --git a/indra/cmake/LLKDU.cmake b/indra/cmake/LLKDU.cmake
index 7fa4a50fdb1..111ed956e52 100644
--- a/indra/cmake/LLKDU.cmake
+++ b/indra/cmake/LLKDU.cmake
@@ -3,9 +3,9 @@
 # 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)
-  option(USE_KDU "Use Kakadu library." ON)
-endif (INSTALL_PROPRIETARY)
+#if (INSTALL_PROPRIETARY)
+#  option(USE_KDU "Use Kakadu library." ON)
+#endif (INSTALL_PROPRIETARY)
 
 if (USE_KDU)
   include(Prebuilt)
diff --git a/indra/cmake/LLPhysicsExtensions.cmake b/indra/cmake/LLPhysicsExtensions.cmake
index 289d74ab162..e115fc3d056 100644
--- a/indra/cmake/LLPhysicsExtensions.cmake
+++ b/indra/cmake/LLPhysicsExtensions.cmake
@@ -8,7 +8,7 @@ include(Prebuilt)
 # - The prebuilt package available to those with sublicenses, selected by -DHAVOK_TPV:BOOL=ON
 
 if (INSTALL_PROPRIETARY)
-   set(HAVOK ON CACHE BOOL "Use Havok physics library")
+   set(HAVOK_TPV ON CACHE BOOL "Use Havok physics library" FORCE)
 endif (INSTALL_PROPRIETARY)
 
 
@@ -22,7 +22,7 @@ if (HAVOK)
    set(LLPHYSICSEXTENSIONS_SRC_DIR ${LIBS_PREBUILT_DIR}/llphysicsextensions/src)
    set(LLPHYSICSEXTENSIONS_LIBRARIES    llphysicsextensions)
    set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) 
-elseif (HAVOK_TPV)
+elseif (HAVOK_TPV AND NOT LINUX)
    use_prebuilt_binary(llphysicsextensions_tpv)
    set(LLPHYSICSEXTENSIONS_LIBRARIES    ${ARCH_PREBUILT_DIRS}/llphysicsextensions_tpv.lib)
    set(LLPHYSICSEXTENSIONS_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/llphysicsextensions) 
diff --git a/indra/cmake/NVAPI.cmake b/indra/cmake/NVAPI.cmake
index 3c406fc0365..660af3201b9 100644
--- a/indra/cmake/NVAPI.cmake
+++ b/indra/cmake/NVAPI.cmake
@@ -1,7 +1,11 @@
 # -*- cmake -*-
 include(Prebuilt)
 
-set(USE_NVAPI OFF CACHE BOOL "Use NVAPI.")
+set(USE_NVAPI OFF CACHE BOOL "Use NVAPI library.")
+
+if (INSTALL_PROPRIETARY)
+  set(USE_NVAPI ON CACHE BOOL "" FORCE)
+endif (INSTALL_PROPRIETARY)
 
 if (USE_NVAPI)
   if (WINDOWS)
diff --git a/indra/cmake/Sentry.cmake b/indra/cmake/Sentry.cmake
index 4cf0fce0bf3..9af2f612e9d 100644
--- a/indra/cmake/Sentry.cmake
+++ b/indra/cmake/Sentry.cmake
@@ -1,5 +1,26 @@
 include(Variables)
 
+#Crash reporting
+option(USE_SENTRY "Use the Sentry crash reporting system" OFF)
+if (DEFINED ENV{USE_SENTRY})
+  set(USE_SENTRY $ENV{USE_SENTRY} CACHE BOOL "" FORCE)
+endif()
+
+if(DEFINED ENV{SENTRY_DSN})
+    set(SENTRY_DSN $ENV{SENTRY_DSN} CACHE STRING "Sentry DSN" FORCE)
+endif()
+
+if (INSTALL_PROPRIETARY)
+    # Note that viewer_manifest.py makes decision based on SENTRY_DSN and not USE_SENTRY
+    if (SENTRY_DSN)
+        set(USE_SENTRY ON  CACHE BOOL "Use the Sentry crash reporting system" FORCE)
+    else (SENTRY_DSN)
+        set(USE_SENTRY OFF CACHE BOOL "Use the Sentry crash reporting system" FORCE)
+    endif (SENTRY_DSN)
+else (INSTALL_PROPRIETARY)
+    set(USE_SENTRY OFF CACHE BOOL "Use the Sentry crash reporting system" FORCE)
+endif (INSTALL_PROPRIETARY)
+
 if (USE_SENTRY)
     if (NOT USESYSTEMLIBS)
         include(Prebuilt)
@@ -26,12 +47,6 @@ if (USE_SENTRY)
         find_package(Sentry REQUIRED)
     endif ()
 
-    if(DEFINED ENV{SENTRY_DSN})
-        set(SENTRY_DSN $ENV{SENTRY_DSN} CACHE STRING "Sentry DSN" FORCE)
-    else()
-        set(SENTRY_DSN "" CACHE STRING "Sentry DSN")
-    endif()
-
     if(SENTRY_DSN STREQUAL "")
         message(FATAL_ERROR "You must set a DSN url with -DSENTRY_DSN= to enable sentry")
     endif()
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 78fb64fcb7a..8fe2f848e44 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -51,12 +51,6 @@ set(VIEWER_SYMBOL_FILE "" CACHE STRING "Name of tarball into which to place symb
 option(USE_CEF "Enable CEF media plugin" ON)
 option(USE_VLC "Enable VLC media plugin" ON)
 
-#Crash reporting
-option(USE_SENTRY "Use the Sentry crash reporting system" OFF)
-if (DEFINED ENV{USE_SENTRY})
-  set(USE_SENTRY $ENV{USE_SENTRY} CACHE BOOL "" FORCE)
-endif()
-
 #Discord Integration
 option(USE_DISCORD "Enable Discord client integration" OFF)
 if (DEFINED ENV{USE_DISCORD})
@@ -152,14 +146,14 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
   set(LL_ARCH ${ARCH}_linux)
   set(LL_ARCH_DIR ${ARCH}-linux)
 
-  if (INSTALL_PROPRIETARY)
+  #if (INSTALL_PROPRIETARY)
     # Only turn on headless if we can find osmesa libraries.
-    include(FindPkgConfig)
+    # include(FindPkgConfig)
     #pkg_check_modules(OSMESA osmesa)
     #if (OSMESA_FOUND)
     #  set(BUILD_HEADLESS ON CACHE BOOL "Build headless libraries.")
     #endif (OSMESA_FOUND)
-  endif (INSTALL_PROPRIETARY)
+  #endif (INSTALL_PROPRIETARY)
 
 endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 
-- 
GitLab