mirror of
https://github.com/rive-app/rive-cpp.git
synced 2026-01-18 13:11:19 +01:00
Re-works viewer to use GL, Metal, and optionally in the future D3D. Also introduces a new renderer and allows the viewer to be compiled with either Skia or the new example Tess renderer (with either GL or Metal). I want to re-work the dependency building to be more similar to what Mike did with the third_party directory in a separate PR. It's pretty similar to what's been done here, but generalized at the top level which I think is nice and more re-usable. Also removes the need for some of my path building shell scripts... There's a new README.md in the viewer directory with some details. ``` cd packages/runtime/viewer/build/macosx ``` Build and run with a Metal backed Skia Renderer: ``` ./build_viewer.sh metal skia run ``` Build and run with a GL backed Skia Renderer: ``` ./build_viewer.sh gl skia run ``` Build and run with a Metal backed Tess Renderer: ``` ./build_viewer.sh metal tess run ``` ... and so on You can also clean directly from the same command: ``` ./build_viewer.sh metal tess run clean ``` Diffs= 86d5b0924 Cleanup skia build 83506229a Fix skia dir. 7d4a3bdcf Remove tess to simplify PR. 14346ad9e Nuke old viewer fba2696cf See clang-format after update 15b8fd753 Remove mat4 test from main rive project 69a2ce9ad Render font cleanup abd8fa89b Missed files. e690870a4 Move shader.h and remove formatting for generated files. afc437b17 Tweaks for failed tests. 2f9a936fc Moving mat4 to tess renderer. 27a3606d6 Cleanup a4034ff0f Adding viewer readme bebcd8abe Adding text viewers. 5a1da4ed2 Getting image rendering working in with tess 2c81fee81 Silence deprecation warning. 52f410dfc Getting mesh rendering working. 8de842c7f Starting to use sokol to render meshes. Adding Mat4 class. dbd5c79b5 Updating clang format for objc ca0ea9d84 Getting image content working too and fixing contention with sokol 79405a77d Starting to add handle draw support. 8b9f14a16 Adding gl renderer for skia. af23274ae Adding support for rendering Skia with Metal. 92139ce08 Adding tess renderer. dc3e1b49b Adding dependencies at top level 22fa8e6ce Updating build scripts b5cb990aa Merging with latest master. d08ac18e2 Reorg a828e92da Updating project json 086890736 Cleanup unused glfw and gl3w for new viewer 55161f36c Using sokol. 72b62b563 Separating GL and TessRenderer. 611b991b6 Adding limits import to fix compilation on all platforms. 820ab8e2f Missed build files. 0964b4416 Stubbing out a generalized viewer and alternate renderer.
124 lines
3.6 KiB
Bash
Executable File
124 lines
3.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
if [[ -z "${DEPENDENCIES}" ]]; then
|
|
echo "DEPENDENCIES env variable must be set. This script is usually called by other scripts."
|
|
exit 1
|
|
fi
|
|
|
|
pushd $DEPENDENCIES
|
|
|
|
if [ ! -d skia ]; then
|
|
git clone https://github.com/google/skia skia
|
|
cd skia
|
|
git checkout chrome/m99
|
|
else
|
|
cd skia
|
|
fi
|
|
|
|
python tools/git-sync-deps
|
|
|
|
CONFIG=debug
|
|
RENDERER=
|
|
SKIA_USE_GL=false
|
|
SKIA_USE_METAL=false
|
|
|
|
for var in "$@"; do
|
|
if [[ $var = "release" ]]; then
|
|
CONFIG=release
|
|
fi
|
|
if [[ $var = "gl" ]]; then
|
|
SKIA_USE_GL=true
|
|
RENDERER=gl
|
|
fi
|
|
if [[ $var = "metal" ]]; then
|
|
SKIA_USE_METAL=true
|
|
RENDERER=metal
|
|
fi
|
|
done
|
|
|
|
if [[ $CONFIG = "debug" ]]; then
|
|
bin/gn gen out/$RENDERER/debug --type=static_library --args=" \
|
|
extra_cflags=[\"-fno-rtti\", \"-DSK_DISABLE_SKPICTURE\", \"-DSK_DISABLE_TEXT\", \"-DRIVE_OPTIMIZED\", \"-DSK_DISABLE_LEGACY_SHADERCONTEXT\", \"-DSK_DISABLE_LOWP_RASTER_PIPELINE\", \"-DSK_FORCE_RASTER_PIPELINE_BLITTER\", \"-DSK_DISABLE_AAA\", \"-DSK_DISABLE_EFFECT_DESERIALIZATION\"] \
|
|
|
|
is_official_build=false \
|
|
skia_use_gl=$SKIA_USE_GL \
|
|
skia_use_zlib=true \
|
|
skia_enable_gpu=true \
|
|
skia_enable_fontmgr_empty=false \
|
|
skia_use_libpng_encode=true \
|
|
skia_use_libpng_decode=true \
|
|
skia_enable_skgpu_v1=true \
|
|
|
|
skia_use_dng_sdk=false \
|
|
skia_use_egl=false \
|
|
skia_use_expat=false \
|
|
skia_use_fontconfig=false \
|
|
skia_use_freetype=false \
|
|
skia_use_icu=false \
|
|
skia_use_libheif=false \
|
|
skia_use_system_libpng=false \
|
|
skia_use_system_libjpeg_turbo=false \
|
|
skia_use_libjpeg_turbo_encode=false \
|
|
skia_use_libjpeg_turbo_decode=true \
|
|
skia_use_libwebp_encode=false \
|
|
skia_use_libwebp_decode=true \
|
|
skia_use_system_libwebp=false \
|
|
skia_use_lua=false \
|
|
skia_use_piex=false \
|
|
skia_use_vulkan=false \
|
|
skia_use_metal=$SKIA_USE_METAL \
|
|
skia_use_angle=false \
|
|
skia_use_system_zlib=false \
|
|
skia_enable_spirv_validation=false \
|
|
skia_enable_pdf=false \
|
|
skia_enable_skottie=false \
|
|
skia_enable_tools=false \
|
|
"
|
|
ninja -C out/$RENDERER/debug
|
|
du -hs out/$RENDERER/debug/libskia.a
|
|
fi
|
|
|
|
if [[ $CONFIG = "release" ]]; then
|
|
bin/gn gen out/$RENDERER/release --type=static_library --args=" \
|
|
extra_cflags=[\"-fno-rtti\", \"-flto=full\", \"-DSK_DISABLE_SKPICTURE\", \"-DSK_DISABLE_TEXT\", \"-DRIVE_OPTIMIZED\", \"-DSK_DISABLE_LEGACY_SHADERCONTEXT\", \"-DSK_DISABLE_LOWP_RASTER_PIPELINE\", \"-DSK_FORCE_RASTER_PIPELINE_BLITTER\", \"-DSK_DISABLE_AAA\", \"-DSK_DISABLE_EFFECT_DESERIALIZATION\"] \
|
|
|
|
is_official_build=true \
|
|
skia_use_gl=true \
|
|
skia_use_zlib=true \
|
|
skia_enable_gpu=true \
|
|
skia_enable_fontmgr_empty=false \
|
|
skia_use_libpng_encode=true \
|
|
skia_use_libpng_decode=true \
|
|
skia_enable_skgpu_v1=true \
|
|
|
|
skia_use_dng_sdk=false \
|
|
skia_use_egl=false \
|
|
skia_use_expat=false \
|
|
skia_use_fontconfig=false \
|
|
skia_use_freetype=false \
|
|
skia_use_icu=false \
|
|
skia_use_libheif=false \
|
|
skia_use_system_libpng=false \
|
|
skia_use_system_libjpeg_turbo=false \
|
|
skia_use_libjpeg_turbo_encode=false \
|
|
skia_use_libjpeg_turbo_decode=true \
|
|
skia_use_libwebp_encode=false \
|
|
skia_use_libwebp_decode=true \
|
|
skia_use_system_libwebp=false \
|
|
skia_use_lua=false \
|
|
skia_use_piex=false \
|
|
skia_use_vulkan=false \
|
|
skia_use_metal=true \
|
|
skia_use_angle=false \
|
|
skia_use_system_zlib=false \
|
|
skia_enable_spirv_validation=false \
|
|
skia_enable_pdf=false \
|
|
skia_enable_skottie=false \
|
|
skia_enable_tools=false \
|
|
"
|
|
ninja -C out/$RENDERER/release
|
|
du -hs out/$RENDERER/release/libskia.a
|
|
fi
|