Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There have been merge conflicts #367

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ jobs:
run: |
cd dev/test
C:\premake5.exe --scripts=..\..\build vs2022
cd out/debug
MSBuild rive.sln
build\bin\debug\tests.exe
tests.exe

build-macos:
runs-on: macOS-latest
Expand Down
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
34fff8ea44e3d30fb68912af71d35a808a2f8332
6059f744d9225938a1463ab66c965ecba7ec0dd3
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,19 @@ rive-cpp uses clang-format, you can install it with brew on MacOS: ```brew insta

## Memory Checks
Note that if you're on MacOS you'll want to install valgrind, which is somewhat complicated these days. This is the easiest solution (please PR a better one when it becomes available).

```
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
```

You can now run the all the tests through valgrind by running ```test.sh memory```.

## Disassembly Explorer
If you want to examine the generated assembly code per cpp file, install [Disassembly Explorer](https://marketplace.visualstudio.com/items?itemName=dseight.disasexpl) in VSCode.

A ```disassemble``` task is provided to compile and preview the generated assembly. You can reach it via the Tasks: Run Task command palette or you can bind it to a shortcut by editing your VSCode keybindings.json:

```
[
{
Expand All @@ -75,4 +78,4 @@ A ```disassemble``` task is provided to compile and preview the generated assemb
"args": "disassemble"
}
]
```
```
28 changes: 28 additions & 0 deletions dependencies/gen_harfbuzz_renames/gen_header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'dart:collection';
import 'dart:io';

var skip = HashSet.from(
[
'hb_color_get_alpha',
'hb_color_get_green',
'hb_color_get_blue',
'hb_color_get_red',
'hb_glyph_info_get_glyph_flags',
],
);

void main() {
var header = StringBuffer();
header.writeln('// clang-format off');
var contents = File('harfbuzz_names.txt').readAsStringSync();
RegExp exp = RegExp(r'\s_(hb_([a-zA-Z0-9_]*))$', multiLine: true);
Iterable<RegExpMatch> matches = exp.allMatches(contents);
for (final m in matches) {
var symbolName = m[1];
if (skip.contains(symbolName)) {
continue;
}
header.writeln('#define $symbolName rive_$symbolName');
}
File('../rive_harfbuzz_renames.h').writeAsStringSync(header.toString());
}
56 changes: 56 additions & 0 deletions dependencies/gen_harfbuzz_renames/gen_renames.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash
set -e

# This script should be called on a Mac!

if [[ ! -f "dependencies/bin/premake5" ]]; then
mkdir -p dependencies/bin
pushd dependencies
# v5.0.0-beta2 doesn't support apple silicon properly, update the branch
# once a stable one is avaialble that supports it
git clone --depth 1 --branch master https://github.com/premake/premake-core.git
pushd premake-core
if [[ $LOCAL_ARCH == "arm64" ]]; then
PREMAKE_MAKE_ARCH=ARM
else
PREMAKE_MAKE_ARCH=x86
fi
make -f Bootstrap.mak osx PLATFORM=$PREMAKE_MAKE_ARCH
cp bin/release/* ../bin
popd
popd
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
mkdir -p out_with_renames

pushd ../../../
PACKAGES=$PWD
popd
export PREMAKE_PATH="dependencies/export-compile-commands":"$PACKAGES/runtime_unity/native_plugin/platform":"$PACKAGES/runtime/build":"$PREMAKE_PATH"

$PREMAKE gmake2 --file=../premake5_harfbuzz_v2.lua --out=out --no-harfbuzz-renames
pushd out
make -j$(($(sysctl -n hw.physicalcpu) + 1))
popd

nm out/librive_harfbuzz.a --demangle &>harfbuzz_names.txt

dart gen_header.dart

# make with renames just to examine the exported symbols...
$PREMAKE gmake2 --file=../premake5_harfbuzz_v2.lua --out=out_with_renames
pushd out_with_renames
make -j$(($(sysctl -n hw.physicalcpu) + 1))
popd

nm out_with_renames/librive_harfbuzz.a --demangle &>harfbuzz_renames.txt
11 changes: 11 additions & 0 deletions dependencies/premake5_harfbuzz_v2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ dofile('rive_build_config.lua')
local dependency = require('dependency')
harfbuzz = dependency.github('harfbuzz/harfbuzz', '6.0.0')

newoption({
trigger = 'no-harfbuzz-renames',
description = 'don\'t rename harfbuzz symbols',
})

project('rive_harfbuzz')
do
kind('StaticLib')
Expand Down Expand Up @@ -232,4 +237,10 @@ do
do
optimize('Size')
end

filter({ 'options:not no-harfbuzz-renames' })
do
includedirs({ './' })
forceincludes({ 'rive_harfbuzz_renames.h' })
end
end
Loading
Loading