mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 13:11:19 +01:00
chore: fix clang-17 compiler (#9666) 8a1f3286b9
* chore: fix clang-17 compiler * chore: adding missing file * fix: rive_native builds * chore: remove no runtime linking on linux * chore: more fixes * chore: removing rive_common * chore: use build_rive.sh for ios * chore: use rive_build.sh for recorder * chore: fix fill missing version * chore: add rive_build.sh to path * chore: add rive_build.sh to pr_ios_tests.yaml * chore: add rive_build to the recorder tests * chore: drop rive_flutter tests * chore: fixing ios tests * fix misspelled * chore: cleanup * chore: use latest zlib * chore: premake5.lua redirects to premake5_v2 * fix: tvos and ios builds * fix: unreal build path for miniaudio Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This commit is contained in:
@@ -1 +1 @@
|
||||
c0844f01b5cfea4b9d9e97ba9a8082c1081ac64f
|
||||
8a1f3286b9fb09b1921d290bf29907c841516c38
|
||||
|
||||
4
build.sh
4
build.sh
@@ -32,8 +32,8 @@ if [ "$OPTION" = 'help' ]; then
|
||||
else
|
||||
build() {
|
||||
echo "Building Rive for platform=$platform option=$OPTION"
|
||||
echo premake5 gmake2 --with_rive_text --with_rive_audio=system --with_rive_layout "$1"
|
||||
PREMAKE="premake5 gmake2 --with_rive_text --with_rive_audio=system --with_rive_layout $1"
|
||||
echo premake5 --file=premake5_v2.lua gmake2 --with_rive_text --with_rive_audio=system --with_rive_layout "$1"
|
||||
PREMAKE="premake5 --file=premake5_v2.lua gmake2 --with_rive_text --with_rive_audio=system --with_rive_layout $1"
|
||||
eval "$PREMAKE"
|
||||
if [ "$OPTION" = "clean" ]; then
|
||||
make clean
|
||||
|
||||
@@ -126,6 +126,24 @@ else
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
"release") RIVE_CONFIG="${RIVE_CONFIG:-release}" ;;
|
||||
"xros")
|
||||
RIVE_OS="${RIVE_OS:-ios}"
|
||||
RIVE_VARIANT="${RIVE_VARIANT:-xros}"
|
||||
;;
|
||||
"xrsimulator")
|
||||
RIVE_OS=${RIVE_OS:-ios}
|
||||
RIVE_VARIANT="${RIVE_VARIANT:-xrsimulator}"
|
||||
RIVE_ARCH="${RIVE_ARCH:-universal}" # The simulator requires universal builds.
|
||||
;;
|
||||
"appletvos")
|
||||
RIVE_OS="${RIVE_OS:-ios}"
|
||||
RIVE_VARIANT="${RIVE_VARIANT:-appletvos}"
|
||||
;;
|
||||
"appletvsimulator")
|
||||
RIVE_OS=${RIVE_OS:-ios}
|
||||
RIVE_VARIANT="${RIVE_VARIANT:-appletvsimulator}"
|
||||
RIVE_ARCH="${RIVE_ARCH:-universal}" # The simulator requires universal builds.
|
||||
;;
|
||||
"ios") RIVE_OS="${RIVE_OS:-ios}" ;;
|
||||
"iossim")
|
||||
RIVE_OS=${RIVE_OS:-ios}
|
||||
|
||||
@@ -1,285 +1 @@
|
||||
workspace('rive')
|
||||
configurations({ 'debug', 'release' })
|
||||
|
||||
require('setup_compiler')
|
||||
|
||||
filter({ 'options:with_rive_tools' })
|
||||
do
|
||||
defines({ 'WITH_RIVE_TOOLS' })
|
||||
end
|
||||
filter({ 'options:with_rive_text' })
|
||||
do
|
||||
defines({ 'WITH_RIVE_TEXT' })
|
||||
end
|
||||
filter({ 'options:with_rive_audio=system' })
|
||||
do
|
||||
defines({ 'WITH_RIVE_AUDIO', 'MA_NO_RESOURCE_MANAGER' })
|
||||
end
|
||||
|
||||
filter({ 'options:with_rive_audio=external' })
|
||||
do
|
||||
defines({
|
||||
'WITH_RIVE_AUDIO',
|
||||
'EXTERNAL_RIVE_AUDIO_ENGINE',
|
||||
'MA_NO_DEVICE_IO',
|
||||
'MA_NO_RESOURCE_MANAGER',
|
||||
})
|
||||
end
|
||||
filter({ 'options:with_rive_layout' })
|
||||
do
|
||||
defines({ 'WITH_RIVE_LAYOUT' })
|
||||
end
|
||||
filter({})
|
||||
|
||||
dofile(path.join(path.getabsolute('../dependencies/'), 'premake5_harfbuzz.lua'))
|
||||
dofile(path.join(path.getabsolute('../dependencies/'), 'premake5_sheenbidi.lua'))
|
||||
dofile(path.join(path.getabsolute('../dependencies/'), 'premake5_miniaudio.lua'))
|
||||
dofile(path.join(path.getabsolute('../dependencies/'), 'premake5_yoga.lua'))
|
||||
|
||||
project('rive')
|
||||
do
|
||||
kind('StaticLib')
|
||||
language('C++')
|
||||
targetdir('%{cfg.system}/bin/%{cfg.buildcfg}')
|
||||
objdir('%{cfg.system}/obj/%{cfg.buildcfg}')
|
||||
includedirs({
|
||||
'../include',
|
||||
harfbuzz .. '/src',
|
||||
sheenbidi .. '/Headers',
|
||||
miniaudio,
|
||||
yoga,
|
||||
})
|
||||
|
||||
defines({ 'YOGA_EXPORT=', '_RIVE_INTERNAL_' })
|
||||
|
||||
includedirs({
|
||||
'../dependencies/',
|
||||
})
|
||||
forceincludes({ 'rive_yoga_renames.h' })
|
||||
|
||||
files({ '../src/**.cpp' })
|
||||
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
|
||||
filter({ 'options:for_unreal' })
|
||||
do
|
||||
cppdialect('C++17')
|
||||
defines({ '_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR' })
|
||||
end
|
||||
|
||||
filter({ 'options:not for_unreal' })
|
||||
do
|
||||
cppdialect('C++11')
|
||||
end
|
||||
|
||||
filter({ 'system:macosx' })
|
||||
do
|
||||
buildoptions({
|
||||
-- this triggers too much on linux, so just enable here for now
|
||||
'-Wimplicit-float-conversion',
|
||||
})
|
||||
end
|
||||
|
||||
-- filter {'toolset:not msc', 'files:../src/audio/audio_engine.cpp'}
|
||||
filter({ 'system:not windows', 'files:../src/audio/audio_engine.cpp' })
|
||||
do
|
||||
buildoptions({ '-Wno-implicit-int-conversion' })
|
||||
end
|
||||
|
||||
filter({ 'system:windows', 'files:../src/audio/audio_engine.cpp' })
|
||||
do
|
||||
-- Too many warnings from miniaudio.h
|
||||
removeflags({ 'FatalCompileWarnings' })
|
||||
end
|
||||
|
||||
-- filter 'files:../src/audio/audio_engine.cpp'
|
||||
-- do
|
||||
-- buildoptions {
|
||||
-- '-Wno-implicit-int-conversion'
|
||||
-- }
|
||||
-- end
|
||||
|
||||
filter({ 'system:macosx', 'options:variant=runtime' })
|
||||
do
|
||||
buildoptions({
|
||||
'-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot '
|
||||
.. (os.getenv('MACOS_SYSROOT') or ''),
|
||||
})
|
||||
end
|
||||
|
||||
filter({ 'system:macosx', 'configurations:release' })
|
||||
do
|
||||
buildoptions({ '-flto=full' })
|
||||
end
|
||||
|
||||
filter({ 'system:ios' })
|
||||
do
|
||||
buildoptions({ '-flto=full', '-Wno-implicit-int-conversion' })
|
||||
files({ '../src/audio/audio_engine.m' })
|
||||
end
|
||||
|
||||
filter('system:windows')
|
||||
do
|
||||
architecture('x64')
|
||||
defines({ '_USE_MATH_DEFINES' })
|
||||
end
|
||||
|
||||
filter({ 'system:ios', 'options:variant=system' })
|
||||
do
|
||||
buildoptions({
|
||||
'-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot '
|
||||
.. (os.getenv('IOS_SYSROOT') or ''),
|
||||
})
|
||||
end
|
||||
|
||||
filter({ 'system:ios', 'options:variant=emulator' })
|
||||
do
|
||||
buildoptions({
|
||||
'--target=arm64-apple-ios13.0.0-simulator',
|
||||
'-mios-version-min=13.0 -arch arm64 -arch x86_64 -isysroot '
|
||||
.. (os.getenv('IOS_SYSROOT') or ''),
|
||||
})
|
||||
targetdir('%{cfg.system}_sim/bin/%{cfg.buildcfg}')
|
||||
objdir('%{cfg.system}_sim/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter({ 'system:ios', 'options:variant=xros' })
|
||||
do
|
||||
buildoptions({
|
||||
'--target=arm64-apple-xros1.0',
|
||||
'-fembed-bitcode -arch arm64 -isysroot '
|
||||
.. (os.getenv('XROS_SYSROOT') or ''),
|
||||
})
|
||||
targetdir('xros/bin/%{cfg.buildcfg}')
|
||||
objdir('xros/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter({ 'system:ios', 'options:variant=xrsimulator' })
|
||||
do
|
||||
buildoptions({
|
||||
'--target=arm64-apple-xros1.0-simulator',
|
||||
'-arch arm64 -arch x86_64 -isysroot '
|
||||
.. (os.getenv('XROS_SYSROOT') or ''),
|
||||
})
|
||||
targetdir('xrsimulator/bin/%{cfg.buildcfg}')
|
||||
objdir('xrsimulator/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter({ 'system:ios', 'options:variant=appletvos' })
|
||||
do
|
||||
buildoptions({
|
||||
'--target=arm64-apple-tvos',
|
||||
'-mappletvos-version-min=16.0',
|
||||
'-fembed-bitcode -arch arm64 -isysroot '
|
||||
.. (os.getenv('APPLETVOS_SYSROOT') or ''),
|
||||
})
|
||||
targetdir('appletvos/bin/%{cfg.buildcfg}')
|
||||
objdir('appletvos/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter({ 'system:ios', 'options:variant=appletvsimulator' })
|
||||
do
|
||||
buildoptions({
|
||||
'--target=arm64-apple-tvos-simulator',
|
||||
'-mappletvsimulator-version-min=16.0',
|
||||
'-arch arm64 -arch x86_64 -isysroot '
|
||||
.. (os.getenv('APPLETVOS_SYSROOT') or ''),
|
||||
})
|
||||
targetdir('appletvsimulator/bin/%{cfg.buildcfg}')
|
||||
objdir('appletvsimulator/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter('system:macosx or system:ios')
|
||||
do
|
||||
files({ '../src/text/font_hb_apple.mm' })
|
||||
end
|
||||
|
||||
filter({ 'system:android', 'configurations:release' })
|
||||
do
|
||||
buildoptions({ '-flto=full' })
|
||||
end
|
||||
|
||||
-- Is there a way to pass 'arch' as a variable here?
|
||||
filter({ 'system:android', 'options:arch=x86' })
|
||||
do
|
||||
targetdir('%{cfg.system}/x86/bin/%{cfg.buildcfg}')
|
||||
objdir('%{cfg.system}/x86/obj/%{cfg.buildcfg}')
|
||||
-- Ignore fatal warning for miniaudio on x86 devices.
|
||||
filter({ 'files:../src/audio/audio_engine.cpp' })
|
||||
do
|
||||
buildoptions({ '-Wno-atomic-alignment' })
|
||||
end
|
||||
end
|
||||
|
||||
filter({ 'system:android', 'options:arch=x64' })
|
||||
do
|
||||
targetdir('%{cfg.system}/x64/bin/%{cfg.buildcfg}')
|
||||
objdir('%{cfg.system}/x64/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter({ 'system:android', 'options:arch=arm' })
|
||||
do
|
||||
targetdir('%{cfg.system}/arm/bin/%{cfg.buildcfg}')
|
||||
objdir('%{cfg.system}/arm/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter({ 'system:android', 'options:arch=arm64' })
|
||||
do
|
||||
targetdir('%{cfg.system}/arm64/bin/%{cfg.buildcfg}')
|
||||
objdir('%{cfg.system}/arm64/obj/%{cfg.buildcfg}')
|
||||
end
|
||||
|
||||
filter('configurations:debug')
|
||||
do
|
||||
defines({ 'DEBUG' })
|
||||
symbols('On')
|
||||
end
|
||||
|
||||
filter('configurations:release')
|
||||
do
|
||||
defines({ 'RELEASE' })
|
||||
defines({ 'NDEBUG' })
|
||||
optimize('On')
|
||||
end
|
||||
end
|
||||
|
||||
newoption({
|
||||
trigger = 'variant',
|
||||
value = 'type',
|
||||
description = 'Choose a particular variant to build',
|
||||
allowed = {
|
||||
{ 'system', 'Builds the static library for the provided system' },
|
||||
{ 'emulator', 'Builds for an emulator/simulator for the provided system' },
|
||||
{
|
||||
'runtime',
|
||||
'Build the static library specifically targeting our runtimes',
|
||||
},
|
||||
{ 'xros', 'Builds for Apple Vision Pro' },
|
||||
{ 'xrsimulator', 'Builds for Apple Vision Pro simulator' },
|
||||
{ 'appletvos', 'Builds for Apple TV' },
|
||||
{ 'appletvsimulator', 'Builds for Apple TV simulator' },
|
||||
},
|
||||
default = 'system',
|
||||
})
|
||||
|
||||
newoption({
|
||||
trigger = 'with_rive_tools',
|
||||
description = 'Enables tools usually not necessary for runtime.',
|
||||
})
|
||||
|
||||
newoption({
|
||||
trigger = 'with_rive_text',
|
||||
description = 'Compiles in text features.',
|
||||
})
|
||||
|
||||
newoption({
|
||||
trigger = 'with_rive_audio',
|
||||
value = 'disabled',
|
||||
description = 'The audio mode to use.',
|
||||
allowed = { { 'disabled' }, { 'system' }, { 'external' } },
|
||||
})
|
||||
|
||||
newoption({
|
||||
trigger = 'with_rive_layout',
|
||||
description = 'Compiles in layout features.',
|
||||
})
|
||||
require('premake5_v2.lua')
|
||||
|
||||
@@ -421,16 +421,16 @@ if _OPTIONS['os'] == 'android' then
|
||||
end
|
||||
|
||||
-- Windows requires extentions for .cmd files.
|
||||
local ndk_ext = '';
|
||||
local ndk_ext = ''
|
||||
if os.host() == 'windows' then
|
||||
ndk_ext = '.cmd';
|
||||
ndk_ext = '.cmd'
|
||||
end
|
||||
|
||||
-- update the android_ndk toolset to use the appropriate binaries.
|
||||
local android_ndk_tools = {
|
||||
cc = ndk_toolchain .. '/bin/' .. android_target .. '-clang' .. ndk_ext,
|
||||
cxx = ndk_toolchain .. '/bin/' .. android_target .. '-clang++' .. ndk_ext,
|
||||
ar = ndk_toolchain .. '/bin/llvm-ar'
|
||||
ar = ndk_toolchain .. '/bin/llvm-ar',
|
||||
}
|
||||
function premake.tools.android_ndk.gettoolname(cfg, tool)
|
||||
return android_ndk_tools[tool]
|
||||
|
||||
1
dependencies/miniaudio.m
vendored
Normal file
1
dependencies/miniaudio.m
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "miniaudio.c"
|
||||
6
dependencies/premake5_libpng_v2.lua
vendored
6
dependencies/premake5_libpng_v2.lua
vendored
@@ -2,7 +2,7 @@ dofile('rive_build_config.lua')
|
||||
|
||||
local dependency = require('dependency')
|
||||
libpng = dependency.github('glennrp/libpng', 'libpng16')
|
||||
zlib = dependency.github('madler/zlib', '04f42ceca40f73e2978b50e93806c2a18c1281fc')
|
||||
zlib = dependency.github('madler/zlib', 'v1.3.1')
|
||||
|
||||
includedirs({ './' })
|
||||
forceincludes({ 'rive_png_renames.h' })
|
||||
@@ -50,7 +50,7 @@ end
|
||||
|
||||
newoption({
|
||||
trigger = 'force_no_unistd_h',
|
||||
description = "prevent HAVE_UNISTD_H from being defined for zlib"
|
||||
description = 'prevent HAVE_UNISTD_H from being defined for zlib',
|
||||
})
|
||||
|
||||
project('zlib')
|
||||
@@ -88,7 +88,7 @@ do
|
||||
})
|
||||
end
|
||||
|
||||
filter({'system:not windows', 'options:not force_no_unistd_h'})
|
||||
filter({ 'system:not windows', 'options:not force_no_unistd_h' })
|
||||
do
|
||||
defines({ 'HAVE_UNISTD_H' })
|
||||
end
|
||||
|
||||
17
dependencies/premake5_miniaudio_v2.lua
vendored
17
dependencies/premake5_miniaudio_v2.lua
vendored
@@ -1,3 +1,18 @@
|
||||
dofile('rive_build_config.lua')
|
||||
local dependency = require('dependency')
|
||||
miniaudio = dependency.github('rive-app/miniaudio', 'rive_changes_4')
|
||||
miniaudio = dependency.github('rive-app/miniaudio', 'rive_changes_5')
|
||||
|
||||
project('miniaudio')
|
||||
do
|
||||
kind('StaticLib')
|
||||
includedirs({ miniaudio })
|
||||
|
||||
filter('system:ios')
|
||||
do
|
||||
files({ 'miniaudio.m' })
|
||||
end
|
||||
filter('system:not ios')
|
||||
do
|
||||
files({ miniaudio .. '/miniaudio.c' })
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
unsigned m_tValue : 30; // Dot30 t value for the end of this segment
|
||||
unsigned m_type : 2; // [private enum]
|
||||
|
||||
float getT() const { return m_tValue * kInvScaleD30; }
|
||||
float getT() const { return (float)m_tValue * kInvScaleD30; }
|
||||
|
||||
bool operator<(const Segment& other) const
|
||||
{
|
||||
|
||||
@@ -85,65 +85,6 @@ do
|
||||
forceincludes({ 'rive_yoga_renames.h' })
|
||||
end
|
||||
|
||||
filter({ 'system:linux' })
|
||||
do
|
||||
defines({ 'MA_NO_RUNTIME_LINKING' })
|
||||
end
|
||||
|
||||
filter({ 'system:macosx' })
|
||||
do
|
||||
buildoptions({
|
||||
-- this triggers too much on linux, so just enable here for now
|
||||
'-Wimplicit-float-conversion',
|
||||
})
|
||||
end
|
||||
|
||||
-- filter {'toolset:not msc', 'files:src/audio/audio_engine.cpp'}
|
||||
filter({ 'system:not windows', 'files:src/audio/audio_engine.cpp' })
|
||||
do
|
||||
buildoptions({ '-Wno-implicit-int-conversion' })
|
||||
end
|
||||
|
||||
filter({ 'system:windows', 'files:src/audio/audio_engine.cpp' })
|
||||
do
|
||||
-- Too many warnings from miniaudio.h
|
||||
removeflags({ 'FatalCompileWarnings' })
|
||||
end
|
||||
|
||||
filter({ 'system:windows', 'toolset:clang', 'files:src/audio/audio_engine.cpp' })
|
||||
do
|
||||
buildoptions({
|
||||
'-Wno-nonportable-system-include-path',
|
||||
'-Wno-zero-as-null-pointer-constant',
|
||||
'-Wno-missing-prototypes',
|
||||
'-Wno-cast-qual',
|
||||
'-Wno-format-nonliteral',
|
||||
'-Wno-cast-align',
|
||||
'-Wno-covered-switch-default',
|
||||
'-Wno-comma',
|
||||
'-Wno-tautological-type-limit-compare',
|
||||
'-Wno-extra-semi-stmt',
|
||||
'-Wno-tautological-constant-out-of-range-compare',
|
||||
'-Wno-implicit-fallthrough',
|
||||
'-Wno-implicit-int-conversion',
|
||||
'-Wno-undef',
|
||||
'-Wno-unused-function',
|
||||
})
|
||||
end
|
||||
|
||||
-- filter 'files:src/audio/audio_engine.cpp'
|
||||
-- do
|
||||
-- buildoptions {
|
||||
-- '-Wno-implicit-int-conversion'
|
||||
-- }
|
||||
-- end
|
||||
|
||||
-- Ignore fatal warning for miniaudio on x86 android build.
|
||||
filter({ 'system:android', 'options:arch=x86', 'files:src/audio/audio_engine.cpp' })
|
||||
do
|
||||
buildoptions({ '-Wno-atomic-alignment' })
|
||||
end
|
||||
|
||||
filter({ 'system:macosx', 'options:variant=runtime' })
|
||||
do
|
||||
buildoptions({
|
||||
@@ -152,12 +93,6 @@ do
|
||||
})
|
||||
end
|
||||
|
||||
filter('system:ios')
|
||||
do
|
||||
buildoptions({ '-flto=full', '-Wno-implicit-int-conversion' })
|
||||
files({ 'src/audio/audio_engine.m' })
|
||||
end
|
||||
|
||||
filter('system:windows')
|
||||
do
|
||||
architecture('x64')
|
||||
|
||||
@@ -153,14 +153,15 @@ public:
|
||||
auto value = keyedProperty->first()
|
||||
->as<KeyFrameColor>()
|
||||
->value();
|
||||
animationReset->writePropertyValue(value);
|
||||
animationReset->writePropertyValue(
|
||||
(float)value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
animationReset->writePropertyValue(
|
||||
CoreRegistry::getColor(component,
|
||||
propertyKey));
|
||||
(float)CoreRegistry::getColor(component,
|
||||
propertyKey));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -79,11 +79,11 @@ StatusCode LinearAnimation::import(ImportStack& importStack)
|
||||
|
||||
float LinearAnimation::startSeconds() const
|
||||
{
|
||||
return (enableWorkArea() ? workStart() : 0) / (float)fps();
|
||||
return (enableWorkArea() ? (float)workStart() : 0.0f) / (float)fps();
|
||||
}
|
||||
float LinearAnimation::endSeconds() const
|
||||
{
|
||||
return (enableWorkArea() ? workEnd() : duration()) / (float)fps();
|
||||
return (float)(enableWorkArea() ? workEnd() : duration()) / (float)fps();
|
||||
}
|
||||
|
||||
float LinearAnimation::startTime() const
|
||||
|
||||
@@ -81,12 +81,13 @@ bool LinearAnimationInstance::advance(float elapsedSeconds,
|
||||
false);
|
||||
}
|
||||
|
||||
int fps = animation.fps();
|
||||
float fps = (float)animation.fps();
|
||||
float frames = m_time * fps;
|
||||
int start = animation.enableWorkArea() ? animation.workStart() : 0;
|
||||
int end =
|
||||
animation.enableWorkArea() ? animation.workEnd() : animation.duration();
|
||||
int range = end - start;
|
||||
float start =
|
||||
animation.enableWorkArea() ? (float)animation.workStart() : 0.0f;
|
||||
float end = animation.enableWorkArea() ? (float)animation.workEnd()
|
||||
: (float)animation.duration();
|
||||
float range = end - start;
|
||||
|
||||
bool didLoop = false;
|
||||
|
||||
@@ -232,8 +233,10 @@ void LinearAnimationInstance::time(float value)
|
||||
// can track change even when setting time.
|
||||
auto diff = m_totalTime - m_lastTotalTime;
|
||||
|
||||
int start = (m_animation->enableWorkArea() ? m_animation->workStart() : 0) *
|
||||
m_animation->fps();
|
||||
float start =
|
||||
(m_animation->enableWorkArea() ? (float)m_animation->workStart()
|
||||
: 0.0f) *
|
||||
(float)m_animation->fps();
|
||||
m_totalTime = value - start;
|
||||
m_lastTotalTime = m_totalTime - diff;
|
||||
|
||||
|
||||
@@ -247,13 +247,14 @@ public:
|
||||
if (totalWeight > 0)
|
||||
{
|
||||
double randomWeight = randomValue() * totalWeight * 1.0;
|
||||
float currentWeight = 0;
|
||||
double currentWeight = 0;
|
||||
size_t index = 0;
|
||||
StateTransition* transition;
|
||||
while (index < stateFrom->transitionCount())
|
||||
{
|
||||
transition = stateFrom->transition(index);
|
||||
auto transitionWeight = transition->evaluatedRandomWeight();
|
||||
double transitionWeight =
|
||||
(double)transition->evaluatedRandomWeight();
|
||||
if (currentWeight + transitionWeight > randomWeight)
|
||||
{
|
||||
transition->useLayerInConditions(m_stateMachineInstance,
|
||||
|
||||
@@ -97,11 +97,11 @@ float StateTransition::mixTime(const LayerState* stateFrom) const
|
||||
animationDuration = animation->durationSeconds();
|
||||
}
|
||||
}
|
||||
return duration() / 100.0f * animationDuration;
|
||||
return (float)duration() / 100.0f * animationDuration;
|
||||
}
|
||||
else
|
||||
{
|
||||
return duration() / 1000.0f;
|
||||
return (float)duration() / 1000.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,9 +122,9 @@ float StateTransition::exitTimeSeconds(const LayerState* stateFrom,
|
||||
animationDuration = exitAnimation->durationSeconds();
|
||||
}
|
||||
|
||||
return start + exitTime() / 100.0f * animationDuration;
|
||||
return start + (float)exitTime() / 100.0f * animationDuration;
|
||||
}
|
||||
return exitTime() / 1000.0f;
|
||||
return (float)exitTime() / 1000.0f;
|
||||
}
|
||||
|
||||
const LinearAnimationInstance* StateTransition::exitTimeAnimationInstance(
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
#ifdef WITH_RIVE_AUDIO
|
||||
#include "rive/math/simd.hpp"
|
||||
#ifdef __APPLE__
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_MACCATALYST || TARGET_OS_IPHONE
|
||||
// Don't define MINIAUDIO_IMPLEMENTATION ON iOS
|
||||
#elif TARGET_OS_MAC
|
||||
#define MINIAUDIO_IMPLEMENTATION
|
||||
#else
|
||||
#error "Unknown Apple platform"
|
||||
#endif
|
||||
#else
|
||||
#define MINIAUDIO_IMPLEMENTATION
|
||||
#endif
|
||||
#include "miniaudio.h"
|
||||
|
||||
#include "rive/audio/audio_engine.hpp"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#ifdef WITH_RIVE_AUDIO
|
||||
#define MINIAUDIO_IMPLEMENTATION
|
||||
#include "miniaudio.h"
|
||||
#endif
|
||||
@@ -234,17 +234,17 @@ Vec2D ScrollConstraint::positionAtIndex(float index)
|
||||
{
|
||||
return Vec2D();
|
||||
}
|
||||
auto i = 0;
|
||||
uint32_t i = 0;
|
||||
LayoutNodeProvider* lastChild;
|
||||
for (auto child : content()->children())
|
||||
{
|
||||
auto c = LayoutNodeProvider::from(child);
|
||||
if (c != nullptr)
|
||||
{
|
||||
auto floorIndex = std::floor(index);
|
||||
if (i == floorIndex)
|
||||
float floorIndex = std::floor(index);
|
||||
if (i == (uint32_t)floorIndex)
|
||||
{
|
||||
auto mod = index - floorIndex;
|
||||
float mod = index - floorIndex;
|
||||
auto bounds = c->layoutBounds();
|
||||
return Vec2D(-bounds.left() - bounds.width() * mod,
|
||||
-bounds.top() - bounds.height() * mod);
|
||||
|
||||
@@ -11,7 +11,7 @@ void ScrollPhysics::accumulate(Vec2D delta)
|
||||
auto ms = std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
now.time_since_epoch())
|
||||
.count();
|
||||
float elapsedSeconds = (ms - m_lastTime) / 1000000.0f;
|
||||
float elapsedSeconds = (float)(ms - m_lastTime) / 1000000.0f;
|
||||
if (elapsedSeconds > 0)
|
||||
{
|
||||
auto lastSpeed = m_speed;
|
||||
|
||||
@@ -342,7 +342,7 @@ float ContourMeasureIter::addQuadSegs(ContourMeasure::Segment* segs,
|
||||
uint32_t ptIndex,
|
||||
float distance) const
|
||||
{
|
||||
const float dt = 1.f / segmentCount;
|
||||
const float dt = 1.f / (float)segmentCount;
|
||||
const EvalQuad eval(pts);
|
||||
|
||||
float t = dt;
|
||||
@@ -366,7 +366,7 @@ float ContourMeasureIter::addCubicSegs(ContourMeasure::Segment* segs,
|
||||
uint32_t ptIndex,
|
||||
float distance) const
|
||||
{
|
||||
const float dt = 1.f / segmentCount;
|
||||
const float dt = 1.f / (float)segmentCount;
|
||||
const EvalCubic eval(pts);
|
||||
|
||||
float t = dt;
|
||||
|
||||
@@ -92,7 +92,7 @@ ScaleInfo NSlicerHelpers::analyzeUVStops(const std::vector<float>& uvs,
|
||||
float fallbackSize = 0;
|
||||
if (!useScale && numEmptyPatch != 0)
|
||||
{
|
||||
fallbackSize = (size - fixedSize / scale) / numEmptyPatch;
|
||||
fallbackSize = (size - fixedSize / scale) / (float)numEmptyPatch;
|
||||
}
|
||||
|
||||
return {useScale, scaleFactor, fallbackSize};
|
||||
|
||||
@@ -36,8 +36,8 @@ void Image::draw(Renderer* renderer)
|
||||
|
||||
if (clipResult != ClipResult::emptyClip)
|
||||
{
|
||||
auto width = renderImage->width();
|
||||
auto height = renderImage->height();
|
||||
float width = (float)renderImage->width();
|
||||
float height = (float)renderImage->height();
|
||||
|
||||
if (m_Mesh != nullptr)
|
||||
{
|
||||
@@ -59,8 +59,8 @@ Core* Image::hitTest(HitInfo* hinfo, const Mat2D& xform)
|
||||
// TODO: handle clip?
|
||||
|
||||
auto renderImage = imageAsset()->renderImage();
|
||||
int width = renderImage->width();
|
||||
int height = renderImage->height();
|
||||
float width = (float)renderImage->width();
|
||||
float height = (float)renderImage->height();
|
||||
|
||||
if (m_Mesh)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ float Image::width() const
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
return renderImage->width();
|
||||
return (float)renderImage->width();
|
||||
}
|
||||
|
||||
float Image::height() const
|
||||
@@ -159,7 +159,7 @@ float Image::height() const
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
return renderImage->height();
|
||||
return (float)renderImage->height();
|
||||
}
|
||||
|
||||
Vec2D Image::measureLayout(float width,
|
||||
@@ -214,15 +214,17 @@ void Image::controlSize(Vec2D size,
|
||||
void Image::updateImageScale()
|
||||
{
|
||||
// User-created meshes are not affected by scale
|
||||
if (m_Mesh != nullptr && m_Mesh->type() == MeshType::vertex)
|
||||
if ((m_Mesh != nullptr && m_Mesh->type() == MeshType::vertex) ||
|
||||
imageAsset() == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (imageAsset() != nullptr && imageAsset()->renderImage() != nullptr &&
|
||||
!std::isnan(m_layoutWidth) && !std::isnan(m_layoutHeight))
|
||||
auto renderImage = imageAsset()->renderImage();
|
||||
if (renderImage != nullptr && !std::isnan(m_layoutWidth) &&
|
||||
!std::isnan(m_layoutHeight))
|
||||
{
|
||||
auto newScaleX = m_layoutWidth / imageAsset()->renderImage()->width();
|
||||
auto newScaleY = m_layoutHeight / imageAsset()->renderImage()->height();
|
||||
float newScaleX = m_layoutWidth / (float)renderImage->width();
|
||||
float newScaleY = m_layoutHeight / (float)renderImage->height();
|
||||
if (newScaleX != scaleX() || newScaleY != scaleY())
|
||||
{
|
||||
scaleX(newScaleX);
|
||||
|
||||
@@ -134,7 +134,7 @@ CursorPosition CursorPosition::fromOrderedLine(const OrderedLine& orderedLine,
|
||||
nextTextIndex++;
|
||||
}
|
||||
uint32_t parts = nextTextIndex - textIndex;
|
||||
uint32_t part = (uint32_t)std::round(ratio * parts);
|
||||
uint32_t part = (uint32_t)std::round(ratio * (float)parts);
|
||||
|
||||
return CursorPosition(
|
||||
lineIndex,
|
||||
@@ -285,8 +285,8 @@ void Cursor::selectionRects(std::vector<AABB>& rects,
|
||||
subtractUint32(firstCodePointIndex, codePointIndex);
|
||||
uint32_t before =
|
||||
subtractUint32(endCodePointIndex, lastCodePointIndex);
|
||||
float startFactor = after / (float)count;
|
||||
float endFactor = (count - before) / (float)count;
|
||||
float startFactor = (float)after / (float)count;
|
||||
float endFactor = (float)(count - before) / (float)count;
|
||||
if (run->dir() == TextDirection::rtl)
|
||||
{
|
||||
startFactor = 1.0f - startFactor;
|
||||
|
||||
@@ -13,6 +13,10 @@ bool aboutEqual(const rive::Mat2D& a, const rive::Mat2D& b);
|
||||
CHECK(a.x == b.x); \
|
||||
CHECK(a.y == b.y);
|
||||
|
||||
#define CHECK_AABB(a, b) \
|
||||
CHECK_VEC2D(a.min(), b.min()); \
|
||||
CHECK_VEC2D(a.max(), b.max());
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
template <> struct StringMaker<rive::Mat2D>
|
||||
|
||||
@@ -324,6 +324,7 @@
|
||||
"-ltools_common",
|
||||
"-lgoldens",
|
||||
"-lgms",
|
||||
'-lminiaudio',
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
|
||||
"-lrive",
|
||||
@@ -337,6 +338,7 @@
|
||||
"-ltools_common",
|
||||
"-lgoldens",
|
||||
"-lgms",
|
||||
'-lminiaudio',
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "rive.app.golden-test-app";
|
||||
PRODUCT_NAME = rive_ios_tests;
|
||||
|
||||
@@ -38,6 +38,7 @@ function rive_tools_project(name, project_kind)
|
||||
'rive_yoga',
|
||||
'rive_harfbuzz',
|
||||
'rive_sheenbidi',
|
||||
'miniaudio',
|
||||
})
|
||||
else
|
||||
kind(project_kind)
|
||||
@@ -120,7 +121,7 @@ function rive_tools_project(name, project_kind)
|
||||
end
|
||||
|
||||
-- Match PLS math options for testing simd.
|
||||
filter({'system:not windows', 'options:not no_ffp_contract'})
|
||||
filter({ 'system:not windows', 'options:not no_ffp_contract' })
|
||||
do
|
||||
buildoptions({
|
||||
'-ffp-contract=on',
|
||||
@@ -169,6 +170,7 @@ function rive_tools_project(name, project_kind)
|
||||
'rive_yoga',
|
||||
'rive_harfbuzz',
|
||||
'rive_sheenbidi',
|
||||
'miniaudio',
|
||||
})
|
||||
|
||||
filter({ 'kind:ConsoleApp or SharedLib or WindowedApp', 'options:not no_rive_jpeg' })
|
||||
@@ -197,7 +199,17 @@ function rive_tools_project(name, project_kind)
|
||||
libdirs({
|
||||
RIVE_RUNTIME_DIR .. '/skia/dependencies/glfw_build/src/Release',
|
||||
})
|
||||
links({ 'glfw3', 'opengl32', 'd3d11', 'd3d12', 'dxguid', 'dxgi', 'Dbghelp', 'd3dcompiler', 'ws2_32' })
|
||||
links({
|
||||
'glfw3',
|
||||
'opengl32',
|
||||
'd3d11',
|
||||
'd3d12',
|
||||
'dxguid',
|
||||
'dxgi',
|
||||
'Dbghelp',
|
||||
'd3dcompiler',
|
||||
'ws2_32',
|
||||
})
|
||||
end
|
||||
|
||||
filter({ 'kind:ConsoleApp or SharedLib or WindowedApp', 'system:macosx' })
|
||||
@@ -289,13 +301,13 @@ do
|
||||
RIVE_PLS_DIR .. '/path_fiddle/fiddle_context_dawn.cpp',
|
||||
})
|
||||
|
||||
if _TARGET_OS == 'windows'then
|
||||
if _TARGET_OS == 'windows' then
|
||||
externalincludedirs({
|
||||
dx12_headers .. '/include/directx'
|
||||
dx12_headers .. '/include/directx',
|
||||
})
|
||||
end
|
||||
|
||||
filter({ 'options:for_unreal'})
|
||||
|
||||
filter({ 'options:for_unreal' })
|
||||
do
|
||||
defines({ 'RIVE_UNREAL', 'RIVE_TOOLS_NO_GLFW', 'RIVE_TOOLS_NO_GL' })
|
||||
end
|
||||
|
||||
@@ -58,7 +58,6 @@ do
|
||||
miniaudio,
|
||||
yoga,
|
||||
pls_generated_headers,
|
||||
-- openlibm .. '/include',
|
||||
})
|
||||
|
||||
links({
|
||||
@@ -71,7 +70,7 @@ do
|
||||
'zlib',
|
||||
'libjpeg',
|
||||
'libwebp',
|
||||
-- 'openlibm',
|
||||
'miniaudio',
|
||||
})
|
||||
|
||||
files({
|
||||
|
||||
@@ -102,20 +102,20 @@ TEST_CASE("cursor is placed correctly with ltr paragraphs", "[text_input]")
|
||||
textInput.maxWidth(maxWidth);
|
||||
textInput.fontSize(72.0f);
|
||||
|
||||
CHECK(textInput.bounds() == AABB());
|
||||
CHECK_AABB(textInput.bounds(), AABB());
|
||||
NoOpFactory factory;
|
||||
textInput.update(&factory);
|
||||
|
||||
CHECK(textInput.bounds() == AABB(0, 0, 500, 216));
|
||||
CHECK(textInput.measure(500, 400) == AABB(0, 0, 500, 216));
|
||||
CHECK_AABB(textInput.bounds(), AABB(0, 0, 446.51953f, 216));
|
||||
CHECK_AABB(textInput.measure(500, 400), AABB(0, 0, 446.51953f, 216));
|
||||
CHECK(textInput.measureCount == 1);
|
||||
// measure count should still be one if we re-measured with same sizes.
|
||||
CHECK(textInput.measure(500, 400) == AABB(0, 0, 500, 216));
|
||||
CHECK_AABB(textInput.measure(500, 400), AABB(0, 0, 446.51953f, 216));
|
||||
CHECK(textInput.measureCount == 1);
|
||||
CHECK(textInput.measure(400, 400) == AABB(0, 0, 400, 324));
|
||||
CHECK_AABB(textInput.measure(400, 400), AABB(0, 0, 318.97266f, 324));
|
||||
CHECK(textInput.measureCount == 2);
|
||||
textInput.text("one two three four five six");
|
||||
CHECK(textInput.measure(400, 400) == AABB(0, 0, 400, 324));
|
||||
CHECK_AABB(textInput.measure(400, 400), AABB(0, 0, 318.97266f, 324));
|
||||
CHECK(textInput.measureCount == 3);
|
||||
textInput.text("one two three four five");
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ while [[ $# -gt 0 ]]; do
|
||||
export REBASELINE_SILVERS=true
|
||||
shift # past argument
|
||||
;;
|
||||
clean)
|
||||
rm -fR out
|
||||
shift # past argument
|
||||
;;
|
||||
*)
|
||||
shift # past argument
|
||||
;;
|
||||
@@ -78,13 +82,6 @@ fi
|
||||
|
||||
export PREMAKE=$PWD/dependencies/bin/premake5
|
||||
|
||||
for var in "$@"; do
|
||||
if [[ $var = "clean" ]]; then
|
||||
echo 'Cleaning...'
|
||||
rm -fR out
|
||||
fi
|
||||
done
|
||||
|
||||
mkdir -p out
|
||||
|
||||
if [[ $machine = "macosx" ]]; then
|
||||
@@ -107,7 +104,8 @@ if [[ $machine = "macosx" ]]; then
|
||||
OUT_DIR="$(out_dir)"
|
||||
$PREMAKE $TARGET $PREMAKE_COMMANDS --out=$OUT_DIR
|
||||
pushd $OUT_DIR
|
||||
make -j$(($(sysctl -n hw.physicalcpu) + 1))
|
||||
# make -j$(($(sysctl -n hw.physicalcpu) + 1))
|
||||
make
|
||||
popd
|
||||
rm -fR silvers/tarnished
|
||||
mkdir -p silvers/tarnished
|
||||
|
||||
@@ -36,7 +36,7 @@ do
|
||||
yoga,
|
||||
})
|
||||
|
||||
links({ 'rive','rive_decoders', 'rive_harfbuzz', 'rive_sheenbidi', 'rive_yoga' })
|
||||
links({ 'rive', 'rive_decoders', 'rive_harfbuzz', 'rive_sheenbidi', 'rive_yoga', 'miniaudio' })
|
||||
|
||||
libdirs({ rive .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user