Skip to content

Commit

Permalink
Add Xcode support to build_rive.sh
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
csmartdalton and csmartdalton committed Aug 8, 2024
1 parent a0283f9 commit 725788d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c12b0bb24d1abff5b8df6f9b3a4053fbc5096668
f0da6a7a097a782df5839390097254bbfb8d9a00
23 changes: 19 additions & 4 deletions build/build_rive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -140,6 +141,7 @@ else
"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}"
Expand Down Expand Up @@ -267,15 +269,28 @@ case "$RIVE_BUILD_SYSTEM" in
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
4 changes: 2 additions & 2 deletions include/rive/math/math_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ RIVE_ALWAYS_INLINE static uint32_t rotateleft32(uint32_t x, int y)

// 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().)
Expand Down
3 changes: 2 additions & 1 deletion skia/renderer/include/to_skia.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -89,7 +90,7 @@ class ToSkia
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
Expand Down

0 comments on commit 725788d

Please sign in to comment.