Removing some unnecessary commits from this PR.
Adding newline to fix diff.
Update tests.yml
Update tests.yml
See rive.make
Attempt using a pre-generate makefile.
Update tests.yml
Remove windows make
One more windows test.
Make with verbose.
Trying verbose ar.exe
Retry
Make without parallel
More debug
Trying to fix this wsl issue
Seeing which version of make we have on github actions
Use an instance of the artboard for SMI test
Attempt wsl
Attempt wsl
install unzip
Again..
try to get unzip
add to path instead of github_path with wsl
just move premake to bin
use correct filename for premake
use crlf
Back to crlf
space
Attempt using just powershell
premake with powershell
call msbuild
add msbuild to path
Proper msbuild config
more args
Build rive tests
use right solution name
Use any cpu for tests
remove the config and platform
Update tests for windows
LS right dir
look for exe
Tests!
Add “b” so windows reads in binary mode
More “rb” fixes
Final “rb” fix!
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 23d2b92..c3001c1 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -13,7 +13,6 @@
steps:
- uses: actions/checkout@v2
-
- name: Install
run: |
wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha16/premake-5.0.0-alpha16-linux.tar.gz
@@ -23,6 +22,7 @@
- name: Build
run: |
+ ./build.sh clean
./build.sh
./build.sh release
@@ -35,35 +35,31 @@
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
+ - name: Add msbuild to PATH
+ uses: microsoft/setup-msbuild@v1.1
- # Using wget from powershell take no time (using choco to install it takes 1-2 minutes)
- - name: Download Premake5
+ - name: Download Premake
shell: powershell
run: |
echo GITHUB_WORKSPACE is ${{ github.workspace }}
- wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha16/premake-5.0.0-alpha16-windows.zip -OutFile ${{ github.workspace }}/premake-5.0.0-alpha16-windows.zip
+ wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-windows.zip -OutFile ${{ github.workspace }}\premake-5.0.0-beta1-windows.zip
+ Expand-Archive -LiteralPath ${{ github.workspace }}\premake-5.0.0-beta1-windows.zip -DestinationPath C:\
- - name: Install
- shell: bash # mingw
+ - name: Build rive.lib
+ shell: powershell
run: |
- unzip premake-5.0.0-alpha16-windows.zip
- chmod a+x premake5.exe
- mkdir -p $HOME/.local/bin
- mv premake5.exe $HOME/.local/bin
- echo "$HOME/.local/bin" >> $GITHUB_PATH
+ cd build
+ C:\premake5.exe vs2022
+ MSBuild rive.sln /property:Configuration=Debug /property:Platform=x64
+ cd ..
- - name: Build
- shell: bash #mingw
+ - name: Run rive tests
+ shell: powershell
run: |
- ./build.sh
- ./build.sh release
-
-
- # - name: Tests
- # shell: bash
- # run: |
- # cd dev
- # ./test.sh
+ cd dev/test
+ C:\premake5.exe vs2022
+ MSBuild rive_tests.sln
+ build\bin\debug\tests.exe
build-macos:
runs-on: macOS-latest
diff --git a/build.sh b/build.sh
index 50eb11c..dfc3e67 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-set -e
+set -e
pushd build &>/dev/null
diff --git a/dev/test/premake5.lua b/dev/test/premake5.lua
index 5fcf6b5..c0d716b 100644
--- a/dev/test/premake5.lua
+++ b/dev/test/premake5.lua
@@ -13,6 +13,62 @@
end
}
+
+WINDOWS_CLANG_CL_SUPPRESSED_WARNINGS = {
+ "-Wno-c++98-compat",
+ "-Wno-c++98-compat-pedantic",
+ "-Wno-reserved-macro-identifier",
+ "-Wno-newline-eof",
+ "-Wno-old-style-cast",
+ "-Wno-unused-parameter",
+ "-Wno-float-equal",
+ "-Wno-implicit-float-conversion",
+ "-Wno-shadow",
+ "-Wno-sign-conversion",
+ "-Wno-inconsistent-missing-destructor-override",
+ "-Wno-nested-anon-types",
+ "-Wno-suggest-destructor-override",
+ "-Wno-non-virtual-dtor",
+ "-Wno-unknown-argument",
+ "-Wno-gnu-anonymous-struct",
+ "-Wno-extra-semi",
+ "-Wno-cast-qual",
+ "-Wno-ignored-qualifiers",
+ "-Wno-double-promotion",
+ "-Wno-tautological-unsigned-zero-compare",
+ "-Wno-unreachable-code-break",
+ "-Wno-global-constructors",
+ "-Wno-switch-enum",
+ "-Wno-shorten-64-to-32",
+ "-Wno-missing-prototypes",
+ "-Wno-implicit-int-conversion",
+ "-Wno-unused-macros",
+ "-Wno-deprecated-copy-with-user-provided-dtor",
+ "-Wno-missing-variable-declarations",
+ "-Wno-ctad-maybe-unsupported",
+ "-Wno-vla-extension",
+ "-Wno-float-conversion",
+ "-Wno-gnu-zero-variadic-macro-arguments",
+ "-Wno-undef",
+ "-Wno-documentation",
+ "-Wno-documentation-pedantic",
+ "-Wno-documentation-unknown-command",
+ "-Wno-suggest-override",
+ "-Wno-unused-exception-parameter",
+ "-Wno-cast-align",
+ "-Wno-deprecated-declarations",
+ "-Wno-shadow-field",
+ "-Wno-nonportable-system-include-path",
+ "-Wno-reserved-identifier",
+ "-Wno-thread-safety-negative",
+ "-Wno-exit-time-destructors",
+ "-Wno-unreachable-code",
+ "-Wno-zero-as-null-pointer-constant",
+ "-Wno-pedantic",
+ "-Wno-sign-compare",
+}
+
+
workspace "rive_tests"
configurations {"debug"}
@@ -20,6 +76,7 @@
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
+toolset "clang"
targetdir "build/bin/%{cfg.buildcfg}"
objdir "build/obj/%{cfg.buildcfg}"
@@ -37,137 +94,7 @@
defines {"DEBUG"}
symbols "On"
---[[
-
--- Recursively iterate through all files in a dir
-function dirtree(dir)
-
- assert(dir and dir ~= "", "Provide a directory")
- if string.sub(dir, -1) == "/" then
- dir = string.sub(dir, 1, -2)
- end
-
- local function yieldtree(dir)
- for entry in lfs.dir(dir) do
- if entry ~= "." and entry ~= ".." then
- entry = dir .. "/" .. entry
- local attr = lfs.attributes(entry)
- coroutine.yield(entry, attr)
- if attr.mode == "directory" then
- yieldtree(entry)
- end
- end
- end
- end
- return coroutine.wrap(function()
- yieldtree(dir)
- end)
-end
-
--- Get the file extension from a string
-function getFileExtension(path)
- return path:match("^.+(%..+)$")
-end
-
--- Get file paths to all files ending in the given file extension in a given dir
--- This will recurse through subdirs
-function getFilesByExtension(extension, dir)
- local function yieldfile(dir)
- for filename, attr in dirtree(dir) do
- if attr.mode == "file" and getFileExtension(filename) == extension then
- coroutine.yield(filename)
- end
- end
- end
- return coroutine.wrap(function()
- yieldfile(dir)
- end)
-end
-
--- Build test executable for a cpp file
-local function test(filepath)
-
- local filename = filepath:match("([^/]+)$")
- local projectname = filename:match("^[^%.]+")
- -- print("Filepath: " .. filepath)
- -- print("Filename: " .. filename)
- -- print("Projectname: " .. projectname)
-
- project(projectname)
- kind "ConsoleApp"
- language "C++"
- cppdialect "C++17"
- targetdir "build/bin/%{cfg.buildcfg}"
- objdir "build/obj/%{cfg.buildcfg}"
-
- buildoptions {
- "-Wall",
- "-fno-exceptions",
- "-fno-rtti"
- }
-
- includedirs {
- "./include",
- "../../rive/include"
- }
-
- files {
- "../../rive/src/**.cpp",
- filepath
- }
-
- filter "configurations:debug"
- defines { "DEBUG" }
- symbols "On"
-end
-
--- Build all cpp test files in Rive's test directory
-for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
- test(cppFile)
-end
-
--- Build test executable for a cpp file and link to the precompiled rive lib
-local function test_precompiled(filepath)
-
- local filename = filepath:match("([^/]+)$") .. "_linked"
- local projectname = filename:match("^[^%.]+") .. "_linked"
- -- print("Filepath: " .. filepath)
- -- print("Filename: " .. filename)
- -- print("Projectname: " .. projectname)
-
- project(projectname)
- kind "ConsoleApp"
- language "C++"
- cppdialect "C++17"
- targetdir "build/bin/%{cfg.buildcfg}"
- objdir "build/obj/%{cfg.buildcfg}"
-
- buildoptions {
- "-Wall",
- "-fno-exceptions",
- "-fno-rtti"
- }
-
- includedirs {
- "./include",
- "../../rive/include"
- }
-
- files { filepath }
-
- links
- {
- "../../rive/build/bin/debug/librive.a"
- }
-
- filter "configurations:debug"
- defines { "DEBUG" }
- symbols "On"
-end
-
--- Build all cpp test files in Rive's test directory
-for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
- test_precompiled(cppFile)
-end
-
---]]
+filter "system:windows"
+ architecture "x64"
+ defines {"_USE_MATH_DEFINES"}
+ buildoptions {WINDOWS_CLANG_CL_SUPPRESSED_WARNINGS}
\ No newline at end of file
diff --git a/include/rive/relative_local_asset_resolver.hpp b/include/rive/relative_local_asset_resolver.hpp
index 598a5b7..63a7edb 100644
--- a/include/rive/relative_local_asset_resolver.hpp
+++ b/include/rive/relative_local_asset_resolver.hpp
@@ -25,7 +25,7 @@
void loadContents(FileAsset& asset) override {
std::string filename = m_Path + asset.uniqueFilename();
- FILE* fp = fopen(filename.c_str(), "r");
+ FILE* fp = fopen(filename.c_str(), "rb");
fseek(fp, 0, SEEK_END);
const size_t length = ftell(fp);
diff --git a/skia/dependencies/clean_dependencies.sh b/skia/dependencies/clean_dependencies.sh
deleted file mode 100755
index bc58623..0000000
--- a/skia/dependencies/clean_dependencies.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-rm -fR ./gl3w
-rm -fR ./glfw
-rm -fR ./glfw_build
-rm -fR ./imgui
-rm -fR ./skia
-rm -fR ./skia_rive_optimized
\ No newline at end of file
diff --git a/skia/dependencies/make_skia.sh b/skia/dependencies/make_skia.sh
index e634644..1dd2c01 100755
--- a/skia/dependencies/make_skia.sh
+++ b/skia/dependencies/make_skia.sh
@@ -4,9 +4,8 @@
./get_skia.sh
-build_skia_rive_optimized() {
# use Rive optimized/stripped Skia for iOS static libs.
-pushd skia_rive_optimized
+cd skia_rive_optimized
python tools/git-sync-deps
bin/gn gen out/ios64 --type=static_library --args=" \
@@ -206,55 +205,11 @@
xcrun -sdk iphoneos lipo -create -arch armv7 out/ios32/libskia.a out/ios64/libskia.a -output out/libskia_ios.a
xcrun -sdk iphoneos lipo -create -arch x86_64 out/iossim_x64/libskia.a -arch i386 out/iossim_x86/libskia.a out/iossim_arm64/libskia.a -output out/libskia_ios_sim.a
-popd
-}
-
-build_skia() {
# build regular/full skia
-pushd skia
-python tools/git-sync-deps
+cd ../skia
# build static for host
-bin/gn gen out/static/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=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_libjpeg_turbo_encode=false \
- skia_use_libjpeg_turbo_decode=false \
- skia_use_libwebp_encode=false \
- skia_use_libwebp_decode=false \
- skia_use_lua=false \
- skia_use_piex=false \
- skia_use_vulkan=false \
- skia_use_metal=false \
- 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 \
- skia_enable_skgpu_v2=false \
- "
-ninja -C out/static/debug
-du -hs out/static/debug/libskia.a
-
-bin/gn gen out/static/release --type=static_library --args=" \
+bin/gn gen out/static --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 \
@@ -290,10 +245,7 @@
skia_enable_tools=false \
skia_enable_skgpu_v2=false \
"
-ninja -C out/static/release
-du -hs out/static/release/libskia.a
-popd
-}
+ninja -C out/static
+du -hs out/static/libskia.a
-build_skia_rive_optimized
-build_skia
+cd ..
\ No newline at end of file
diff --git a/skia/viewer/build/premake5.lua b/skia/viewer/build/premake5.lua
index e8e08aa..1442293 100644
--- a/skia/viewer/build/premake5.lua
+++ b/skia/viewer/build/premake5.lua
@@ -23,7 +23,7 @@
links {"Cocoa.framework", "IOKit.framework", "CoreVideo.framework", "rive", "skia", "rive_skia_renderer", "glfw3"}
libdirs {"../../../build/%{cfg.system}/bin/%{cfg.buildcfg}", "../../dependencies/glfw_build/src",
- "../../dependencies/skia/out/static/%{cfg.buildcfg}", "../../renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}"}
+ "../../dependencies/skia/out/static", "../../renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}"}
files {"../src/**.cpp", "../../dependencies/gl3w/build/src/gl3w.c",
"../../dependencies/imgui/backends/imgui_impl_glfw.cpp",
@@ -31,19 +31,16 @@
"../../dependencies/imgui/imgui.cpp", "../../dependencies/imgui/imgui_tables.cpp",
"../../dependencies/imgui/imgui_draw.cpp"}
-buildoptions {"-Wall", "-fno-exceptions", "-fno-rtti"}
-
+buildoptions {"-Wall", "-fno-exceptions", "-fno-rtti", "-flto=full", "-g"}
filter "configurations:debug"
defines {"DEBUG"}
symbols "On"
-buildoptions {"-g"}
filter "configurations:release"
defines {"RELEASE"}
defines {"NDEBUG"}
optimize "On"
-buildoptions {"-flto=full"}
-- Clean Function --
newaction {
diff --git a/src/animation/state_machine_instance.cpp b/src/animation/state_machine_instance.cpp
index 5831ef2..2a5a80b 100644
--- a/src/animation/state_machine_instance.cpp
+++ b/src/animation/state_machine_instance.cpp
@@ -332,7 +332,7 @@
HitShape* hitShape;
auto itr = hitShapeLookup.find(id);
if (itr == hitShapeLookup.end()) {
- auto shape = artboard->resolve(id);
+ auto shape = m_ArtboardInstance->resolve(id);
if (shape != nullptr && shape->is<Shape>()) {
hitShapeLookup[id] = hitShape = new HitShape(shape->as<Shape>());
m_HitShapes.push_back(hitShape);
diff --git a/test/state_machine_event_test.cpp b/test/state_machine_event_test.cpp
index 5dbdffa..a849048 100644
--- a/test/state_machine_event_test.cpp
+++ b/test/state_machine_event_test.cpp
@@ -63,7 +63,7 @@
TEST_CASE("hit testing via a state machine works", "[file]") {
RiveFileReader reader("../../test/assets/bullet_man.riv");
- auto artboard = reader.file()->artboard("Bullet Man");
+ auto artboard = reader.file()->artboard("Bullet Man")->instance();
REQUIRE(artboard != nullptr);
REQUIRE(artboard->stateMachineCount() == 1);