From 038c555fc4254de62a477d1c83a2131970b0b2b5 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Tue, 21 Feb 2017 17:12:27 -0500
Subject: [PATCH] DRTVWR-418: In viewer64-mac-havok fork, turn on Xcode 8
 Havok.

This is known not to work yet: the relevant Havok libraries are not being
bundled with llphysicsextensions, therefore the viewer can't link with any
Havok symbols.
---
 autobuild.xml           | 16 ++++++----------
 build.sh                |  4 ++--
 indra/cmake/Havok.cmake |  5 +++++
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/autobuild.xml b/autobuild.xml
index 975a4ebd64a..51beb0ddaf4 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -1322,9 +1322,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>cbaa7619050123c3fd2a88959f88bd47</string>
+              <string>bd749bc181e8d75718267bc0ecf4c5bf</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/749/1553/havok_source-2012.1-2-darwin64-500739.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/2750/6262/havok_source-2012.1-2-darwin64-502736.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -1358,9 +1358,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>dab55cc0555d7126fda925e20af851ea</string>
+              <string>03be19251601027841c767f723dae1d4</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1194/2807/havok_source-2012.1-2-windows-501181.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/2756/6286/havok_source-2012.1-2-windows-502736.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
@@ -1370,9 +1370,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>7bbc1c3512a5665b7576b4b0357a9eb7</string>
+              <string>de3884eeed32297845add77d5ecc7e6b</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/1195/2816/havok_source-2012.1-2-windows64-501181.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/2755/6280/havok_source-2012.1-2-windows64-502736.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows64</string>
@@ -3357,7 +3357,6 @@
                 <array>
                   <string>-G</string>
                   <string>Xcode</string>
-                  <string>-DHAVOK:BOOL=OFF</string>
                 </array>
               </map>
               <key>default</key>
@@ -3386,7 +3385,6 @@
                 <array>
                   <string>-G</string>
                   <string>Xcode</string>
-                  <string>-DHAVOK:BOOL=OFF</string>
                 </array>
               </map>
               <key>name</key>
@@ -3421,7 +3419,6 @@
                 <array>
                   <string>-G</string>
                   <string>Xcode</string>
-                  <string>-DHAVOK:BOOL=OFF</string>
                 </array>
               </map>
               <key>name</key>
@@ -3448,7 +3445,6 @@
                 <array>
                   <string>-G</string>
                   <string>Xcode</string>
-                  <string>-DHAVOK:BOOL=OFF</string>
                 </array>
               </map>
               <key>name</key>
diff --git a/build.sh b/build.sh
index 9ca130b5d53..a8f4158bfff 100755
--- a/build.sh
+++ b/build.sh
@@ -97,14 +97,14 @@ pre_build()
 
     # nat 2016-12-20: disable HAVOK on Mac until we get a 64-bit Mac build.
     RELEASE_CRASH_REPORTING=ON
+    HAVOK=ON
     SIGNING=()
     if [ "$arch" == "Darwin" ]
-    then HAVOK=OFF
+    then
          if [ "$variant" == "Release" ]
          then SIGNING=("-DENABLE_SIGNING:BOOL=YES" \
                        "-DSIGNING_IDENTITY:STRING=Developer ID Application: Linden Research, Inc.")
          fi
-    else HAVOK=ON
     fi
 
     "$autobuild" configure --quiet -c $variant -- \
diff --git a/indra/cmake/Havok.cmake b/indra/cmake/Havok.cmake
index 243b9f5e340..811a126b8fb 100644
--- a/indra/cmake/Havok.cmake
+++ b/indra/cmake/Havok.cmake
@@ -8,6 +8,11 @@ use_prebuilt_binary(havok-source)
 set(Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Source)
 list(APPEND Havok_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/havok/Demo)
 
+# HK_DISABLE_IMPLICIT_VVECTOR3_CONVERSION suppresses an intended conversion
+# function which Xcode scolds us will unconditionally enter infinite
+# recursion if called. This hides that function.
+add_definitions("-DHK_DISABLE_IMPLICIT_VVECTOR3_CONVERSION")
+
 set(HAVOK_DEBUG_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/debug/havok-fulldebug)
 set(HAVOK_RELEASE_LIBRARY_PATH ${LIBS_PREBUILT_DIR}/lib/release/havok)
 
-- 
GitLab