Moving wasm to separate repo

This commit is contained in:
Matt Sullivan
2020-08-16 18:20:11 -07:00
parent 077a1a6cad
commit c4c3670c3f
196 changed files with 211 additions and 929 deletions

6
.gitignore vendored
View File

@@ -50,15 +50,13 @@ pubspec.lock
*.DS_Store
# Generated docs
rive/docs
docs
# Analysis results
dev/analysis_report
# Build directories
wasm/build
rive/build/bin
wasm/custom_emcc
build/bin
# Skia dependencies
skia/dependencies/skia

172
build/_premake5.lua Normal file
View File

@@ -0,0 +1,172 @@
-- require "./premake-emscripten/emscripten"
-- local emcc_tools = {
-- cc = "emcc",
-- cxx = "emcc", -- cxx = "em++",
-- ar = "emar"
-- }
-- local clang = premake.tools.clang
-- premake.tools.emcc = {
-- gettoolname = function(cfg, tool)
-- return emcc_tools[tool]
-- end,
-- getdefines = clang.getdefines,
-- getundefines = clang.getundefines,
-- getincludedirs = clang.getincludedirs,
-- getforceincludes = clang.getforceincludes,
-- getlocalflags = clang.getlocalflags,
-- getcxxflags = function(cfg)
-- local flags = clang.getcxxflags(cfg)
-- print('--getcxxflags:')
-- table.foreachi(cfg.flags, function(value)
-- print('cfg value ' .. value)
-- end)
-- table.insertflat(flags, '-fno-rtti')
-- table.foreachi(flags, function(value)
-- print('cxx flag ' .. value)
-- end)
-- return flags
-- end,
-- getcppflags = clang.getcppflags,
-- getcflags = clang.getcflags,
-- getlinks = clang.getlinks,
-- getLibraryDirectories = clang.getLibraryDirectories,
-- getrunpathdirs = clang.getrunpathdirs,
-- getldflags = function(cfg)
-- local flags = clang.getldflags(cfg)
-- table.insertflat(flags, "-s EXPORT_NAME=\"RiveWasmTest\"")
-- return flags
-- end,
-- getmakesettings = clang.getmakesettings,
-- }
-- function emcc.gettoolname(cfg, tool)
-- return emcc_tools[tool];
-- end
-- premake.tools.emcc.gettoolname = gettoolname
-- function premake.tools.emcc.gettoolname(cfg, tool)
-- return emcc_tools[tool]
-- end
workspace "rive"
configurations { "debug", "release" }
project "rive"
kind "StaticLib"
language "C++"
cppdialect "C++17"
targetdir "bin/%{cfg.buildcfg}"
objdir "obj/%{cfg.buildcfg}"
includedirs { "../include" }
files { "../src/**.cpp" }
filter "configurations:debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:release"
defines { "RELEASE" }
optimize "On"
-- project "rive-wasm-runtimme"
-- rules { "MyWasmRule" }
-- kind "Utility"
-- rule "MyWasmRule"
-- display "My custom wasm compiler"
-- fileextension ".cpp"
-- buildmessage "Compiling to WASM"
-- buildcommands 'emcc -O3 --bind -o wasm_test.js -s FORCE_FILESYSTEM=0 -s MODULARIZE=1 -s NO_EXIT_RUNTIME=1 -s STRICT=1 -s WARN_UNALIGNED=1 -s ALLOW_MEMORY_GROWTH=1 -s DISABLE_EXCEPTION_CATCHING=1 -s WASM=1 -s EXPORT_NAME="WasmTest" -DSINGLE -DANSI_DECLARATORS -DTRILIBRARY -Wno-c++17-extensions -I../include --no-entry ../src/*/*.cpp'
-- buildcommands 'echo YOOOOOOOOOOOOOOO'
-- buildmessage 'Compiling %(Filename) with MyCustomCC'
-- buildcommands 'MyCustomCC.exe -c "%(FullPath)" -o "%(IntDir)/%(Filename).obj"'
-- buildoutputs '%(IntDir)/%(Filename).obj"'
-- project "rive-by-rules"
-- -- rules { "MyWasmRule" }
-- -- kind "None"
-- filter 'files:**.lua'
-- -- A message to display while this build step is running (optional)
-- buildmessage 'Compiling %{file.relpath}'
-- -- One or more commands to run (required)
-- buildcommands {
-- 'luac -o "%{cfg.objdir}/%{file.basename}.out" "%{file.relpath}"'
-- }
-- -- One or more outputs resulting from the build (required)
-- buildoutputs { '%{cfg.objdir}/%{file.basename}.c' }
-- -- One or more additional dependencies for this build command (optional)
-- buildinputs { 'path/to/file1.ext', 'path/to/file2.ext' }
-- project "rive.js"
-- kind "None"
-- toolset "emcc"
-- language "C++"
-- cppdialect "C++17"
-- buildoptions {
-- "--bind",
-- "-s FORCE_FILESYSTEM=0",
-- "-s MODULARIZE=1",
-- "-s NO_EXIT_RUNTIME=1",
-- "-s STRICT=1",
-- "-s WARN_UNALIGNED=1",
-- "-s ALLOW_MEMORY_GROWTH=1",
-- "-s DISABLE_EXCEPTION_CATCHING=1",
-- "-s WASM=1",
-- "-s EXPORT_NAME=\"RiveWasmTest\"",
-- "-DSINGLE",
-- "-DANSI_DECLARATORS",
-- "-DTRILIBRARY",
-- "-Wno-c++17-extensions",
-- "--no-entry"
-- }
-- targetdir "bin/%{cfg.buildcfg}"
-- objdir "obj/%{cfg.buildcfg}"
-- includedirs { "../include" }
-- files { "../src/**.cpp" }
-- postbuildcommands { "echo Running postbuild" }
-- filter "configurations:debug"
-- defines { "DEBUG" }
-- symbols "On"
-- filter "configurations:release"
-- defines { "RELEASE" }
-- optimize "On"
-- Clean Function --
newaction {
trigger = "clean",
description = "clean the build",
execute = function ()
print("clean the build...")
os.rmdir("./bin")
os.rmdir("./obj")
os.remove("Makefile")
-- no wildcards in os.remove, so use shell
os.execute("rm *.make")
print("build cleaned")
end
}

View File

@@ -1,9 +1,25 @@
#!/bin/bash
cd test
# premake5 clean || exit 1
premake5 gmake || exit 1
pushd test &>/dev/null
OPTION=$1
if [ "$OPTION" = "help" ]
then
echo test.sh - run the tests
echo test.sh clean - clean and run the tests
exit
elif [ "$OPTION" = "clean" ]
then
echo Cleaning project ...
premake5 clean || exit 1
shift
fi
premake5 gmake2 || exit 1
make -j7 || exit 1
for file in ./build/bin/debug/*; do
echo testing $file
$file "$1"
done
popd &>/dev/null

View File

@@ -34,12 +34,12 @@ buildoptions {
includedirs {
"./include",
"../../rive/include"
"../../include"
}
files {
"../../rive/src/**.cpp", -- the Rive runtime source
"../../rive/test/**.cpp" -- the tests
"../../src/**.cpp", -- the Rive runtime source
"../../test/**.cpp" -- the tests
}

Some files were not shown because too many files have changed in this diff Show More