From a0283f94891a638d9a979f1ecc7431bdf625f4d9 Mon Sep 17 00:00:00 2001 From: rivessamr Date: Thu, 8 Aug 2024 00:39:26 +0000 Subject: [PATCH] Added support for xcode builds Diffs= c12b0bb24 Added support for xcode builds (#7774) Co-authored-by: rivessamr --- .rive_head | 2 +- dependencies/premake5_libpng_v2.lua | 5 +++-- dependencies/premake5_sheenbidi_v2.lua | 11 ++++++++++- dependencies/premake5_yoga_v2.lua | 8 ++++++++ include/rive/animation/animation_reset.hpp | 4 ++-- include/rive/math/math_types.hpp | 8 ++++++++ premake5_v2.lua | 8 ++++++++ 7 files changed, 40 insertions(+), 6 deletions(-) diff --git a/.rive_head b/.rive_head index eb57b2c0..b7f15159 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -0dc0b435ffb0df61de0afcdc2cea0c69bb8fedd4 +c12b0bb24d1abff5b8df6f9b3a4053fbc5096668 diff --git a/dependencies/premake5_libpng_v2.lua b/dependencies/premake5_libpng_v2.lua index ea26a9e9..75e0c8c7 100644 --- a/dependencies/premake5_libpng_v2.lua +++ b/dependencies/premake5_libpng_v2.lua @@ -12,7 +12,7 @@ do kind('StaticLib') os.copyfile(libpng .. '/scripts/pnglibconf.h.prebuilt', libpng .. '/pnglibconf.h') includedirs({ libpng, zlib }) - optimize("Speed") -- Always optimize image encoding/decoding, even in debug builds. + optimize('Speed') -- Always optimize image encoding/decoding, even in debug builds. files({ libpng .. '/png.c', libpng .. '/pngerror.c', @@ -45,7 +45,7 @@ do kind('StaticLib') defines({ 'ZLIB_IMPLEMENTATION' }) includedirs({ zlib }) - optimize("Speed") -- Always optimize image encoding/decoding, even in debug builds. + optimize('Speed') -- Always optimize image encoding/decoding, even in debug builds. files({ zlib .. '/adler32.c', zlib .. '/compress.c', @@ -70,6 +70,7 @@ do buildoptions({ '-Wno-unknown-warning-option', '-Wno-deprecated-non-prototype', + '-Wno-shorten-64-to-32', }) end diff --git a/dependencies/premake5_sheenbidi_v2.lua b/dependencies/premake5_sheenbidi_v2.lua index 891c963e..147f983d 100644 --- a/dependencies/premake5_sheenbidi_v2.lua +++ b/dependencies/premake5_sheenbidi_v2.lua @@ -2,6 +2,7 @@ dofile('rive_build_config.lua') local dependency = require('dependency') sheenbidi = dependency.github('Tehreer/SheenBidi', 'v2.6') +Headers = sheenbidi .. '/Headers' project('rive_sheenbidi') do @@ -9,7 +10,15 @@ do language('C') warnings('Off') - includedirs({ sheenbidi .. '/Headers' }) + includedirs({ Headers }) + + filter('action:xcode4') + do + -- xcode doesnt like angle brackets except for -isystem + -- should use externalincludedirs but GitHub runners dont have latest premake5 binaries + buildoptions({ '-isystem' .. Headers }) + end + filter({}) buildoptions({ '-Wall', '-ansi', '-pedantic' }) diff --git a/dependencies/premake5_yoga_v2.lua b/dependencies/premake5_yoga_v2.lua index 30d8284f..68de64ae 100644 --- a/dependencies/premake5_yoga_v2.lua +++ b/dependencies/premake5_yoga_v2.lua @@ -17,6 +17,14 @@ do includedirs({ yoga }) + filter('action:xcode4') + do + -- xcode doesnt like angle brackets except for -isystem + -- should use externalincludedirs but GitHub runners dont have latest premake5 binaries + buildoptions({ '-isystem' .. yoga }) + end + filter({}) + files({ yoga .. '/yoga/Utils.cpp', yoga .. '/yoga/YGConfig.cpp', diff --git a/include/rive/animation/animation_reset.hpp b/include/rive/animation/animation_reset.hpp index b501a834..2828da32 100644 --- a/include/rive/animation/animation_reset.hpp +++ b/include/rive/animation/animation_reset.hpp @@ -3,7 +3,7 @@ #include #include "rive/artboard.hpp" -#include +#include "rive/animation/animation_reset.hpp" #include "rive/core/binary_writer.hpp" #include "rive/core/vector_binary_writer.hpp" #include "rive/core/binary_data_reader.hpp" @@ -29,4 +29,4 @@ class AnimationReset void clear(); }; } // namespace rive -#endif \ No newline at end of file +#endif diff --git a/include/rive/math/math_types.hpp b/include/rive/math/math_types.hpp index 17dfaeab..b706afd1 100644 --- a/include/rive/math/math_types.hpp +++ b/include/rive/math/math_types.hpp @@ -61,6 +61,14 @@ template Dst bit_cast(const Src& src) return dst; } +// Lossless cast function that asserts on overflow +template T lossless_numeric_cast(U u) +{ + T t = static_cast(u); + assert(static_cast(t) == u); + return t; +} + // Attempt to generate a "clz" assembly instruction. RIVE_ALWAYS_INLINE static int clz32(uint32_t x) { diff --git a/premake5_v2.lua b/premake5_v2.lua index 5abc30ed..35acb878 100644 --- a/premake5_v2.lua +++ b/premake5_v2.lua @@ -46,6 +46,14 @@ do yoga, }) + filter('action:xcode4') + do + -- xcode doesnt like angle brackets except for -isystem + -- should use externalincludedirs but GitHub runners dont have latest premake5 binaries + buildoptions({ '-isystem' .. yoga }) + end + filter({}) + defines({ 'YOGA_EXPORT=' }) files({ 'src/**.cpp' })