Skip to content

Commit

Permalink
Lua formatter
Browse files Browse the repository at this point in the history
Format all our lua scripts with Stylua

https://www.notion.so/rive-app/Formatters-be8845abbca34e39b5d4c212b2437b3f?pvs=4

Diffs=
858215cc4 Lua formatter (#6525)
b8875ef31 Reorganize premake (#6522)
fddb050ca Build Android deps with audio (#6515)
5cfc226f2 PLS external framebuffer optimizations (#6516)
2018358a6 Properly generate an android_ndk toolset (#6506)

Co-authored-by: Luigi Rosso <[email protected]>
  • Loading branch information
luigi-rosso and luigi-rosso committed Jan 26, 2024
1 parent ff3dcae commit e43e189
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
73bf11db39230e7a6d302da9a27414d35bcbee99
858215cc481f86081b04390b67304f932fc45d10
255 changes: 110 additions & 145 deletions premake5_rive_plugin.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
local dependency = require 'dependency'
local dependency = require('dependency')

harfbuzz = dependency.github('harfbuzz/harfbuzz', '858570b1d9912a1b746ab39fbe62a646c4f7a5b1')
sheenbidi = dependency.github('Tehreer/SheenBidi', 'v2.6')

workspace 'rive_text'
configurations {'debug', 'release'}
workspace('rive_text')
configurations({ 'debug', 'release' })

source = os.isdir('../../packages/runtime') and '../../packages/runtime' or 'macos/rive-cpp'

project 'rive_sheenbidi'
project('rive_sheenbidi')
do
kind 'StaticLib'
language 'C'
toolset 'clang'
targetdir 'shared_lib/build/bin/%{cfg.buildcfg}/'
objdir 'shared_lib/build/obj/%{cfg.buildcfg}/'
kind('StaticLib')
language('C')
toolset('clang')
targetdir('shared_lib/build/bin/%{cfg.buildcfg}/')
objdir('shared_lib/build/obj/%{cfg.buildcfg}/')

includedirs {
sheenbidi .. '/Headers'
}
includedirs({ sheenbidi .. '/Headers' })

filter {'options:arch=wasm'}
filter({ 'options:arch=wasm' })
do
targetdir 'wasm/build/bin/%{cfg.buildcfg}/'
objdir 'wasm/build/obj/%{cfg.buildcfg}/'
targetdir('wasm/build/bin/%{cfg.buildcfg}/')
objdir('wasm/build/obj/%{cfg.buildcfg}/')
end

filter 'configurations:debug'
filter('configurations:debug')
do
files {
files({
sheenbidi .. '/Source/BidiChain.c',
sheenbidi .. '/Source/BidiTypeLookup.c',
sheenbidi .. '/Source/BracketQueue.c',
Expand All @@ -47,104 +45,87 @@ do
sheenbidi .. '/Source/SBScriptLocator.c',
sheenbidi .. '/Source/ScriptLookup.c',
sheenbidi .. '/Source/ScriptStack.c',
sheenbidi .. '/Source/StatusStack.c'
}
sheenbidi .. '/Source/StatusStack.c',
})
end
filter 'configurations:release'
filter('configurations:release')
do
files {
sheenbidi .. '/Source/SheenBidi.c'
}
files({ sheenbidi .. '/Source/SheenBidi.c' })
end

buildoptions {
'-Wall',
'-ansi',
'-pedantic',
'-DANSI_DECLARATORS'
}
buildoptions({ '-Wall', '-ansi', '-pedantic', '-DANSI_DECLARATORS' })

buildoptions {
buildoptions({
'-Wno-c++17-extensions',
'-fno-exceptions',
'-fno-rtti',
'-fno-unwind-tables',
'-Wno-deprecated-builtins'
}
'-Wno-deprecated-builtins',
})

filter {'options:arch=wasm'}
filter({ 'options:arch=wasm' })
do
buildoptions {
buildoptions({
'-s STRICT=1',
'-s DISABLE_EXCEPTION_CATCHING=1',
'-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0',
'--no-entry'
}
'--no-entry',
})
end

filter 'configurations:debug'
filter('configurations:debug')
do
defines {'DEBUG'}
symbols 'On'
defines({ 'DEBUG' })
symbols('On')
end

filter 'configurations:release'
filter('configurations:release')
do
defines {'RELEASE', 'NDEBUG', 'SB_CONFIG_UNITY'}
optimize 'On'
buildoptions {
'-Oz',
'-g0',
'-flto'
}

linkoptions {
'-Oz',
'-g0',
'-flto'
}
defines({ 'RELEASE', 'NDEBUG', 'SB_CONFIG_UNITY' })
optimize('On')
buildoptions({ '-Oz', '-g0', '-flto' })

linkoptions({ '-Oz', '-g0', '-flto' })
end
filter {'system:macosx', 'options:arch=arm64'}
filter({ 'system:macosx', 'options:arch=arm64' })
do
buildoptions {'-target arm64-apple-macos11'}
linkoptions {'-target arm64-apple-macos11'}
buildoptions({ '-target arm64-apple-macos11' })
linkoptions({ '-target arm64-apple-macos11' })
end
filter {'system:macosx', 'options:arch=x86_64'}
filter({ 'system:macosx', 'options:arch=x86_64' })
do
buildoptions {'-target x86_64-apple-macos10.12'}
linkoptions {'-target x86_64-apple-macos10.12'}
buildoptions({ '-target x86_64-apple-macos10.12' })
linkoptions({ '-target x86_64-apple-macos10.12' })
end
end

project 'rive_text'
project('rive_text')
do
kind 'SharedLib'
language 'C++'
cppdialect 'C++17'
toolset 'clang'
kind('SharedLib')
language('C++')
cppdialect('C++17')
toolset('clang')
targetdir('shared_lib/build/bin/%{cfg.buildcfg}')
objdir('shared_lib/build/obj/%{cfg.buildcfg}')

dependson {
'rive_sheenbidi'
}
dependson({ 'rive_sheenbidi' })

defines {
defines({
'WITH_RIVE_TEXT',
'WITH_RIVE_AUDIO',
'HAVE_OT',
'HB_NO_FALLBACK_SHAPE',
'HB_NO_WIN1256'
}
'HB_NO_WIN1256',
})

includedirs {
includedirs({
source .. '/include',
source .. '/skia/renderer/include',
harfbuzz .. '/src/',
sheenbidi .. '/Headers'
}
sheenbidi .. '/Headers',
})

files {
files({
source .. '/src/renderer.cpp',
source .. '/src/math/mat2d.cpp',
source .. '/src/math/raw_path.cpp',
Expand Down Expand Up @@ -203,44 +184,38 @@ do
harfbuzz .. '/src/hb-subset-repacker.cc',
harfbuzz .. '/src/hb-subset.cc',
harfbuzz .. '/src/hb-ucd.cc',
harfbuzz .. '/src/hb-unicode.cc'
}
harfbuzz .. '/src/hb-unicode.cc',
})

links {
'rive_sheenbidi'
}
links({ 'rive_sheenbidi' })

buildoptions {
buildoptions({
'-Wno-c++17-extensions',
'-fno-exceptions',
'-fno-rtti',
'-fno-unwind-tables',
'-Wno-deprecated-builtins',
'-DANSI_DECLARATORS'
}
'-DANSI_DECLARATORS',
})

filter {'not options:arch=wasm'}
filter({ 'not options:arch=wasm' })
do
files {
'macos/rive_text/rive_text.cpp'
}
files({ 'macos/rive_text/rive_text.cpp' })
end

filter {'options:arch=wasm'}
filter({ 'options:arch=wasm' })
do
targetdir 'wasm/build/bin/%{cfg.buildcfg}/'
objdir 'wasm/build/obj/%{cfg.buildcfg}/'
kind 'ConsoleApp'
files {
'wasm/rive_text_bindings.cpp'
}
buildoptions {
targetdir('wasm/build/bin/%{cfg.buildcfg}/')
objdir('wasm/build/obj/%{cfg.buildcfg}/')
kind('ConsoleApp')
files({ 'wasm/rive_text_bindings.cpp' })
buildoptions({
'-s STRICT=1',
'-s DISABLE_EXCEPTION_CATCHING=1',
'-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0',
'--no-entry'
}
linkoptions {
'--no-entry',
})
linkoptions({
'--closure 1',
'--closure-args="--externs ./wasm/js/externs.js"',
'--bind',
Expand All @@ -255,86 +230,76 @@ do
'-s EXPORT_NAME="RiveText"',
'-DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0',
'--no-entry',
'--pre-js ./wasm/js/rive_text.js'
}
'--pre-js ./wasm/js/rive_text.js',
})
end

linkoptions {
linkoptions({
'-Wno-c++17-extensions',
'-fno-exceptions',
'-fno-rtti',
'-fno-unwind-tables'
}
'-fno-unwind-tables',
})

filter {'options:arch=wasm', 'options:single_file'}
filter({ 'options:arch=wasm', 'options:single_file' })
do
linkoptions {
linkoptions({
'-o %{cfg.targetdir}/rive_text_single.js',
'-s SINGLE_FILE=1'
}
'-s SINGLE_FILE=1',
})
end

filter {'options:arch=wasm', 'options:not single_file'}
filter({ 'options:arch=wasm', 'options:not single_file' })
do
linkoptions {
'-o %{cfg.targetdir}/rive_text.js'
}
linkoptions({ '-o %{cfg.targetdir}/rive_text.js' })
end

filter 'configurations:debug'
filter('configurations:debug')
do
defines {'DEBUG'}
symbols 'On'
defines({ 'DEBUG' })
symbols('On')
end

filter {'configurations:debug', 'options:arch=wasm'}
filter({ 'configurations:debug', 'options:arch=wasm' })
do
linkoptions {'-s ASSERTIONS=1'}
linkoptions({ '-s ASSERTIONS=1' })
end

filter 'configurations:release'
filter('configurations:release')
do
defines {'RELEASE'}
defines {'NDEBUG'}
optimize 'On'

buildoptions {
'-Oz',
'-g0',
'-flto'
}

linkoptions {
'-Oz',
'-g0',
'-flto'
}
defines({ 'RELEASE' })
defines({ 'NDEBUG' })
optimize('On')

buildoptions({ '-Oz', '-g0', '-flto' })

linkoptions({ '-Oz', '-g0', '-flto' })
end

filter {'configurations:release', 'options:arch=wasm'}
filter({ 'configurations:release', 'options:arch=wasm' })
do
linkoptions {'-s ASSERTIONS=0'}
linkoptions({ '-s ASSERTIONS=0' })
end

filter {'system:macosx', 'options:arch=arm64'}
filter({ 'system:macosx', 'options:arch=arm64' })
do
buildoptions {'-target arm64-apple-macos11'}
linkoptions {'-target arm64-apple-macos11'}
buildoptions({ '-target arm64-apple-macos11' })
linkoptions({ '-target arm64-apple-macos11' })
end
filter {'system:macosx', 'options:arch=x86_64'}
filter({ 'system:macosx', 'options:arch=x86_64' })
do
buildoptions {'-target x86_64-apple-macos10.12'}
linkoptions {'-target x86_64-apple-macos10.12'}
buildoptions({ '-target x86_64-apple-macos10.12' })
linkoptions({ '-target x86_64-apple-macos10.12' })
end
end

newoption {
newoption({
trigger = 'single_file',
description = 'Set when the wasm should be packed in with the js code.'
}
description = 'Set when the wasm should be packed in with the js code.',
})

newoption {
newoption({
trigger = 'arch',
description = 'Architectures we can target',
allowed = {{'x86_64'}, {'arm64'}, {'wasm'}}
}
allowed = { { 'x86_64' }, { 'arm64' }, { 'wasm' } },
})

0 comments on commit e43e189

Please sign in to comment.