building harfbuzz with our premake setup - builds and gets harfbuzz the same way we do our other dependencies - slight tweak to building libpng so it also builds from the dependencies folder Diffs= 0e69f1166 building harfbuzz with our premake setup and removing third_party (for now)
diff --git a/.rive_head b/.rive_head index 700dbe4..7c8701d 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -1bd6166123b7fac75106099f5e28568b3f292143 +0e69f11661b046008ddff212af1ccad53b731047
diff --git a/dependencies/macosx/get_harfbuzz.sh b/dependencies/macosx/get_harfbuzz.sh new file mode 100755 index 0000000..22b012e --- /dev/null +++ b/dependencies/macosx/get_harfbuzz.sh
@@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +if [[ -z "${DEPENDENCIES}" ]]; then + echo "DEPENDENCIES env variable must be set. This script is usually called by other scripts." + exit 1 +fi +pushd $DEPENDENCIES + +if [ ! -d harfbuzz ]; then + echo "Cloning Harfbuzz." + git clone https://github.com/harfbuzz/harfbuzz + cd harfbuzz + git checkout 858570b1d9912a1b746ab39fbe62a646c4f7a5b1 . +fi
diff --git a/dependencies/macosx/get_libpng.sh b/dependencies/macosx/get_libpng.sh index b22d8f0..8598ccc 100755 --- a/dependencies/macosx/get_libpng.sh +++ b/dependencies/macosx/get_libpng.sh
@@ -18,6 +18,7 @@ pushd libpng git checkout $LIBPNG_STABLE_BRANCH && git fetch && git pull +mv scripts/pnglibconf.h.prebuilt pnglibconf.h popd ZLIB_REPO=https://github.com/madler/zlib
diff --git a/dependencies/premake5_harfbuzz.lua b/dependencies/premake5_harfbuzz.lua new file mode 100644 index 0000000..57c3947 --- /dev/null +++ b/dependencies/premake5_harfbuzz.lua
@@ -0,0 +1,253 @@ +dependencies = os.getenv('DEPENDENCIES') + +harfbuzz = dependencies .. '/harfbuzz' + +workspace 'rive' +configurations {'debug', 'release'} + +project 'rive_harfbuzz' +do + kind 'StaticLib' + language 'C++' + cppdialect 'C++17' + toolset 'clang' + targetdir '%{cfg.system}/cache/bin/%{cfg.buildcfg}/' + objdir '%{cfg.system}/cache/obj/%{cfg.buildcfg}/' + + includedirs { + '../', + harfbuzz .. '/src' + } + + files { + harfbuzz .. '/src/hb-aat-layout-ankr-table.hh', + harfbuzz .. '/src/hb-aat-layout-bsln-table.hh', + harfbuzz .. '/src/hb-aat-layout-common.hh', + harfbuzz .. '/src/hb-aat-layout-feat-table.hh', + harfbuzz .. '/src/hb-aat-layout-just-table.hh', + harfbuzz .. '/src/hb-aat-layout-kerx-table.hh', + harfbuzz .. '/src/hb-aat-layout-morx-table.hh', + harfbuzz .. '/src/hb-aat-layout-opbd-table.hh', + harfbuzz .. '/src/hb-aat-layout-trak-table.hh', + harfbuzz .. '/src/hb-aat-layout.cc', + harfbuzz .. '/src/hb-aat-layout.hh', + harfbuzz .. '/src/hb-aat-ltag-table.hh', + harfbuzz .. '/src/hb-aat-map.cc', + harfbuzz .. '/src/hb-aat-map.hh', + harfbuzz .. '/src/hb-aat.h', + harfbuzz .. '/src/hb-algs.hh', + harfbuzz .. '/src/hb-array.hh', + harfbuzz .. '/src/hb-atomic.hh', + harfbuzz .. '/src/hb-bimap.hh', + harfbuzz .. '/src/hb-bit-page.hh', + harfbuzz .. '/src/hb-bit-set-invertible.hh', + harfbuzz .. '/src/hb-bit-set.hh', + harfbuzz .. '/src/hb-blob.cc', + harfbuzz .. '/src/hb-blob.hh', + harfbuzz .. '/src/hb-buffer-deserialize-json.hh', + harfbuzz .. '/src/hb-buffer-deserialize-text.hh', + harfbuzz .. '/src/hb-buffer-serialize.cc', + harfbuzz .. '/src/hb-buffer-verify.cc', + harfbuzz .. '/src/hb-buffer.cc', + harfbuzz .. '/src/hb-buffer.hh', + harfbuzz .. '/src/hb-cache.hh', + harfbuzz .. '/src/hb-cff-interp-common.hh', + harfbuzz .. '/src/hb-cff-interp-cs-common.hh', + harfbuzz .. '/src/hb-cff-interp-dict-common.hh', + harfbuzz .. '/src/hb-cff1-interp-cs.hh', + harfbuzz .. '/src/hb-cff2-interp-cs.hh', + harfbuzz .. '/src/hb-common.cc', + harfbuzz .. '/src/hb-config.hh', + harfbuzz .. '/src/hb-debug.hh', + harfbuzz .. '/src/hb-dispatch.hh', + harfbuzz .. '/src/hb-draw.cc', + harfbuzz .. '/src/hb-draw.h', + harfbuzz .. '/src/hb-draw.hh', + harfbuzz .. '/src/hb-face.cc', + harfbuzz .. '/src/hb-face.hh', + harfbuzz .. '/src/hb-font.cc', + harfbuzz .. '/src/hb-font.hh', + harfbuzz .. '/src/hb-iter.hh', + harfbuzz .. '/src/hb-kern.hh', + harfbuzz .. '/src/hb-machinery.hh', + harfbuzz .. '/src/hb-map.cc', + harfbuzz .. '/src/hb-map.hh', + harfbuzz .. '/src/hb-meta.hh', + harfbuzz .. '/src/hb-ms-feature-ranges.hh', + harfbuzz .. '/src/hb-mutex.hh', + harfbuzz .. '/src/hb-null.hh', + harfbuzz .. '/src/hb-number-parser.hh', + harfbuzz .. '/src/hb-number.cc', + harfbuzz .. '/src/hb-number.hh', + harfbuzz .. '/src/hb-object.hh', + harfbuzz .. '/src/hb-open-file.hh', + harfbuzz .. '/src/hb-open-type.hh', + harfbuzz .. '/src/hb-ot-cff-common.hh', + harfbuzz .. '/src/hb-ot-cff1-std-str.hh', + harfbuzz .. '/src/hb-ot-cff1-table.cc', + harfbuzz .. '/src/hb-ot-cff1-table.hh', + harfbuzz .. '/src/hb-ot-cff2-table.cc', + harfbuzz .. '/src/hb-ot-cff2-table.hh', + harfbuzz .. '/src/hb-ot-cmap-table.hh', + harfbuzz .. '/src/hb-ot-color-cbdt-table.hh', + harfbuzz .. '/src/hb-ot-color-colr-table.hh', + harfbuzz .. '/src/hb-ot-color-colrv1-closure.hh', + harfbuzz .. '/src/hb-ot-color-cpal-table.hh', + harfbuzz .. '/src/hb-ot-color-sbix-table.hh', + harfbuzz .. '/src/hb-ot-color-svg-table.hh', + harfbuzz .. '/src/hb-ot-color.cc', + harfbuzz .. '/src/hb-ot-color.h', + harfbuzz .. '/src/hb-ot-deprecated.h', + harfbuzz .. '/src/hb-ot-face-table-list.hh', + harfbuzz .. '/src/hb-ot-face.cc', + harfbuzz .. '/src/hb-ot-face.hh', + harfbuzz .. '/src/hb-ot-font.cc', + harfbuzz .. '/src/hb-ot-gasp-table.hh', + harfbuzz .. '/src/hb-ot-glyf-table.hh', + harfbuzz .. '/src/hb-ot-hdmx-table.hh', + harfbuzz .. '/src/hb-ot-head-table.hh', + harfbuzz .. '/src/hb-ot-hhea-table.hh', + harfbuzz .. '/src/hb-ot-hmtx-table.hh', + harfbuzz .. '/src/hb-ot-kern-table.hh', + harfbuzz .. '/src/hb-ot-layout-base-table.hh', + harfbuzz .. '/src/hb-ot-layout-common.hh', + harfbuzz .. '/src/hb-ot-layout-gdef-table.hh', + harfbuzz .. '/src/hb-ot-layout-gpos-table.hh', + harfbuzz .. '/src/hb-ot-layout-gsub-table.hh', + harfbuzz .. '/src/hb-ot-layout-gsubgpos.hh', + harfbuzz .. '/src/hb-ot-layout-jstf-table.hh', + harfbuzz .. '/src/hb-ot-layout.cc', + harfbuzz .. '/src/hb-ot-layout.hh', + harfbuzz .. '/src/hb-ot-map.cc', + harfbuzz .. '/src/hb-ot-map.hh', + harfbuzz .. '/src/hb-ot-math-table.hh', + harfbuzz .. '/src/hb-ot-math.cc', + harfbuzz .. '/src/hb-ot-maxp-table.hh', + harfbuzz .. '/src/hb-ot-meta-table.hh', + harfbuzz .. '/src/hb-ot-meta.cc', + harfbuzz .. '/src/hb-ot-meta.h', + harfbuzz .. '/src/hb-ot-metrics.cc', + harfbuzz .. '/src/hb-ot-metrics.hh', + harfbuzz .. '/src/hb-ot-name-language-static.hh', + harfbuzz .. '/src/hb-ot-name-language.hh', + harfbuzz .. '/src/hb-ot-name-table.hh', + harfbuzz .. '/src/hb-ot-name.cc', + harfbuzz .. '/src/hb-ot-name.h', + harfbuzz .. '/src/hb-ot-os2-table.hh', + harfbuzz .. '/src/hb-ot-os2-unicode-ranges.hh', + harfbuzz .. '/src/hb-ot-post-macroman.hh', + harfbuzz .. '/src/hb-ot-post-table-v2subset.hh', + harfbuzz .. '/src/hb-ot-post-table.hh', + harfbuzz .. '/src/hb-ot-shape-complex-arabic-fallback.hh', + harfbuzz .. '/src/hb-ot-shape-complex-arabic-joining-list.hh', + harfbuzz .. '/src/hb-ot-shape-complex-arabic-table.hh', + harfbuzz .. '/src/hb-ot-shape-complex-arabic.cc', + harfbuzz .. '/src/hb-ot-shape-complex-arabic.hh', + harfbuzz .. '/src/hb-ot-shape-complex-default.cc', + harfbuzz .. '/src/hb-ot-shape-complex-hangul.cc', + harfbuzz .. '/src/hb-ot-shape-complex-hebrew.cc', + harfbuzz .. '/src/hb-ot-shape-complex-indic-machine.hh', + harfbuzz .. '/src/hb-ot-shape-complex-indic-table.cc', + harfbuzz .. '/src/hb-ot-shape-complex-indic.cc', + harfbuzz .. '/src/hb-ot-shape-complex-indic.hh', + harfbuzz .. '/src/hb-ot-shape-complex-khmer-machine.hh', + harfbuzz .. '/src/hb-ot-shape-complex-khmer.cc', + harfbuzz .. '/src/hb-ot-shape-complex-khmer.hh', + harfbuzz .. '/src/hb-ot-shape-complex-myanmar-machine.hh', + harfbuzz .. '/src/hb-ot-shape-complex-myanmar.cc', + harfbuzz .. '/src/hb-ot-shape-complex-myanmar.hh', + harfbuzz .. '/src/hb-ot-shape-complex-syllabic.cc', + harfbuzz .. '/src/hb-ot-shape-complex-syllabic.hh', + harfbuzz .. '/src/hb-ot-shape-complex-thai.cc', + harfbuzz .. '/src/hb-ot-shape-complex-use-machine.hh', + harfbuzz .. '/src/hb-ot-shape-complex-use-table.hh', + harfbuzz .. '/src/hb-ot-shape-complex-use.cc', + harfbuzz .. '/src/hb-ot-shape-complex-vowel-constraints.cc', + harfbuzz .. '/src/hb-ot-shape-complex-vowel-constraints.hh', + harfbuzz .. '/src/hb-ot-shape-complex.hh', + harfbuzz .. '/src/hb-ot-shape-fallback.cc', + harfbuzz .. '/src/hb-ot-shape-fallback.hh', + harfbuzz .. '/src/hb-ot-shape-normalize.cc', + harfbuzz .. '/src/hb-ot-shape-normalize.hh', + harfbuzz .. '/src/hb-ot-shape.cc', + harfbuzz .. '/src/hb-ot-shape.hh', + harfbuzz .. '/src/hb-ot-stat-table.hh', + harfbuzz .. '/src/hb-ot-tag-table.hh', + harfbuzz .. '/src/hb-ot-tag.cc', + harfbuzz .. '/src/hb-ot-var-avar-table.hh', + harfbuzz .. '/src/hb-ot-var-common.hh', + harfbuzz .. '/src/hb-ot-var-fvar-table.hh', + harfbuzz .. '/src/hb-ot-var-gvar-table.hh', + harfbuzz .. '/src/hb-ot-var-hvar-table.hh', + harfbuzz .. '/src/hb-ot-var-mvar-table.hh', + harfbuzz .. '/src/hb-ot-var.cc', + harfbuzz .. '/src/hb-ot-vorg-table.hh', + harfbuzz .. '/src/hb-pool.hh', + harfbuzz .. '/src/hb-priority-queue.hh', + harfbuzz .. '/src/hb-repacker.hh', + harfbuzz .. '/src/hb-sanitize.hh', + harfbuzz .. '/src/hb-serialize.hh', + harfbuzz .. '/src/hb-set-digest.hh', + harfbuzz .. '/src/hb-set.cc', + harfbuzz .. '/src/hb-set.hh', + harfbuzz .. '/src/hb-shape-plan.cc', + harfbuzz .. '/src/hb-shape-plan.hh', + harfbuzz .. '/src/hb-shape.cc', + harfbuzz .. '/src/hb-shaper-impl.hh', + harfbuzz .. '/src/hb-shaper-list.hh', + harfbuzz .. '/src/hb-shaper.cc', + harfbuzz .. '/src/hb-shaper.hh', + harfbuzz .. '/src/hb-static.cc', + harfbuzz .. '/src/hb-string-array.hh', + harfbuzz .. '/src/hb-subset-cff-common.cc', + harfbuzz .. '/src/hb-subset-cff-common.hh', + harfbuzz .. '/src/hb-subset-cff1.cc', + harfbuzz .. '/src/hb-subset-cff1.hh', + harfbuzz .. '/src/hb-subset-cff2.cc', + harfbuzz .. '/src/hb-subset-cff2.hh', + harfbuzz .. '/src/hb-subset-input.cc', + harfbuzz .. '/src/hb-subset-input.hh', + harfbuzz .. '/src/hb-subset-plan.cc', + harfbuzz .. '/src/hb-subset-plan.hh', + harfbuzz .. '/src/hb-subset-repacker.cc', + harfbuzz .. '/src/hb-subset-repacker.h', + harfbuzz .. '/src/hb-subset.cc', + harfbuzz .. '/src/hb-subset.hh', + harfbuzz .. '/src/hb-ucd-table.hh', + harfbuzz .. '/src/hb-ucd.cc', + harfbuzz .. '/src/hb-unicode-emoji-table.hh', + harfbuzz .. '/src/hb-unicode.cc', + harfbuzz .. '/src/hb-unicode.hh', + harfbuzz .. '/src/hb-utf.hh', + harfbuzz .. '/src/hb-vector.hh', + harfbuzz .. '/src/hb.hh' + } + + buildoptions { + '-Wall', + '-fno-exceptions', + '-fno-rtti', + '-Werror=format', + '-Wimplicit-int-conversion', + '-Werror=vla' + } + + defines { + 'HAVE_OT', + 'HB_NO_FALLBACK_SHAPE', + 'HB_NO_WIN1256' + } + + filter 'configurations:debug' + do + defines {'DEBUG'} + symbols 'On' + end + + filter 'configurations:release' + do + defines {'RELEASE'} + defines {'NDEBUG'} + optimize 'On' + end +end
diff --git a/viewer/build/premake5_libpng.lua b/dependencies/premake5_libpng.lua similarity index 87% rename from viewer/build/premake5_libpng.lua rename to dependencies/premake5_libpng.lua index e6074b6..72e7435 100644 --- a/viewer/build/premake5_libpng.lua +++ b/dependencies/premake5_libpng.lua
@@ -8,14 +8,14 @@ language 'C++' cppdialect 'C++17' toolset 'clang' - targetdir '%{cfg.system}/bin/%{cfg.buildcfg}/' - objdir '%{cfg.system}/obj/%{cfg.buildcfg}/' + targetdir '%{cfg.system}/cache/bin/%{cfg.buildcfg}/' + objdir '%{cfg.system}/cache/obj/%{cfg.buildcfg}/' buildoptions { '-fno-exceptions', '-fno-rtti' } includedirs { - '../include/viewer/tess', + './', dependencies, libpng } @@ -55,8 +55,8 @@ language 'C++' cppdialect 'C++17' toolset 'clang' - targetdir '%{cfg.system}/bin/%{cfg.buildcfg}/' - objdir '%{cfg.system}/obj/%{cfg.buildcfg}/' + targetdir '%{cfg.system}/cache/bin/%{cfg.buildcfg}/' + objdir '%{cfg.system}/cache/obj/%{cfg.buildcfg}/' buildoptions { '-fno-exceptions', '-fno-rtti'
diff --git a/viewer/build/macosx/build_viewer.sh b/viewer/build/macosx/build_viewer.sh index 3876b04..f5c5cd1 100755 --- a/viewer/build/macosx/build_viewer.sh +++ b/viewer/build/macosx/build_viewer.sh
@@ -46,6 +46,12 @@ popd fi +if [[ ! -d "$DEPENDENCIES/harfbuzz" ]]; then + pushd $DEPENDENCIES_SCRIPTS + ./get_harfbuzz.sh + popd +fi + if [ $RENDERER = "skia" ]; then pushd ../../../skia/renderer/build/macosx ./build_skia_renderer.sh text $@
diff --git a/viewer/build/premake5_viewer.lua b/viewer/build/premake5_viewer.lua index e048076..417cbac 100644 --- a/viewer/build/premake5_viewer.lua +++ b/viewer/build/premake5_viewer.lua
@@ -7,16 +7,17 @@ dependencies = os.getenv('DEPENDENCIES') rive = '../../' -rive_thirdparty = '../../../../third_party' rive_tess = '../../tess' rive_skia = '../../skia' skia = dependencies .. '/skia' libpng = dependencies .. '/libpng' +dofile(path.join(path.getabsolute(dependencies) .. '/../..', 'premake5_harfbuzz.lua')) if _OPTIONS.renderer == 'tess' then - dofile('premake5_libpng.lua') + dofile(path.join(path.getabsolute(dependencies) .. '/../..', 'premake5_libpng.lua')) 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 @@ -38,10 +39,10 @@ '../include', rive .. '/include', rive .. '/skia/renderer/include', -- for renderfont backends - rive_thirdparty .. '/externals/harfbuzz/src', dependencies, dependencies .. '/sokol', - dependencies .. '/imgui' + dependencies .. '/imgui', + dependencies .. '/harfbuzz/src' } links { @@ -50,8 +51,7 @@ } libdirs { - rive .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}', - rive_thirdparty .. '/harfbuzz/build/%{cfg.buildcfg}/bin' + rive .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' } files { @@ -220,8 +220,7 @@ 'RIVE_RENDERER_SKIA' } libdirs { - rive_skia .. '/renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}', - rive_thirdparty .. '/harfbuzz/build/%{cfg.buildcfg}/bin' + rive_skia .. '/renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}' } links { 'skia',
diff --git a/viewer/include/viewer/tess/pnglibconf.h b/viewer/include/viewer/tess/pnglibconf.h deleted file mode 100644 index c9ae700..0000000 --- a/viewer/include/viewer/tess/pnglibconf.h +++ /dev/null
@@ -1 +0,0 @@ -#include "libpng/scripts/pnglibconf.h.prebuilt" \ No newline at end of file
diff --git a/viewer/src/tess/decode_png.cpp b/viewer/src/tess/decode_png.cpp index 432afd6..65b4ae9 100644 --- a/viewer/src/tess/decode_png.cpp +++ b/viewer/src/tess/decode_png.cpp
@@ -1,6 +1,5 @@ #ifdef RIVE_RENDERER_TESS #include "viewer/tess/bitmap_decoder.hpp" -#include "viewer/tess/pnglibconf.h" #include "png.h" struct EncodedImageBuffer {