Add Xcode support to build_rive.sh

Add an "xcode" option that generates and builds an xcode workspace.

Add -Wshorten-64-to-32 to non-Xcode builds and fix more warnings.

Diffs=
f0da6a7a0 Add Xcode support to build_rive.sh (#7780)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head
index b7f1515..5ee0753 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-c12b0bb24d1abff5b8df6f9b3a4053fbc5096668
+f0da6a7a097a782df5839390097254bbfb8d9a00
diff --git a/build/build_rive.sh b/build/build_rive.sh
index 48ad950..9bef073 100755
--- a/build/build_rive.sh
+++ b/build/build_rive.sh
@@ -13,6 +13,7 @@
 #   build_rive.sh                      # debug build
 #   build_rive.sh release              # release build
 #   build_rive.sh release clean        # clean, followed by a release build
+#   build_rive.sh xcode                # generate and build an xcode workspace
 #   build_rive.sh ninja                # use ninja (experimental) for a debug build
 #   build_rive.sh ninja release        # use ninja (experimental) for a release build
 #   build_rive.sh ninja --with_vulkan  # extra parameters get forwarded to premake
@@ -140,6 +141,7 @@
             "universal") RIVE_ARCH="${RIVE_ARCH:-universal}" ;;
             "wasm") RIVE_ARCH="${RIVE_ARCH:-wasm}" ;;
             "ninja") RIVE_BUILD_SYSTEM="${RIVE_BUILD_SYSTEM:-ninja}" ;;
+            "xcode") RIVE_BUILD_SYSTEM="${RIVE_BUILD_SYSTEM:-xcode4}" ;;
             "clean") RIVE_CLEAN="${RIVE_CLEAN:-true}" ;;
             "compdb")
                 RIVE_BUILD_SYSTEM="${RIVE_BUILD_SYSTEM:-export-compile-commands}"
@@ -267,15 +269,28 @@
         echo ninja -C $RIVE_OUT $@
         ninja -C $RIVE_OUT $@
         ;;
+    xcode4)
+        if [[ $# = 0 ]]; then
+            echo 'No targets specified for xcode: Attempting to grok them from "xcodebuild -list".'
+            XCODE_SCHEMES=$(for f in $(xcodebuild -list -workspace $RIVE_OUT/rive.xcworkspace | grep '^        '); do printf " $f"; done)
+            echo "  -> groked:$XCODE_SCHEMES"
+        else
+            XCODE_SCHEMES="$@"
+        fi
+        for SCHEME in $XCODE_SCHEMES; do
+            echo xcodebuild -workspace $RIVE_OUT/rive.xcworkspace -scheme $SCHEME
+            xcodebuild -workspace $RIVE_OUT/rive.xcworkspace -scheme $SCHEME
+        done
+        ;;
     vs2022)
         for TARGET in $@; do
-            RIVE_MSVC_TARGETS="$RIVE_MSVC_TARGETS -t:$TARGET"
+            MSVC_TARGETS="$MSVC_TARGETS -t:$TARGET"
         done
-        echo msbuild.exe "./$RIVE_OUT/rive.sln" -p:UseMultiToolTask=true -m:$NUM_CORES $RIVE_MSVC_TARGETS
-        msbuild.exe "./$RIVE_OUT/rive.sln" -p:UseMultiToolTask=true -m:$NUM_CORES $RIVE_MSVC_TARGETS
+        echo msbuild.exe "./$RIVE_OUT/rive.sln" -p:UseMultiToolTask=true -m:$NUM_CORES $MSVC_TARGETS
+        msbuild.exe "./$RIVE_OUT/rive.sln" -p:UseMultiToolTask=true -m:$NUM_CORES $MSVC_TARGETS
         ;;
     *)
-        print "Unsupported buildsystem $RIVE_BUILD_SYSTEM"
+        echo "Unsupported buildsystem $RIVE_BUILD_SYSTEM"
         exit -1
         ;;
 esac
diff --git a/include/rive/math/math_types.hpp b/include/rive/math/math_types.hpp
index b706afd..b34adc3 100644
--- a/include/rive/math/math_types.hpp
+++ b/include/rive/math/math_types.hpp
@@ -114,11 +114,11 @@
 
 // Returns x rounded up to the next multiple of N.
 // If x is already a multiple of N, returns x.
-template <size_t N> RIVE_ALWAYS_INLINE constexpr size_t round_up_to_multiple_of(size_t x)
+template <size_t N, typename T> RIVE_ALWAYS_INLINE constexpr T round_up_to_multiple_of(T x)
 {
     static_assert(N != 0 && (N & (N - 1)) == 0,
                   "math::round_up_to_multiple_of<> only supports powers of 2.");
-    return (x + (N - 1)) & ~(N - 1);
+    return (x + (N - 1)) & ~static_cast<T>(N - 1);
 }
 
 // Behaves better with NaN than std::clamp(). (Matching simd::clamp().)
diff --git a/skia/renderer/include/to_skia.hpp b/skia/renderer/include/to_skia.hpp
index cc49d24..0cf8920 100644
--- a/skia/renderer/include/to_skia.hpp
+++ b/skia/renderer/include/to_skia.hpp
@@ -12,6 +12,7 @@
 #include "include/core/SkPathTypes.h"
 #include "include/core/SkTileMode.h"
 
+#include "rive/math/math_types.hpp"
 #include "rive/math/mat2d.hpp"
 #include "rive/math/raw_path.hpp"
 #include "rive/math/vec2d.hpp"
@@ -89,7 +90,7 @@
             const auto pts = rp.points();
             const auto vbs = rp.verbsU8();
             return SkPath::Make((const SkPoint*)pts.data(), pts.size(),
-                                vbs.data(), vbs.size(),
+                                vbs.data(), math::lossless_numeric_cast<int>(vbs.size()),
                                 nullptr, 0, SkPathFillType::kWinding);
         }
         // clang-format off