mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 13:11:19 +01:00
build: Fix premake5 build on macOS Sequoia (#10263) b4298b861b
It looks like the premake5 "v5.0.0-beta3" tag isn't compatible with Sequoia 15.4.1. Bump our tag to v5.0.0-beta7 and update the deprecated features we had been using. Also fix the script to rebuild if the premake5 binary doesn't exist. Before it only checked if the parent "premake-core" directory existed, so if a build had failed previously, build_rive.sh would fail forever without ever attempting to build premake5 again. Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com> Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
This commit is contained in:
@@ -1 +1 @@
|
||||
f9b4941afd1c9afe133963de2542fd73edbfdf0a
|
||||
b4298b861b5b5607bf91983ba8382bff134257f9
|
||||
|
||||
@@ -203,7 +203,13 @@ else
|
||||
fi
|
||||
|
||||
RIVE_PREMAKE_ARGS="$RIVE_BUILD_SYSTEM --config=$RIVE_CONFIG --out=$RIVE_OUT $RIVE_PREMAKE_ARGS"
|
||||
if [ ! -z "$RIVE_OS" ]; then RIVE_PREMAKE_ARGS="$RIVE_PREMAKE_ARGS --os=$RIVE_OS"; fi
|
||||
if [[ $RIVE_OS = "android" ]]; then
|
||||
# Premake stopped supporting "--os=android".
|
||||
# Use our own custom "--for_android" flag instead.
|
||||
RIVE_PREMAKE_ARGS="$RIVE_PREMAKE_ARGS --for_android"
|
||||
elif [ ! -z "$RIVE_OS" ]; then
|
||||
RIVE_PREMAKE_ARGS="$RIVE_PREMAKE_ARGS --os=$RIVE_OS"
|
||||
fi
|
||||
if [ ! -z "$RIVE_VARIANT" ]; then RIVE_PREMAKE_ARGS="$RIVE_PREMAKE_ARGS --variant=$RIVE_VARIANT"; fi
|
||||
if [ ! -z "$RIVE_ARCH" ]; then RIVE_PREMAKE_ARGS="$RIVE_PREMAKE_ARGS --arch=$RIVE_ARCH"; fi
|
||||
|
||||
@@ -215,10 +221,15 @@ fi
|
||||
mkdir -p "$SCRIPT_DIR/dependencies"
|
||||
pushd "$SCRIPT_DIR/dependencies" > /dev/null
|
||||
|
||||
# Setup premake5.
|
||||
if [ ! -d premake-core ]; then
|
||||
# Add premake5 to the $PATH.
|
||||
# Install premake5 to a specific directory based on our current tag, to make
|
||||
# sure we rebuild if this script runs for a different tag.
|
||||
RIVE_PREMAKE_TAG="${RIVE_PREMAKE_TAG:-v5.0.0-beta7}"
|
||||
PREMAKE_INSTALL_DIR="$SCRIPT_DIR/dependencies/premake-core/bin/${RIVE_PREMAKE_TAG}_release"
|
||||
if [ ! -f "$PREMAKE_INSTALL_DIR/premake5" ]; then
|
||||
echo Building Premake...
|
||||
git clone -b v5.0.0-beta3 https://github.com/premake/premake-core.git
|
||||
rm -fr premake-core # Wipe out a prior checkout if it exists without a premake5 binary.
|
||||
git clone --depth 1 --branch $RIVE_PREMAKE_TAG https://github.com/premake/premake-core.git
|
||||
pushd premake-core > /dev/null
|
||||
case "$HOST_MACHINE" in
|
||||
mac_arm64) make -f Bootstrap.mak osx PLATFORM=ARM ;;
|
||||
@@ -226,9 +237,12 @@ if [ ! -d premake-core ]; then
|
||||
windows) ./Bootstrap.bat ;;
|
||||
*) make -f Bootstrap.mak linux ;;
|
||||
esac
|
||||
cp -r bin/release $PREMAKE_INSTALL_DIR
|
||||
popd > /dev/null
|
||||
fi
|
||||
export PATH="$SCRIPT_DIR/dependencies/premake-core/bin/release/:$PATH"
|
||||
export PATH="$PREMAKE_INSTALL_DIR:$PATH"
|
||||
|
||||
# Add Rive's build scripts to the premake path.
|
||||
export PREMAKE_PATH="$SCRIPT_DIR"
|
||||
|
||||
# Setup premake-ninja.
|
||||
|
||||
@@ -61,6 +61,12 @@ newoption({
|
||||
default = 'host',
|
||||
})
|
||||
|
||||
-- Premake stopped supporting "--os=android". Add our own flag for android.
|
||||
newoption({
|
||||
trigger = 'for_android',
|
||||
description = 'compile for android (supersedes --os)',
|
||||
})
|
||||
|
||||
newoption({
|
||||
trigger = 'android_api',
|
||||
description = 'Target Android API version number',
|
||||
@@ -191,12 +197,17 @@ end
|
||||
|
||||
filter({ 'options:config=release', 'options:not no-lto', 'system:not macosx', 'system:not ios' })
|
||||
do
|
||||
flags({ 'LinkTimeOptimization' })
|
||||
if linktimeoptimization then
|
||||
linktimeoptimization('On')
|
||||
else
|
||||
-- Deprecated way of turning on LTO, for older versions of premake.
|
||||
flags({ 'LinkTimeOptimization' })
|
||||
end
|
||||
end
|
||||
|
||||
filter({ 'options:config=release', 'options:not no-lto', 'system:macosx or ios' })
|
||||
do
|
||||
-- The 'LinkTimeOptimization' flag attempts to use llvm-ar, which doesn't always exist on macos.
|
||||
-- The 'linktimeoptimization' command attempts to use llvm-ar, which doesn't always exist on macos.
|
||||
buildoptions({ '-flto=full' })
|
||||
linkoptions({ '-flto=full' })
|
||||
end
|
||||
@@ -388,7 +399,8 @@ filter({})
|
||||
|
||||
-- Don't use filter() here because we don't want to generate the "android_ndk" toolset if not
|
||||
-- building for android.
|
||||
if _OPTIONS['os'] == 'android' then
|
||||
if _OPTIONS['for_android'] then
|
||||
system('android')
|
||||
pic('on') -- Position-independent code is required for NDK libraries.
|
||||
|
||||
-- Detect the NDK.
|
||||
|
||||
@@ -11,7 +11,7 @@ do
|
||||
|
||||
files({ 'src/**.cpp' })
|
||||
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
filter('system:windows')
|
||||
do
|
||||
|
||||
@@ -14,7 +14,7 @@ language('C++')
|
||||
cppdialect('C++17')
|
||||
targetdir('%{cfg.buildcfg}')
|
||||
objdir('obj/%{cfg.buildcfg}')
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
includedirs({ '../include', '../../include', libpng })
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ end
|
||||
project('rive_decoders')
|
||||
do
|
||||
kind('StaticLib')
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
includedirs({
|
||||
'include',
|
||||
|
||||
2
dependencies/premake5_harfbuzz.lua
vendored
2
dependencies/premake5_harfbuzz.lua
vendored
@@ -251,7 +251,7 @@ do
|
||||
|
||||
filter('toolset:clang')
|
||||
do
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
buildoptions({
|
||||
'-Werror=format',
|
||||
'-Wimplicit-int-conversion',
|
||||
|
||||
2
dependencies/premake5_harfbuzz_v2.lua
vendored
2
dependencies/premake5_harfbuzz_v2.lua
vendored
@@ -256,7 +256,7 @@ do
|
||||
|
||||
filter('toolset:not msc')
|
||||
do
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
buildoptions({
|
||||
'-Werror=format',
|
||||
'-Wimplicit-int-conversion',
|
||||
|
||||
2
dependencies/premake5_libpng_v2.lua
vendored
2
dependencies/premake5_libpng_v2.lua
vendored
@@ -80,7 +80,7 @@ do
|
||||
|
||||
filter('toolset:not msc')
|
||||
do
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
buildoptions({
|
||||
'-Wno-unknown-warning-option',
|
||||
'-Wno-deprecated-non-prototype',
|
||||
|
||||
2
dependencies/premake5_yoga.lua
vendored
2
dependencies/premake5_yoga.lua
vendored
@@ -51,7 +51,7 @@ do
|
||||
|
||||
filter('toolset:clang')
|
||||
do
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
buildoptions({
|
||||
'-Werror=format',
|
||||
'-Wimplicit-int-conversion',
|
||||
|
||||
@@ -69,7 +69,7 @@ do
|
||||
filter('options:not for_unreal')
|
||||
do
|
||||
cppdialect('C++11')
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
end
|
||||
|
||||
filter({ 'options:for_unreal' })
|
||||
|
||||
@@ -27,7 +27,7 @@ if not _OPTIONS['with-webgpu'] then
|
||||
yoga,
|
||||
})
|
||||
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
defines({ 'YOGA_EXPORT=' })
|
||||
|
||||
@@ -188,7 +188,7 @@ if _OPTIONS['with-webgpu'] or _OPTIONS['with-dawn'] then
|
||||
'include',
|
||||
RIVE_RUNTIME_DIR .. '/skia/dependencies/glfw/include',
|
||||
})
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
defines({ 'YOGA_EXPORT=' })
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ do
|
||||
'../include',
|
||||
pls_generated_headers,
|
||||
})
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
files({ 'src/*.cpp', 'renderer/decoding/*.cpp' })
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ do
|
||||
|
||||
files({ '../src/**.cpp' })
|
||||
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
filter('system:windows')
|
||||
do
|
||||
|
||||
@@ -21,7 +21,7 @@ do
|
||||
|
||||
files({ 'src/**.cpp' })
|
||||
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
filter({ 'system:macosx or linux or windows or ios' })
|
||||
do
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
// #endif
|
||||
|
||||
#include "rive/math/math_types.hpp"
|
||||
#include "rive/text_engine.hpp"
|
||||
#include "rive/text/font_hb.hpp"
|
||||
#include "rive/text/utf.hpp"
|
||||
@@ -297,7 +298,7 @@ void CoreTextHBFont::shapeFallbackRun(
|
||||
{
|
||||
CTRunRef run = (CTRunRef)CFArrayGetValueAtIndex(run_array, runIndex);
|
||||
|
||||
if (auto count = CTRunGetGlyphCount(run))
|
||||
if (CFIndex count = CTRunGetGlyphCount(run))
|
||||
{
|
||||
rive::GlyphRun gr(count);
|
||||
|
||||
@@ -349,15 +350,17 @@ void CoreTextHBFont::shapeFallbackRun(
|
||||
CTRunGetAdvances(run, {0, count}, advances.data());
|
||||
CTRunGetStringIndices(run, {0, count}, indices.data());
|
||||
|
||||
int reverseIndex = count - 1;
|
||||
CFIndex reverseIndex = count - 1;
|
||||
for (CFIndex i = 0; i < count; ++i)
|
||||
{
|
||||
int glyphIndex = isEvenLevel ? i : reverseIndex;
|
||||
CFIndex glyphIndex = isEvenLevel ? i : reverseIndex;
|
||||
float advance =
|
||||
(float)(advances[i].width * scale) + textRun.letterSpacing;
|
||||
gr.xpos[glyphIndex] = gr.advances[glyphIndex] = advance;
|
||||
gr.textIndices[glyphIndex] =
|
||||
textStart + indices[i]; // utf16 offsets, will fix-up later
|
||||
rive::math::lossless_numeric_cast<uint32_t>(
|
||||
textStart +
|
||||
indices[i]); // utf16 offsets, will fix-up later
|
||||
|
||||
gr.offsets[glyphIndex] = rive::Vec2D(0.0f, 0.0f);
|
||||
reverseIndex--;
|
||||
|
||||
@@ -20,7 +20,7 @@ function rive_tools_project(name, project_kind)
|
||||
if project_kind == 'RiveTool' then
|
||||
kind(
|
||||
_OPTIONS['for_unreal'] and 'StaticLib'
|
||||
or _OPTIONS['os'] == 'android' and 'SharedLib'
|
||||
or _OPTIONS['for_android'] and 'SharedLib'
|
||||
or _OPTIONS['os'] == 'ios' and 'StaticLib'
|
||||
or 'ConsoleApp'
|
||||
)
|
||||
@@ -53,7 +53,7 @@ function rive_tools_project(name, project_kind)
|
||||
kind(project_kind)
|
||||
end
|
||||
|
||||
flags({ 'FatalCompileWarnings' })
|
||||
fatalwarnings { "All" }
|
||||
|
||||
defines({
|
||||
'SK_GL',
|
||||
|
||||
Reference in New Issue
Block a user