mirror of
https://github.com/rive-app/rive-ios.git
synced 2026-01-18 17:11:28 +01:00
Remove Skia from iOS runtime
The Rive renderer is stable and ready for production now. This cuts the runtime size from 7.1 MB to 2.3. Diffs= 32f7a05eb Remove Skia from iOS runtime (#6072) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
This commit is contained in:
45
.github/workflows/release.yml
vendored
45
.github/workflows/release.yml
vendored
@@ -13,53 +13,8 @@ on:
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build-skia:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["x86", "x64", "arm", "arm64", "iossim_arm64"]
|
||||
|
||||
runs-on: macos-12
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.ACTIONS_ROLE }}
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
token: ${{ secrets.PAT_GITHUB }}
|
||||
|
||||
- name: Update Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: "16"
|
||||
|
||||
- name: Installing pre-requisites
|
||||
run: |
|
||||
set -x
|
||||
# Install some dependencies & premake5
|
||||
brew install ninja
|
||||
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-macosx.tar.gz -L -o premake_macosx.tar.gz
|
||||
tar -xvf premake_macosx.tar.gz 2>/dev/null
|
||||
rm premake_macosx.tar.gz
|
||||
sudo chmod a+x premake5
|
||||
mkdir bin
|
||||
cp premake5 bin/premake5
|
||||
sudo mv premake5 /usr/local/bin
|
||||
|
||||
- name: Build skia files
|
||||
run: ./scripts/build.skia.sh -a ${{ matrix.arch }}
|
||||
|
||||
determine_version:
|
||||
name: Determine the next build version
|
||||
needs: build-skia
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.echo_version.outputs.version }}
|
||||
|
||||
51
.github/workflows/tests.yml
vendored
51
.github/workflows/tests.yml
vendored
@@ -7,52 +7,8 @@ on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build-skia:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["x86", "x64", "arm", "arm64", "iossim_arm64"]
|
||||
runs-on: ghcr.io/cirruslabs/macos-runner:sonoma
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-region: us-west-2
|
||||
role-to-assume: ${{ secrets.ACTIONS_ROLE }}
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
token: ${{ secrets.PAT_GITHUB }}
|
||||
|
||||
- name: Update Java
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: "16"
|
||||
|
||||
- name: Installing pre-requisites
|
||||
run: |
|
||||
set -x
|
||||
# Install some dependencies & premake5
|
||||
brew install ninja
|
||||
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-macosx.tar.gz -L -o premake_macosx.tar.gz
|
||||
tar -xvf premake_macosx.tar.gz 2>/dev/null
|
||||
rm premake_macosx.tar.gz
|
||||
mkdir bin
|
||||
cp premake5 bin/premake5
|
||||
sudo chmod a+x premake5
|
||||
sudo mv premake5 /usr/local/bin
|
||||
|
||||
- name: Build skia files
|
||||
run: ./scripts/build.skia.sh -a ${{ matrix.arch }}
|
||||
|
||||
run_tests:
|
||||
name: Run Rive tests
|
||||
needs: build-skia
|
||||
runs-on: ghcr.io/cirruslabs/macos-runner:sonoma
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -80,13 +36,6 @@ jobs:
|
||||
sudo mv premake5 /usr/local/bin
|
||||
pip3 install ply
|
||||
|
||||
- name: Build everything WITHOUT Rive Renderer
|
||||
run: |
|
||||
./scripts/build.sh ios_sim release
|
||||
|
||||
- name: Testing iOS app WITHOUT Rive Renderer
|
||||
run: ./scripts/test.sh
|
||||
|
||||
- name: Get Renderer ref
|
||||
id: renderer-ref
|
||||
run: echo "REF_VALUE=$(cat .rive_renderer)" >> $GITHUB_OUTPUT
|
||||
|
||||
@@ -1 +1 @@
|
||||
aeab0243028fcef6fc2fd9177de2479e18ad4428
|
||||
32f7a05eb9bf52eaea241136038dbda20fb38ea5
|
||||
|
||||
@@ -766,11 +766,6 @@
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = NO;
|
||||
GCC_ENABLE_CPP_RTTI = NO;
|
||||
"HEADER_SEARCH_PATHS[arch=*]" = (
|
||||
dependencies/includes/skia,
|
||||
dependencies/includes/skia/include/core,
|
||||
dependencies/includes/skia/include/effects,
|
||||
dependencies/includes/skia/include/gpu,
|
||||
dependencies/includes/skia/include/config,
|
||||
dependencies/includes/rive/include,
|
||||
dependencies/includes/renderer/include,
|
||||
dependencies/includes/pls/include,
|
||||
@@ -799,32 +794,26 @@
|
||||
"-DYOGA_EXPORT=",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphoneos*]" = (
|
||||
"-lskia_ios",
|
||||
"-lrive",
|
||||
"-lrive_harfbuzz",
|
||||
"-lrive_sheenbidi",
|
||||
"-lrive_yoga",
|
||||
"-lrive_skia_renderer",
|
||||
"-lrive_pls_renderer",
|
||||
"-lrive_cg_renderer",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
|
||||
"-lskia_ios_sim",
|
||||
"-lrive_sim",
|
||||
"-lrive_harfbuzz_sim",
|
||||
"-lrive_sheenbidi_sim",
|
||||
"-lrive_yoga_sim",
|
||||
"-lrive_skia_renderer_sim",
|
||||
"-lrive_pls_renderer_sim",
|
||||
"-lrive_cg_renderer_sim",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=macosx*]" = (
|
||||
"-lskia_macos",
|
||||
"-lrive_macos",
|
||||
"-lrive_harfbuzz_macos",
|
||||
"-lrive_sheenbidi_macos",
|
||||
"-lrive_yoga_macos",
|
||||
"-lrive_skia_renderer_macos",
|
||||
"-lrive_pls_renderer_macos",
|
||||
"-lrive_cg_renderer_macos",
|
||||
);
|
||||
@@ -860,11 +849,6 @@
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = NO;
|
||||
GCC_ENABLE_CPP_RTTI = NO;
|
||||
"HEADER_SEARCH_PATHS[arch=*]" = (
|
||||
dependencies/includes/skia,
|
||||
dependencies/includes/skia/include/core,
|
||||
dependencies/includes/skia/include/effects,
|
||||
dependencies/includes/skia/include/gpu,
|
||||
dependencies/includes/skia/include/config,
|
||||
dependencies/includes/rive/include,
|
||||
dependencies/includes/renderer/include,
|
||||
dependencies/includes/pls/include,
|
||||
@@ -895,32 +879,26 @@
|
||||
"-DYOGA_EXPORT=",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphoneos*]" = (
|
||||
"-lskia_ios",
|
||||
"-lrive",
|
||||
"-lrive_harfbuzz",
|
||||
"-lrive_sheenbidi",
|
||||
"-lrive_yoga",
|
||||
"-lrive_skia_renderer",
|
||||
"-lrive_pls_renderer",
|
||||
"-lrive_cg_renderer",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=iphonesimulator*]" = (
|
||||
"-lskia_ios_sim",
|
||||
"-lrive_sim",
|
||||
"-lrive_harfbuzz_sim",
|
||||
"-lrive_sheenbidi_sim",
|
||||
"-lrive_yoga_sim",
|
||||
"-lrive_skia_renderer_sim",
|
||||
"-lrive_pls_renderer_sim",
|
||||
"-lrive_cg_renderer_sim",
|
||||
);
|
||||
"OTHER_LDFLAGS[sdk=macosx*]" = (
|
||||
"-lskia_macos",
|
||||
"-lrive_macos",
|
||||
"-lrive_harfbuzz_macos",
|
||||
"-lrive_sheenbidi_macos",
|
||||
"-lrive_yoga_macos",
|
||||
"-lrive_skia_renderer_macos",
|
||||
"-lrive_pls_renderer_macos",
|
||||
"-lrive_cg_renderer_macos",
|
||||
);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#define RIVE_NO_PLS
|
||||
@@ -1,3 +0,0 @@
|
||||
// Build a no-op librive_pls_renderer.a so xcode still sees a static library to link with when the
|
||||
// module isn't available.
|
||||
void NullPLS() {}
|
||||
@@ -1,22 +0,0 @@
|
||||
dofile('rive_build_config.lua')
|
||||
|
||||
newoption({ trigger = 'no-rive-decoders', description = '' })
|
||||
|
||||
-- Build a no-op librive_pls_renderer.a so xcode still sees a static library to link with when the
|
||||
-- module isn't available.
|
||||
project('rive_pls_renderer')
|
||||
do
|
||||
kind('StaticLib')
|
||||
files({ 'pls.cpp' })
|
||||
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' },
|
||||
},
|
||||
default = 'system',
|
||||
})
|
||||
@@ -4,10 +4,16 @@
|
||||
|
||||
#import <RenderContextManager.h>
|
||||
#import <RenderContext.h>
|
||||
#import <Rive.h>
|
||||
#import <RivePrivateHeaders.h>
|
||||
#import <RiveFactory.h>
|
||||
|
||||
#import <PlatformCGImage.h>
|
||||
|
||||
#include "utils/auto_cf.hpp"
|
||||
#include "cg_factory.hpp"
|
||||
#include "cg_renderer.hpp"
|
||||
#include "rive/pls/pls.hpp"
|
||||
|
||||
@implementation RenderContext
|
||||
|
||||
@@ -26,151 +32,6 @@
|
||||
|
||||
@end
|
||||
|
||||
// skia throws out a bunch of documentation warnings for us
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdocumentation"
|
||||
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkSurface.h"
|
||||
#include "include/core/SkSurfaceProps.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/mtl/GrMtlBackendContext.h"
|
||||
#include "skia_renderer.hpp"
|
||||
#include "skia_factory.hpp"
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#include "cg_factory.hpp"
|
||||
#include "cg_renderer.hpp"
|
||||
|
||||
#include "Rive.h"
|
||||
#include "RivePrivateHeaders.h"
|
||||
|
||||
@interface SkiaContext : RenderContext
|
||||
- (rive::Factory*)factory;
|
||||
- (rive::Renderer*)beginFrame:(MTKView*)view;
|
||||
@end
|
||||
|
||||
@implementation SkiaContext
|
||||
{
|
||||
sk_sp<GrDirectContext> _graphicsContext;
|
||||
sk_sp<SkSurface> _sksurface;
|
||||
std::unique_ptr<rive::SkiaRenderer> _renderer;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
self.metalDevice = MTLCreateSystemDefaultDevice();
|
||||
if (!self.metalDevice)
|
||||
{
|
||||
NSLog(@"Metal is not supported on this device");
|
||||
return nil;
|
||||
}
|
||||
self.metalQueue = [self.metalDevice newCommandQueue];
|
||||
self.depthStencilPixelFormat = MTLPixelFormatDepth32Float_Stencil8;
|
||||
self.framebufferOnly = NO;
|
||||
|
||||
GrMtlBackendContext metalBackendContext;
|
||||
metalBackendContext.fDevice = sk_ret_cfp((__bridge const void*)self.metalDevice);
|
||||
metalBackendContext.fQueue = sk_ret_cfp((__bridge const void*)self.metalQueue);
|
||||
|
||||
_graphicsContext = GrDirectContext::MakeMetal(metalBackendContext, GrContextOptions());
|
||||
|
||||
if (!_graphicsContext)
|
||||
{
|
||||
NSLog(@"GrDirectContext::MakeMetal failed");
|
||||
return nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (rive::Factory*)factory
|
||||
{
|
||||
struct CGSkiaFactory : public rive::SkiaFactory
|
||||
{
|
||||
std::vector<uint8_t> platformDecode(rive::Span<const uint8_t> span,
|
||||
rive::SkiaFactory::ImageInfo* info) override
|
||||
{
|
||||
std::vector<uint8_t> pixels;
|
||||
PlatformCGImage image;
|
||||
if (PlatformCGImageDecode(span.data(), span.size(), &image))
|
||||
{
|
||||
info->alphaType = image.opaque ? AlphaType::opaque : AlphaType::premul;
|
||||
info->colorType = ColorType::rgba;
|
||||
info->width = image.width;
|
||||
info->height = image.height;
|
||||
info->rowBytes = image.width * 4;
|
||||
pixels = std::move(image.pixels);
|
||||
}
|
||||
return pixels;
|
||||
}
|
||||
};
|
||||
static CGSkiaFactory factory;
|
||||
return &factory;
|
||||
}
|
||||
|
||||
static sk_sp<SkSurface> mtk_view_to_sk_surface(MTKView* mtkView, GrDirectContext* grContext)
|
||||
{
|
||||
if (!grContext || MTLPixelFormatDepth32Float_Stencil8 != [mtkView depthStencilPixelFormat] ||
|
||||
MTLPixelFormatBGRA8Unorm != [mtkView colorPixelFormat])
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
const SkColorType colorType = kBGRA_8888_SkColorType;
|
||||
sk_sp<SkColorSpace> colorSpace = nullptr;
|
||||
const GrSurfaceOrigin origin = kTopLeft_GrSurfaceOrigin;
|
||||
const SkSurfaceProps surfaceProps(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
|
||||
SkPixelGeometry::kUnknown_SkPixelGeometry);
|
||||
int sampleCount = (int)[mtkView sampleCount];
|
||||
return SkSurface::MakeFromMTKView(grContext,
|
||||
(__bridge GrMTLHandle)mtkView,
|
||||
origin,
|
||||
sampleCount,
|
||||
colorType,
|
||||
colorSpace,
|
||||
&surfaceProps);
|
||||
}
|
||||
|
||||
- (rive::Renderer*)beginFrame:(MTKView*)view
|
||||
{
|
||||
_sksurface = mtk_view_to_sk_surface(view, _graphicsContext.get());
|
||||
if (!_sksurface)
|
||||
{
|
||||
NSLog(@"error: failed to create SkSurface from MTKView.");
|
||||
return nil;
|
||||
}
|
||||
auto canvas = _sksurface->getCanvas();
|
||||
canvas->clear(SkColor((0x00000000)));
|
||||
_renderer = std::make_unique<rive::SkiaRenderer>(canvas);
|
||||
return _renderer.get();
|
||||
}
|
||||
|
||||
- (void)endFrame:(MTKView*)view withCompletion:(_Nullable MTLCommandBufferHandler)completionHandler;
|
||||
{
|
||||
if (_sksurface != nullptr)
|
||||
{
|
||||
_sksurface->flushAndSubmit();
|
||||
}
|
||||
_sksurface = nullptr;
|
||||
_renderer = nullptr;
|
||||
|
||||
id<MTLCommandBuffer> commandBuffer = [self.metalQueue commandBuffer];
|
||||
[commandBuffer presentDrawable:view.currentDrawable];
|
||||
if (completionHandler)
|
||||
{
|
||||
[commandBuffer addCompletedHandler:completionHandler];
|
||||
}
|
||||
[commandBuffer commit];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#include "rive/pls/pls.hpp"
|
||||
|
||||
#if !defined(RIVE_NO_PLS)
|
||||
|
||||
#include "rive/pls/metal/pls_render_context_metal_impl.h"
|
||||
#include "rive/pls/pls_image.hpp"
|
||||
#include "rive/pls/pls_renderer.hpp"
|
||||
@@ -313,8 +174,6 @@ static std::unique_ptr<rive::pls::PLSRenderContext> make_pls_context_native(id<M
|
||||
|
||||
@end
|
||||
|
||||
#endif // !defined(RIVE_NO_PLS)
|
||||
|
||||
@interface CGRendererContext : RenderContext
|
||||
- (rive::Renderer*)beginFrame:(MTKView*)view;
|
||||
@end
|
||||
@@ -439,10 +298,7 @@ constexpr static int kBufferRingSize = 3;
|
||||
|
||||
@implementation RenderContextManager
|
||||
{
|
||||
__weak SkiaContext* _skiaContextWeakPtr;
|
||||
#if !defined(RIVE_NO_PLS)
|
||||
__weak RiveRendererContext* _riveRendererContextWeakPtr;
|
||||
#endif
|
||||
__weak CGRendererContext* _cgContextWeakPtr;
|
||||
}
|
||||
|
||||
@@ -459,7 +315,7 @@ constexpr static int kBufferRingSize = 3;
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self.defaultRenderer = RendererType::skiaRenderer;
|
||||
self.defaultRenderer = RendererType::riveRenderer;
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -467,35 +323,16 @@ constexpr static int kBufferRingSize = 3;
|
||||
{
|
||||
switch (self.defaultRenderer)
|
||||
{
|
||||
case RendererType::skiaRenderer:
|
||||
return [self getSkiaContext];
|
||||
case RendererType::riveRenderer:
|
||||
return [self getRiveRendererContext];
|
||||
case RendererType::cgRenderer:
|
||||
return [self getCGRendererContext];
|
||||
}
|
||||
}
|
||||
|
||||
- (RenderContext*)getSkiaContext
|
||||
{
|
||||
// Convert our weak reference to strong before trying to work with it. A weak pointer is liable
|
||||
// to be released out from under us at any moment.
|
||||
// https://stackoverflow.com/questions/15674320/understanding-weak-reference
|
||||
SkiaContext* strongPtr = _skiaContextWeakPtr;
|
||||
if (strongPtr == nil)
|
||||
{
|
||||
strongPtr = [[SkiaContext alloc] init];
|
||||
_skiaContextWeakPtr = strongPtr;
|
||||
}
|
||||
return strongPtr;
|
||||
RIVE_UNREACHABLE();
|
||||
}
|
||||
|
||||
- (RenderContext*)getRiveRendererContext
|
||||
{
|
||||
#if defined(RIVE_NO_PLS)
|
||||
NSLog(@"error: build does not include Rive Renderer");
|
||||
return nil;
|
||||
#else
|
||||
// Convert our weak reference to strong before trying to work with it. A weak pointer is liable
|
||||
// to be released out from under us at any moment.
|
||||
// https://stackoverflow.com/questions/15674320/understanding-weak-reference
|
||||
@@ -506,7 +343,6 @@ constexpr static int kBufferRingSize = 3;
|
||||
_riveRendererContextWeakPtr = strongPtr;
|
||||
}
|
||||
return strongPtr;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (RenderContext*)getCGRendererContext
|
||||
@@ -533,11 +369,6 @@ constexpr static int kBufferRingSize = 3;
|
||||
return [[RiveFactory alloc] initWithFactory:[[self getRiveRendererContext] factory]];
|
||||
}
|
||||
|
||||
- (RiveFactory*)getSkiaFactory
|
||||
{
|
||||
return [[RiveFactory alloc] initWithFactory:[[self getSkiaContext] factory]];
|
||||
}
|
||||
|
||||
- (RiveFactory*)getCGFactory
|
||||
{
|
||||
return [[RiveFactory alloc] initWithFactory:[[self getCGRendererContext] factory]];
|
||||
|
||||
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MTKView;
|
||||
|
||||
/// RenderContext knows how to set up a backend-specific render context (e.g., Skia, CG, Rive, ...),
|
||||
/// RenderContext knows how to set up a backend-specific render context (e.g., CG, Rive, ...),
|
||||
/// and provides a rive::Factory and rive::Renderer for it.
|
||||
@interface RenderContext : NSObject
|
||||
@property(strong) id<MTLDevice> metalDevice;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, RendererType) { skiaRenderer, riveRenderer, cgRenderer };
|
||||
typedef NS_ENUM(NSInteger, RendererType) { riveRenderer, cgRenderer };
|
||||
|
||||
@class RenderContext;
|
||||
@class RiveFactory;
|
||||
@@ -21,7 +21,6 @@ typedef NS_ENUM(NSInteger, RendererType) { skiaRenderer, riveRenderer, cgRendere
|
||||
@property RendererType defaultRenderer;
|
||||
+ (RenderContextManager*)shared;
|
||||
- (RenderContext*)getDefaultContext;
|
||||
- (RenderContext*)getSkiaContext;
|
||||
- (RenderContext*)getRiveRendererContext;
|
||||
- (RenderContext*)getCGRendererContext;
|
||||
// exposing these directly as RenderContext is not exposed
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
# split in two so build.skia can be done by multiple workers.
|
||||
# assumes all skia's have been built
|
||||
|
||||
path=$(readlink -f "${BASH_SOURCE:-$0}")
|
||||
DEV_SCRIPT_DIR=$(dirname $path)
|
||||
@@ -30,7 +28,6 @@ make_dependency_directories() {
|
||||
mkdir -p $DEV_SCRIPT_DIR/../dependencies/debug
|
||||
mkdir -p $DEV_SCRIPT_DIR/../dependencies/release
|
||||
mkdir -p $DEV_SCRIPT_DIR/../dependencies/includes
|
||||
mkdir -p $DEV_SCRIPT_DIR/../dependencies/includes/skia
|
||||
mkdir -p $DEV_SCRIPT_DIR/../dependencies/includes/renderer
|
||||
mkdir -p $DEV_SCRIPT_DIR/../dependencies/includes/rive
|
||||
mkdir -p $DEV_SCRIPT_DIR/../dependencies/includes/cg_renderer
|
||||
@@ -38,8 +35,8 @@ make_dependency_directories() {
|
||||
}
|
||||
|
||||
build_runtime() {
|
||||
# Build rive_skia_renderer renderer (also builds the runtime).
|
||||
pushd $RIVE_RUNTIME_DIR/skia/renderer
|
||||
# Build the rive runtime.
|
||||
pushd $RIVE_RUNTIME_DIR
|
||||
./build.sh -p ios clean
|
||||
./build.sh -p ios $1
|
||||
popd
|
||||
@@ -47,8 +44,6 @@ build_runtime() {
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/ios/cache/bin/$1/librive_harfbuzz.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_harfbuzz.a
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/ios/cache/bin/$1/librive_sheenbidi.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_sheenbidi.a
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/ios/cache/bin/$1/librive_yoga.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_yoga.a
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/renderer/build/ios/bin/$1/librive_skia_renderer.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_skia_renderer.a
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/renderer/include $DEV_SCRIPT_DIR/../dependencies/includes/renderer
|
||||
cp -r $RIVE_RUNTIME_DIR/include $DEV_SCRIPT_DIR/../dependencies/includes/rive
|
||||
|
||||
# Build rive_cg_renderer.
|
||||
@@ -72,8 +67,8 @@ build_runtime() {
|
||||
}
|
||||
|
||||
build_runtime_sim() {
|
||||
# NOTE: we do not currently use debug, so lets not build debug
|
||||
pushd $RIVE_RUNTIME_DIR/skia/renderer
|
||||
# Build the rive runtime.
|
||||
pushd $RIVE_RUNTIME_DIR
|
||||
./build.sh -p ios_sim clean
|
||||
./build.sh -p ios_sim $1
|
||||
popd
|
||||
@@ -81,8 +76,6 @@ build_runtime_sim() {
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/ios_sim/cache/bin/$1/librive_harfbuzz.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_harfbuzz_sim.a
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/ios_sim/cache/bin/$1/librive_sheenbidi.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_sheenbidi_sim.a
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/ios_sim/cache/bin/$1/librive_yoga.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_yoga_sim.a
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/renderer/build/ios_sim/bin/$1/librive_skia_renderer.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_skia_renderer_sim.a
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/renderer/include $DEV_SCRIPT_DIR/../dependencies/includes/renderer
|
||||
cp -r $RIVE_RUNTIME_DIR/include $DEV_SCRIPT_DIR/../dependencies/includes/rive
|
||||
|
||||
# Build rive_cg_renderer.
|
||||
@@ -107,8 +100,8 @@ build_runtime_sim() {
|
||||
}
|
||||
|
||||
build_runtime_macosx() {
|
||||
# NOTE: we do not currently use debug, so lets not build debug
|
||||
pushd $RIVE_RUNTIME_DIR/skia/renderer
|
||||
# Build the rive runtime.
|
||||
pushd $RIVE_RUNTIME_DIR
|
||||
./build.sh -p macosx clean
|
||||
./build.sh -p macosx $1
|
||||
popd
|
||||
@@ -116,8 +109,6 @@ build_runtime_macosx() {
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/macosx/cache/bin/$1/librive_harfbuzz.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_harfbuzz_macos.a
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/macosx/cache/bin/$1/librive_sheenbidi.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_sheenbidi_macos.a
|
||||
cp -r $RIVE_RUNTIME_DIR/dependencies/macosx/cache/bin/$1/librive_yoga.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_yoga_macos.a
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/renderer/build/macosx/bin/$1/librive_skia_renderer.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_skia_renderer_macos.a
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/renderer/include $DEV_SCRIPT_DIR/../dependencies/includes/renderer
|
||||
cp -r $RIVE_RUNTIME_DIR/include $DEV_SCRIPT_DIR/../dependencies/includes/rive
|
||||
|
||||
# Build rive_cg_renderer.
|
||||
@@ -140,25 +131,6 @@ build_runtime_macosx() {
|
||||
cp -r $RIVE_PLS_DIR/include $DEV_SCRIPT_DIR/../dependencies/includes/pls
|
||||
}
|
||||
|
||||
finalize_skia() {
|
||||
# COMBINE SKIA
|
||||
# make fat library, note that the ios64 library is already fat with arm64 and arm64e so we don't specify arch there.
|
||||
|
||||
pwd
|
||||
pushd $RIVE_RUNTIME_DIR/skia/dependencies/skia
|
||||
xcrun -sdk macosx lipo -create -arch x86_64 out/macosx/x64/libskia.a -arch arm64 out/macosx/arm64/libskia.a -output out/macosx/libskia_macos.a
|
||||
xcrun -sdk iphoneos lipo -create -arch armv7 out/ios/arm/libskia.a out/ios/arm64/libskia.a -output out/ios/libskia_ios.a
|
||||
xcrun -sdk iphoneos lipo -create -arch x86_64 out/ios/x64/libskia.a -arch i386 out/ios/x86/libskia.a out/ios/iossim_arm64/libskia.a -output out/ios/libskia_ios_sim.a
|
||||
popd
|
||||
|
||||
# copy skia outputs from ld'in skia!
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/dependencies/skia/out/ios/libskia_ios.a $DEV_SCRIPT_DIR/../dependencies
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/dependencies/skia/out/ios/libskia_ios_sim.a $DEV_SCRIPT_DIR/../dependencies
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/dependencies/skia/out/macosx/libskia_macos.a $DEV_SCRIPT_DIR/../dependencies
|
||||
# note we purposefully put the skia include folder into dependencies/includes/skia, skia includes headers from include/core/name.h
|
||||
cp -r $RIVE_RUNTIME_DIR/skia/dependencies/skia/include $DEV_SCRIPT_DIR/../dependencies/includes/skia
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo "USAGE: $0 <all|ios|ios_sim|macosx> <debug|release>"
|
||||
exit 1
|
||||
@@ -171,7 +143,6 @@ fi
|
||||
case $1 in
|
||||
all)
|
||||
make_dependency_directories
|
||||
finalize_skia
|
||||
build_runtime debug
|
||||
build_runtime release
|
||||
build_runtime_sim debug
|
||||
@@ -186,7 +157,6 @@ macosx)
|
||||
case $2 in
|
||||
release | debug)
|
||||
make_dependency_directories
|
||||
finalize_skia
|
||||
build_runtime_macosx $2
|
||||
;;
|
||||
*)
|
||||
@@ -201,7 +171,6 @@ ios)
|
||||
case $2 in
|
||||
release | debug)
|
||||
make_dependency_directories
|
||||
finalize_skia
|
||||
build_runtime $2
|
||||
;;
|
||||
*)
|
||||
@@ -216,7 +185,6 @@ ios_sim)
|
||||
case $2 in
|
||||
release | debug)
|
||||
make_dependency_directories
|
||||
finalize_skia
|
||||
build_runtime_sim $2
|
||||
# TODO:
|
||||
# to build for the example you need debug, but to profile you need release.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
path=$(readlink -f "${BASH_SOURCE:-$0}")
|
||||
DEV_SCRIPT_DIR=$(dirname $path)
|
||||
|
||||
$DEV_SCRIPT_DIR/build.skia.sh -a x86
|
||||
$DEV_SCRIPT_DIR/build.skia.sh -a x64
|
||||
$DEV_SCRIPT_DIR/build.skia.sh -a arm
|
||||
$DEV_SCRIPT_DIR/build.skia.sh -a arm64
|
||||
$DEV_SCRIPT_DIR/build.skia.sh -a iossim_arm64
|
||||
$DEV_SCRIPT_DIR/build.skia.macos.sh -a arm64
|
||||
$DEV_SCRIPT_DIR/build.skia.macos.sh -a x64
|
||||
|
||||
$DEV_SCRIPT_DIR/build.rive.sh $@
|
||||
1
scripts/build.sh
Symbolic link
1
scripts/build.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
build.rive.sh
|
||||
Reference in New Issue
Block a user