Files
rive-cpp/viewer/build/premake5_viewer.lua
mjtalbot 9122e58a54 Libraries
Bunch of changes, i think its at the point where it will be helpful to get a review, there is a *lot* of outstanding work to do here, but i'm hoping that much of it can be done while this is in master but not enabled for uat yet. so @susan101566 and I can work through that set together, with smaller more targeted fixes and changes.

There are a couple of things i want to figure out to make sure we can merge this:
- is the Resolver approach going to work (library components resolve to real components)
- writing library assets into the parent needs a bit more love, it should not cause problems unless you're using libraries
- I want to do a small refactor on the exporter before merge to keep asset writing and asset index updates together as suggested by @susan101566. there's a larger refactor here but i think that can be done in due course.
- re-check editor-only deliniation

After refactoring those i also need to re-check that all these things still work, because chances are i've broken something in the meantime.

for
    using a library in as a nested artboard &
    using a library as part of using a nested artboard that contains a library
check
    using a library animation
    using a library stateMachine
    using a library stateMachineInputs
        we can key state machine input changes
        we can trigger nested state machine input changes from teh state machine editor
    using a library with assets

exporting all the above and view in cpp viewer
exporting all the above and view in dart viewer

There is a large list of items that need to be worked on beyond this. but hopefully we can do that more incrementally. this includes but is not limited to:
- object validations make sense
- the asset panel is interacting as we want
- right click menus make sense
- out of band loading works
- library api failures are handled
- refactor how we add library assets
- refactor asset exporting
- tracking
- smi paths'

Diffs=
9d8a7e81fa Libraries (#9255)

Co-authored-by: Arthur Vivian <arthur@rive.app>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Co-authored-by: Susan Wang <susan@rive.app>
2025-04-03 17:27:06 +00:00

150 lines
4.1 KiB
Lua

dofile('rive_build_config.lua')
dependencies = os.getenv('DEPENDENCIES')
rive = '../../'
rive_tess = '../../tess'
rive_skia = '../../skia'
skia = dependencies .. '/skia'
dofile(rive .. '/decoders/premake5_v2.lua')
if _OPTIONS.renderer == 'tess' then
dofile(path.join(path.getabsolute(rive_tess) .. '/build', 'premake5_tess.lua'))
else
-- tess renderer includes this
dofile(path.join(path.getabsolute(rive) .. '/build', 'premake5.lua'))
end
dofile(path.join(path.getabsolute(rive) .. '/cg_renderer', 'premake5.lua'))
project('rive_viewer')
do
dependson('rive_decoders')
kind('ConsoleApp')
defines({ 'WITH_RIVE_TEXT', 'WITH_RIVE_AUDIO', 'WITH_RIVE_LAYOUT', 'YOGA_EXPORT=' })
includedirs({
'../include',
rive .. '/include',
rive .. '/decoders/include',
rive .. '/skia/renderer/include', -- for font backends
dependencies,
dependencies .. '/sokol',
dependencies .. '/imgui',
miniaudio,
yoga,
})
links({ 'rive','rive_decoders', 'rive_harfbuzz', 'rive_sheenbidi', 'rive_yoga' })
libdirs({ rive .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' })
files({
'../src/**.cpp',
rive .. '/utils/**.cpp',
dependencies .. '/imgui/imgui.cpp',
dependencies .. '/imgui/imgui_widgets.cpp',
dependencies .. '/imgui/imgui_tables.cpp',
dependencies .. '/imgui/imgui_draw.cpp',
})
buildoptions({ '-Wall', '-fno-exceptions', '-fno-rtti' })
filter({ 'system:macosx' })
do
links({
'Cocoa.framework',
'IOKit.framework',
'CoreVideo.framework',
'OpenGL.framework',
'rive_cg_renderer',
})
files({ '../src/**.m', '../src/**.mm' })
end
filter({ 'system:macosx', 'options:graphics=gl' })
do
links({ 'OpenGL.framework' })
end
filter({ 'system:macosx', 'options:graphics=metal' })
do
links({ 'Metal.framework', 'MetalKit.framework', 'QuartzCore.framework' })
end
-- Tess Renderer Configuration
filter({ 'options:renderer=tess' })
do
includedirs({ rive_tess .. '/include', rive .. '/decoders/include' })
defines({ 'RIVE_RENDERER_TESS' })
links({ 'rive_tess_renderer', 'rive_decoders', 'libpng', 'zlib', 'libjpeg', 'libwebp' })
libdirs({ rive_tess .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' })
end
filter({ 'options:renderer=tess', 'options:graphics=gl' })
do
defines({ 'SOKOL_GLCORE33' })
end
filter({ 'options:renderer=tess', 'options:graphics=metal' })
do
defines({ 'SOKOL_METAL' })
end
filter({ 'options:renderer=tess', 'options:graphics=d3d' })
do
defines({ 'SOKOL_D3D11' })
end
filter({ 'options:renderer=skia', 'options:graphics=gl' })
do
defines({ 'SK_GL', 'SOKOL_GLCORE33' })
files({ '../src/skia/viewer_skia_gl.cpp' })
libdirs({ skia .. '/out/gl/%{cfg.buildcfg}' })
end
filter({ 'options:renderer=skia', 'options:graphics=metal' })
do
defines({ 'SK_METAL', 'SOKOL_METAL' })
libdirs({ skia .. '/out/metal/%{cfg.buildcfg}' })
end
filter({ 'options:renderer=skia', 'options:graphics=d3d' })
do
defines({ 'SK_DIRECT3D' })
libdirs({ skia .. '/out/d3d/%{cfg.buildcfg}' })
end
filter({ 'options:renderer=skia' })
do
includedirs({
skia,
skia .. '/include/core',
skia .. '/include/effects',
skia .. '/include/gpu',
skia .. '/include/config',
})
defines({ 'RIVE_RENDERER_SKIA' })
libdirs({
rive_skia .. '/renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}',
})
links({ 'skia', 'rive_skia_renderer' })
end
-- CLI config options
newoption({
trigger = 'graphics',
value = 'gl',
description = 'The graphics api to use.',
allowed = { { 'gl' }, { 'metal' }, { 'd3d' } },
})
newoption({
trigger = 'renderer',
value = 'skia',
description = 'The renderer to use.',
allowed = { { 'skia' }, { 'tess' } },
})
end