fix viewer build Diffs= a8c86e949 fix viewer build (#6527) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index 7ba5f38..484df22 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -858215cc481f86081b04390b67304f932fc45d10 +a8c86e949999962ed56bcaf1b796c5a29b7f2b12
diff --git a/build/rive_build_config.lua b/build/rive_build_config.lua index 8d7e1e2..30608af 100644 --- a/build/rive_build_config.lua +++ b/build/rive_build_config.lua
@@ -314,7 +314,7 @@ }) end - filter('system:macosx') + filter('system:macosx or system:ios') do buildoptions({ '-fobjc-arc' }) end
diff --git a/skia/renderer/build/macosx/build_skia_renderer.sh b/skia/renderer/build/macosx/build_skia_renderer.sh new file mode 100755 index 0000000..fe9a3b4 --- /dev/null +++ b/skia/renderer/build/macosx/build_skia_renderer.sh
@@ -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
diff --git a/viewer/build/macosx/build_viewer.sh b/viewer/build/macosx/build_viewer.sh index d47310d..402cf2d 100755 --- a/viewer/build/macosx/build_viewer.sh +++ b/viewer/build/macosx/build_viewer.sh
@@ -56,24 +56,24 @@ 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
diff --git a/viewer/build/premake5_viewer.lua b/viewer/build/premake5_viewer.lua index e92b48b..01a5239 100644 --- a/viewer/build/premake5_viewer.lua +++ b/viewer/build/premake5_viewer.lua
@@ -1,5 +1,4 @@ -workspace('rive') -configurations({ 'debug', 'release' }) +dofile 'rive_build_config.lua' dependencies = os.getenv('DEPENDENCIES') @@ -16,7 +15,7 @@ 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 @@ 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 @@ 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',
diff --git a/viewer/src/platform/viewer_gl.mm b/viewer/src/platform/viewer_gl.mm index 69ff417..77e687a 100644 --- a/viewer/src/platform/viewer_gl.mm +++ b/viewer/src/platform/viewer_gl.mm
@@ -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 -} \ No newline at end of file +}