fix viewer build

Diffs=
a8c86e949 fix viewer build (#6527)

Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
This commit is contained in:
luigi-rosso
2024-01-27 22:20:31 +00:00
parent 3255a2aeb2
commit bf1e8f8eff
6 changed files with 71 additions and 33 deletions

View File

@@ -1 +1 @@
858215cc481f86081b04390b67304f932fc45d10
a8c86e949999962ed56bcaf1b796c5a29b7f2b12

View File

@@ -314,7 +314,7 @@ if os.host() == 'macosx' then
})
end
filter('system:macosx')
filter('system:macosx or system:ios')
do
buildoptions({ '-fobjc-arc' })
end

View File

@@ -0,0 +1,59 @@
#!/bin/sh
set -e
source ../../../../dependencies/macosx/config_directories.sh
CONFIG=debug
GRAPHICS=gl
OTHER_OPTIONS=
for var in "$@"; do
if [[ $var = "release" ]]; then
CONFIG=release
fi
if [[ $var = "gl" ]]; then
GRAPHICS=gl
fi
if [[ $var = "d3d" ]]; then
GRAPHICS=d3d
fi
if [[ $var = "metal" ]]; then
GRAPHICS=metal
fi
if [[ $var = "text" ]]; then
OTHER_OPTIONS+=--with_rive_text
fi
done
if [[ ! -f "$DEPENDENCIES/bin/premake5" ]]; then
pushd $DEPENDENCIES_SCRIPTS
./get_premake5.sh
popd
fi
if [[ ! -d "$DEPENDENCIES/sokol" ]]; then
pushd $DEPENDENCIES_SCRIPTS
./get_sokol.sh
popd
fi
if [[ ! -f "$DEPENDENCIES/skia/out/$GRAPHICS/$CONFIG/libskia.a" ]]; then
pushd $DEPENDENCIES_SCRIPTS
./make_viewer_skia.sh $GRAPHICS $CONFIG
popd
fi
export PREMAKE=$DEPENDENCIES/bin/premake5
pushd ..
$PREMAKE --scripts=../../../build --file=./premake5.lua gmake2 $OTHER_OPTIONS
for var in "$@"; do
if [[ $var = "clean" ]]; then
make clean
make config=release clean
fi
done
make config=$CONFIG -j$(($(sysctl -n hw.physicalcpu) + 1))
popd

View File

@@ -56,24 +56,24 @@ export PREMAKE=$DEPENDENCIES/bin/premake5
pushd ..
$PREMAKE --scripts=../../build --file=./premake5_viewer.lua gmake2 --graphics=$GRAPHICS --renderer=$RENDERER --with_rive_tools --with_rive_text --with_rive_audio=system
OUT=out/$RENDERER/$GRAPHICS/$CONFIG
$PREMAKE --scripts=../../build --file=./premake5_viewer.lua --config=$CONFIG --out=$OUT gmake2 --graphics=$GRAPHICS --renderer=$RENDERER --with_rive_tools --with_rive_text --with_rive_audio=system
for var in "$@"; do
if [[ $var = "clean" ]]; then
make clean
make config=release clean
make -C $OUT clean
fi
done
make config=$CONFIG -j$(($(sysctl -n hw.physicalcpu) + 1))
make -C $OUT -j$(($(sysctl -n hw.physicalcpu) + 1))
popd
for var in "$@"; do
if [[ $var = "run" ]]; then
bin/$CONFIG/$RENDERER/$GRAPHICS/rive_viewer
$OUT/rive_viewer
fi
if [[ $var = "lldb" ]]; then
lldb bin/$CONFIG/$RENDERER/$GRAPHICS/rive_viewer
lldb $OUT/rive_viewer
fi
done

View File

@@ -1,5 +1,4 @@
workspace('rive')
configurations({ 'debug', 'release' })
dofile 'rive_build_config.lua'
dependencies = os.getenv('DEPENDENCIES')
@@ -16,7 +15,7 @@ else
dofile(path.join(path.getabsolute(rive) .. '/build', 'premake5.lua'))
end
dofile(path.join(path.getabsolute(rive) .. '/cg_renderer/build', 'premake5.lua'))
dofile(path.join(path.getabsolute(rive) .. '/cg_renderer', 'premake5.lua'))
project('rive_viewer')
do
@@ -24,11 +23,6 @@ do
dependson('rive_decoders')
end
kind('ConsoleApp')
language('C++')
cppdialect('C++17')
toolset('clang')
targetdir('%{cfg.system}/bin/%{cfg.buildcfg}/' .. _OPTIONS.renderer .. '/' .. _OPTIONS.graphics)
objdir('%{cfg.system}/obj/%{cfg.buildcfg}/' .. _OPTIONS.renderer .. '/' .. _OPTIONS.graphics)
defines({ 'WITH_RIVE_TEXT', 'WITH_RIVE_AUDIO' })
@@ -138,21 +132,6 @@ do
links({ 'skia', 'rive_skia_renderer' })
end
filter('configurations:debug')
do
buildoptions({ '-g' })
defines({ 'DEBUG' })
symbols('On')
end
filter('configurations:release')
do
buildoptions({ '-flto=full' })
defines({ 'RELEASE' })
defines({ 'NDEBUG' })
optimize('On')
end
-- CLI config options
newoption({
trigger = 'graphics',

View File

@@ -10,9 +10,9 @@
void bindGraphicsContext()
{
#ifdef SOKOL_GLCORE33
NSWindow* window = (NSWindow*)sapp_macos_get_window();
NSWindow* window = (__bridge NSWindow*)sapp_macos_get_window();
NSOpenGLView* sokolView = (NSOpenGLView*)window.contentView;
NSOpenGLContext* ctx = [sokolView openGLContext];
[ctx makeCurrentContext];
#endif
}
}