Fixing skia viewer and renderer builds. A couple of fixes: - skia renderer uses new harfbuzz dependency paths - skia builds of viewer don't try to include tess specific logic for example atlas Diffs= 45293a868 oops f8a8f4c0c override skia cache folder d86875260 Try 10b22bfe3 Attempt using correct skia dir 85feea448 more fixes 0b0371b24 switching to bash ad07fbd18 Tweak for linux build dab0642a0 Adding config dirs for linux 7e5a2aa47 Build harfbuzz from the recorder builder a77709a68 Fixing skia viewer and renderer builds.
diff --git a/.rive_head b/.rive_head index 59d6fd3..730a897 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -fdeff54d123865883813a209c3047d2c5ec2c123 +45293a868af98513a710631a624f0b3184475c77
diff --git a/dependencies/config_directories.sh b/dependencies/config_directories.sh new file mode 100755 index 0000000..5b1b8de --- /dev/null +++ b/dependencies/config_directories.sh
@@ -0,0 +1,17 @@ +#!/bin/sh + +# Platform specific build scripts should source directly the platform specific +# version of this scripts. If you're using an older script that tries to handle +# all platforms then call this one. We've moved to using platform specific build +# scripts where possible since most of our Windows builds diverge so far from +# the mac/linux ones. Most Mac/Linux ones can still be shared. +set -e + +unameOut="$(uname -s)" +case "${unameOut}" in +Linux*) machine=linux ;; +Darwin*) machine=macosx ;; +*) machine="unhandled:${unameOut}" ;; +esac + +source $(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)/${machine}/config_directories.sh
diff --git a/dependencies/linux/config_directories.sh b/dependencies/linux/config_directories.sh new file mode 120000 index 0000000..f47195b --- /dev/null +++ b/dependencies/linux/config_directories.sh
@@ -0,0 +1 @@ +../macosx/config_directories.sh \ No newline at end of file
diff --git a/dependencies/linux/get_harfbuzz.sh b/dependencies/linux/get_harfbuzz.sh new file mode 120000 index 0000000..994888b --- /dev/null +++ b/dependencies/linux/get_harfbuzz.sh
@@ -0,0 +1 @@ +../macosx/get_harfbuzz.sh \ No newline at end of file
diff --git a/dependencies/macosx/get_harfbuzz.sh b/dependencies/macosx/get_harfbuzz.sh index 22b012e..6ad6b12 100755 --- a/dependencies/macosx/get_harfbuzz.sh +++ b/dependencies/macosx/get_harfbuzz.sh
@@ -1,8 +1,11 @@ -#!/bin/sh +#!/bin/bash +# if you're looking at this in dependencies/linux, please note it's a symbolic +# link to dependencies/macosx/get_harfbuzz.sh if changes need to be made here we +# should let these two scripts diverge. set -e -if [[ -z "${DEPENDENCIES}" ]]; then +if [ -z "${DEPENDENCIES}" ]; then echo "DEPENDENCIES env variable must be set. This script is usually called by other scripts." exit 1 fi
diff --git a/skia/dependencies/make_skia_android.sh b/skia/dependencies/make_skia_android.sh index 778c54d..59f86d1 100755 --- a/skia/dependencies/make_skia_android.sh +++ b/skia/dependencies/make_skia_android.sh
@@ -65,6 +65,7 @@ skia_use_angle=false \ skia_use_dng_sdk=false \ + skia_use_freetype=false \ skia_use_expat=false \ skia_use_fontconfig=false \
diff --git a/skia/renderer/build.sh b/skia/renderer/build.sh index 1cde085..5e51dae 100755 --- a/skia/renderer/build.sh +++ b/skia/renderer/build.sh
@@ -1,6 +1,15 @@ #!/bin/bash set -e +export SKIA_DIR="skia" +source ../../dependencies/config_directories.sh + +if [[ ! -d "$DEPENDENCIES/harfbuzz" ]]; then + pushd $DEPENDENCIES_SCRIPTS + ./get_harfbuzz.sh + popd +fi + # build main rive cd ../.. ./build.sh "$@" @@ -83,4 +92,4 @@ esac fi -popd &>/dev/null \ No newline at end of file +popd &>/dev/null
diff --git a/skia/renderer/build/premake5.lua b/skia/renderer/build/premake5.lua index dcbcf0f..ab40667 100644 --- a/skia/renderer/build/premake5.lua +++ b/skia/renderer/build/premake5.lua
@@ -1,142 +1,188 @@ -workspace "rive" -configurations {"debug", "release"} +workspace 'rive' +configurations {'debug', 'release'} -SKIA_DIR = os.getenv('SKIA_DIR') or 'skia' +SKIA_DIR = os.getenv('SKIA_DIR') dependencies = os.getenv('DEPENDENCIES') -if dependencies ~= nil then +if SKIA_DIR == nil and dependencies ~= nil then + print('------> 1') SKIA_DIR = dependencies .. '/skia' else - SKIA_DIR = "../../dependencies/" .. SKIA_DIR + print('------> 2') + if SKIA_DIR == nil then + print('------> 3') + SKIA_DIR = 'skia' + end + SKIA_DIR = '../../dependencies/' .. SKIA_DIR end -project "rive_skia_renderer" - kind "StaticLib" - language "C++" - cppdialect "C++17" - toolset "clang" - targetdir "%{cfg.system}/bin/%{cfg.buildcfg}" - objdir "%{cfg.system}/obj/%{cfg.buildcfg}" +print('------> IT IS ' .. SKIA_DIR) + +project 'rive_skia_renderer' +do + kind 'StaticLib' + language 'C++' + cppdialect 'C++17' + toolset 'clang' + targetdir '%{cfg.system}/bin/%{cfg.buildcfg}' + objdir '%{cfg.system}/obj/%{cfg.buildcfg}' includedirs { - "../../../../../third_party/externals/harfbuzz/src", - "../include", - "../../../include" + dependencies .. '/harfbuzz/src', + '../include', + '../../../include' } - if os.host() == "macosx" then - links {"Cocoa.framework", "rive", "skia"} - elseif os.host() == "windows" then - architecture "x64" + if os.host() == 'macosx' then + links {'Cocoa.framework', 'rive', 'skia'} + elseif os.host() == 'windows' then + architecture 'x64' links { - "rive", - "skia.lib", - "opengl32.lib" + 'rive', + 'skia.lib', + 'opengl32.lib' } - defines {"_USE_MATH_DEFINES"} - staticruntime "on" -- Match Skia's /MT flag for link compatibility - runtime "Release" -- Use /MT even in debug (/MTd is incompatible with Skia) + defines {'_USE_MATH_DEFINES'} + staticruntime 'on' -- Match Skia's /MT flag for link compatibility + runtime 'Release' -- Use /MT even in debug (/MTd is incompatible with Skia) else - links {"rive", "skia"} + links {'rive', 'skia'} end - libdirs {"../../../build/%{cfg.system}/bin/%{cfg.buildcfg}"} + libdirs {'../../../build/%{cfg.system}/bin/%{cfg.buildcfg}'} files { - "../src/**.cpp" + '../src/**.cpp' } - buildoptions {"-Wall", "-fno-exceptions", "-fno-rtti", "-Werror=format"} + buildoptions {'-Wall', '-fno-exceptions', '-fno-rtti', '-Werror=format'} - filter {"system:macosx" } + filter {'system:macosx'} + do includedirs {SKIA_DIR} - libdirs {SKIA_DIR.. "/out/static"} + libdirs {SKIA_DIR .. '/out/static'} + end - filter {"system:linux or windows" } + filter {'system:linux or windows'} + do includedirs {SKIA_DIR} - libdirs {SKIA_DIR.. "/out/static"} + libdirs {SKIA_DIR .. '/out/static'} + end - filter {"system:ios" } + filter {'system:ios'} + do includedirs {SKIA_DIR} - libdirs {SKIA_DIR.. "/out/static"} + libdirs {SKIA_DIR .. '/out/static'} + end - filter {"system:ios", "options:variant=system" } - buildoptions {"-mios-version-min=10.0 -fembed-bitcode -arch armv7 -arch arm64 -arch arm64e -isysroot " .. (os.getenv("IOS_SYSROOT") or "")} - - filter {"system:ios", "options:variant=emulator" } - buildoptions {"-mios-version-min=10.0 -arch x86_64 -arch arm64 -arch i386 -isysroot " .. (os.getenv("IOS_SYSROOT") or "")} - targetdir "%{cfg.system}_sim/bin/%{cfg.buildcfg}" - objdir "%{cfg.system}_sim/obj/%{cfg.buildcfg}" + filter {'system:ios', 'options:variant=system'} + do + buildoptions { + '-mios-version-min=10.0 -fembed-bitcode -arch armv7 -arch arm64 -arch arm64e -isysroot ' .. + (os.getenv('IOS_SYSROOT') or '') + } + end + + filter {'system:ios', 'options:variant=emulator'} + do + buildoptions { + '-mios-version-min=10.0 -arch x86_64 -arch arm64 -arch i386 -isysroot ' .. (os.getenv('IOS_SYSROOT') or '') + } + targetdir '%{cfg.system}_sim/bin/%{cfg.buildcfg}' + objdir '%{cfg.system}_sim/obj/%{cfg.buildcfg}' + end -- Is there a way to pass 'arch' as a variable here? - filter { "system:android" } + filter {'system:android'} + do includedirs {SKIA_DIR} - - filter { "system:android", "options:arch=x86" } - targetdir "%{cfg.system}/x86/bin/%{cfg.buildcfg}" - objdir "%{cfg.system}/x86/obj/%{cfg.buildcfg}" - libdirs {SKIA_DIR.. "/out/x86"} - filter { "system:android", "options:arch=x64" } - targetdir "%{cfg.system}/x64/bin/%{cfg.buildcfg}" - objdir "%{cfg.system}/x64/obj/%{cfg.buildcfg}" - libdirs {SKIA_DIR.. "/out/x64"} + filter {'system:android', 'options:arch=x86'} + do + targetdir '%{cfg.system}/x86/bin/%{cfg.buildcfg}' + objdir '%{cfg.system}/x86/obj/%{cfg.buildcfg}' + libdirs {SKIA_DIR .. '/out/x86'} + end - filter { "system:android", "options:arch=arm" } - targetdir "%{cfg.system}/arm/bin/%{cfg.buildcfg}" - objdir "%{cfg.system}/arm/obj/%{cfg.buildcfg}" - libdirs {SKIA_DIR.. "/out/arm"} + filter {'system:android', 'options:arch=x64'} + do + targetdir '%{cfg.system}/x64/bin/%{cfg.buildcfg}' + objdir '%{cfg.system}/x64/obj/%{cfg.buildcfg}' + libdirs {SKIA_DIR .. '/out/x64'} + end - filter { "system:android", "options:arch=arm64" } - targetdir "%{cfg.system}/arm64/bin/%{cfg.buildcfg}" - objdir "%{cfg.system}/arm64/obj/%{cfg.buildcfg}" - libdirs {SKIA_DIR.. "/out/arm64"} + filter {'system:android', 'options:arch=arm'} + do + targetdir '%{cfg.system}/arm/bin/%{cfg.buildcfg}' + objdir '%{cfg.system}/arm/obj/%{cfg.buildcfg}' + libdirs {SKIA_DIR .. '/out/arm'} + end - filter { "configurations:release", "system:macosx" } - buildoptions {"-flto=full"} + filter {'system:android', 'options:arch=arm64'} + do + targetdir '%{cfg.system}/arm64/bin/%{cfg.buildcfg}' + objdir '%{cfg.system}/arm64/obj/%{cfg.buildcfg}' + libdirs {SKIA_DIR .. '/out/arm64'} + end + end - filter { "configurations:release", "system:android" } - buildoptions {"-flto=full"} + filter {'configurations:release', 'system:macosx'} + do + buildoptions {'-flto=full'} + end - filter { "configurations:release", "system:ios" } - buildoptions {"-flto=full"} + filter {'configurations:release', 'system:android'} + do + buildoptions {'-flto=full'} + end - filter "configurations:debug" - buildoptions {"-g"} - defines {"DEBUG"} - symbols "On" + filter {'configurations:release', 'system:ios'} + do + buildoptions {'-flto=full'} + end - filter "configurations:release" - defines {"RELEASE", "NDEBUG"} - optimize "On" + filter 'configurations:debug' + do + buildoptions {'-g'} + defines {'DEBUG'} + symbols 'On' + end - filter {"options:with-text" } - defines {"RIVE_TEXT"} - + filter 'configurations:release' + do + defines {'RELEASE', 'NDEBUG'} + optimize 'On' + end + + filter {'options:with-text'} + do + defines {'RIVE_TEXT'} + end +end + newoption { - trigger = "with-text", - description = "Enables text experiments" + trigger = 'with-text', + description = 'Enables text experiments' } newoption { - trigger = "variant", - value = "type", - description = "Choose a particular variant to build", + 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" } + {'system', 'Builds the static library for the provided system'}, + {'emulator', 'Builds for an emulator/simulator for the provided system'} }, - default = "system" + default = 'system' } newoption { - trigger = "arch", - value = "ABI", - description = "The ABI with the right toolchain for this build, generally with Android", + trigger = 'arch', + value = 'ABI', + description = 'The ABI with the right toolchain for this build, generally with Android', allowed = { - { "x86" }, - { "x64" }, - { "arm" }, - { "arm64" } + {'x86'}, + {'x64'}, + {'arm'}, + {'arm64'} } - -} \ No newline at end of file +}
diff --git a/viewer/src/viewer_content/scene_content.cpp b/viewer/src/viewer_content/scene_content.cpp index 774084c..6eab70d 100644 --- a/viewer/src/viewer_content/scene_content.cpp +++ b/viewer/src/viewer_content/scene_content.cpp
@@ -14,7 +14,9 @@ #include "rive/math/aabb.hpp" #include "rive/assets/image_asset.hpp" #include "viewer/viewer_content.hpp" +#ifdef RIVE_RENDERER_TESS #include "viewer/sample_tools/sample_atlas_packer.hpp" +#endif constexpr int REQUEST_DEFAULT_SCENE = -1;