From 11084a716749910efaa1832e2f2da636522b2e98 Mon Sep 17 00:00:00 2001 From: csmartdalton Date: Fri, 26 Jan 2024 21:20:44 +0000 Subject: [PATCH] Reorganize premake Diffs= b8875ef31 Reorganize premake (#6522) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com> --- .rive_head | 2 +- build/macosx/build_rive.sh | 40 -- build/rive_build_config.lua | 385 ++++++++++++++++++ cg_renderer/build/premake5.lua | 125 ------ cg_renderer/premake5.lua | 65 +++ decoders/premake5_v2.lua | 20 + dependencies/premake5_harfbuzz_v2.lua | 247 +++++++++++ dependencies/premake5_libpng_v2.lua | 72 ++++ dependencies/premake5_miniaudio_v2.lua | 3 + dependencies/premake5_sheenbidi_v2.lua | 65 +++ premake5_v2.lua | 135 ++++++ .../build/macosx/build_skia_renderer.sh | 59 --- skia/renderer/premake5_v2.lua | 99 +++++ 13 files changed, 1092 insertions(+), 225 deletions(-) delete mode 100755 build/macosx/build_rive.sh create mode 100644 build/rive_build_config.lua delete mode 100644 cg_renderer/build/premake5.lua create mode 100644 cg_renderer/premake5.lua create mode 100644 decoders/premake5_v2.lua create mode 100644 dependencies/premake5_harfbuzz_v2.lua create mode 100644 dependencies/premake5_libpng_v2.lua create mode 100644 dependencies/premake5_miniaudio_v2.lua create mode 100644 dependencies/premake5_sheenbidi_v2.lua create mode 100644 premake5_v2.lua delete mode 100755 skia/renderer/build/macosx/build_skia_renderer.sh create mode 100644 skia/renderer/premake5_v2.lua diff --git a/.rive_head b/.rive_head index 549db38d..2c71c3eb 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -fddb050ca322c797dbbd01292f7d4f2b568eb627 +b8875ef3109298913c20335cfb70eb9831f1703f diff --git a/build/macosx/build_rive.sh b/build/macosx/build_rive.sh deleted file mode 100755 index d2026024..00000000 --- a/build/macosx/build_rive.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -set -e - -source ../../dependencies/macosx/config_directories.sh - -CONFIG=debug -TOOLS= -for var in "$@"; do - if [[ $var = "release" ]]; then - CONFIG=release - fi - if [[ $var = "tools" ]]; then - TOOLS="--with_rive_tools" - fi - if [[ $var = "text" ]]; then - TOOLS="--with_rive_text" - fi -done - -if [[ ! -f "$DEPENDENCIES/bin/premake5" ]]; then - pushd $DEPENDENCIES_SCRIPTS - ./get_premake5.sh - popd -fi - -export PREMAKE=$DEPENDENCIES/bin/premake5 -pushd .. - -$PREMAKE --file=./premake5.lua gmake2 $TOOLS - -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/build/rive_build_config.lua b/build/rive_build_config.lua new file mode 100644 index 00000000..bff74eb3 --- /dev/null +++ b/build/rive_build_config.lua @@ -0,0 +1,385 @@ +workspace 'rive' + +newoption { + trigger = "config", + description = "one-and-only config (for multiple configs, target a new --out directory)", + allowed = {{'debug'}, {'release'}, {nil}}, + default = nil, +} +newoption { + trigger = "release", + description = "shortcut for '--config=release'", +} +if _OPTIONS['release'] +then + if _OPTIONS['config'] + then + error("use either '--release' or '--config=release/debug' (not both)") + end + _OPTIONS["config"] = "release" + _OPTIONS["release"] = nil +elseif not _OPTIONS['config'] +then + _OPTIONS["config"] = "debug" +end +RIVE_BUILD_CONFIG = _OPTIONS["config"] + +newoption { + trigger = "out", + description = "Directory to generate build files", + default = nil, +} +RIVE_BUILD_OUT = _OPTIONS["out"] or ("out/" .. RIVE_BUILD_CONFIG) + +newoption { + trigger = 'toolset', + value = 'type', + description = 'Choose which toolchain to build with', + allowed = { + {'clang', 'Build with Clang'}, + {'msc', 'Build with the Microsoft C/C++ compiler'} + }, + default = 'clang', +} + +newoption { + trigger = 'arch', + value = 'ABI', + description = 'The ABI with the right toolchain for this build, generally with Android', + allowed = { + {'host'}, + {'x86'}, + {'x64'}, + {'arm'}, + {'arm64'}, + {'universal', '"fat" library on apple platforms'}, + {'wasm', 'emscripten targeting web assembly'}, + {'js', 'emscripten targeting javascript'} + }, + default = 'host', +} + +newoption { + trigger = 'variant', + value = 'type', + description = 'Choose a particular variant to build', + allowed = { + {'system', 'Builds the static library for the provided system'}, + {'emulator', 'Builds for a simulator for the provided system'} + }, + default = 'system', +} + +newoption { + trigger = "with-rtti", + description = "don't disable rtti (nonstandard for Rive)", +} + +newoption { + trigger = "with-exceptions", + description = "don't disable exceptions (nonstandard for Rive)", +} + +location (_WORKING_DIR .. "/" .. RIVE_BUILD_OUT) +targetdir (_WORKING_DIR .. "/" .. RIVE_BUILD_OUT) +objdir (_WORKING_DIR .. "/" .. RIVE_BUILD_OUT .. "/obj") +toolset (_OPTIONS["toolset"] or "clang") +language 'C++' +cppdialect 'C++17' +configurations {"default"} +filter {"options:not with-rtti"} rtti "Off" +filter {"options:with-rtti"} rtti "On" +filter {"options:not with-exceptions"} exceptionhandling "Off" +filter {"options:with-exceptions"} exceptionhandling "On" + +filter 'options:config=debug' +do + defines {'DEBUG'} + symbols 'On' +end + +filter 'options:config=release' +do + defines {'RELEASE'} + defines {'NDEBUG'} + optimize 'On' +end + +filter {'system:not windows', 'options:config=release'} +do + buildoptions {'-flto=full'} +end + +filter 'system:windows' +do + staticruntime "on" -- Match Skia's /MT flag for link compatibility + runtime "Release" -- Use /MT even in debug (/MTd is incompatible with Skia) + architecture 'x64' + defines {'_USE_MATH_DEFINES'} +end + +filter {'system:windows', 'options:toolset=clang'} +do + buildoptions { + '-Wno-c++98-compat', + '-Wno-c++20-compat', + '-Wno-c++98-compat-pedantic', + '-Wno-c99-extensions', + '-Wno-ctad-maybe-unsupported', + '-Wno-deprecated-copy-with-user-provided-dtor', + '-Wno-deprecated-declarations', + '-Wno-documentation', + '-Wno-documentation-pedantic', + '-Wno-documentation-unknown-command', + '-Wno-double-promotion', + '-Wno-exit-time-destructors', + '-Wno-float-equal', + '-Wno-global-constructors', + '-Wno-implicit-float-conversion', + '-Wno-newline-eof', + '-Wno-old-style-cast', + '-Wno-reserved-identifier', + '-Wno-shadow', + '-Wno-sign-compare', + '-Wno-sign-conversion', + '-Wno-unused-macros', + '-Wno-unused-parameter', + '-Wno-four-char-constants', + '-Wno-unreachable-code', + '-Wno-switch-enum', + '-Wno-missing-field-initializers', + '-Wno-unsafe-buffer-usage' + } +end + +filter {'system:windows', 'options:toolset=msc'} +do + -- We currently suppress several warnings for the MSVC build, some serious. Once this build + -- is fully integrated into GitHub actions, we will definitely want to address these. + disablewarnings { + "4061", -- enumerator 'identifier' in switch of enum 'enumeration' is not explicitly + -- handled by a case label + "4100", -- 'identifier': unreferenced formal parameter + "4201", -- nonstandard extension used: nameless struct/union + "4244", -- 'conversion_type': conversion from 'type1' to 'type2', possible loss of data + "4245", -- 'conversion_type': conversion from 'type1' to 'type2', signed/unsigned + -- mismatch + "4267", -- 'variable': conversion from 'size_t' to 'type', possible loss of data + "4355", -- 'this': used in base member initializer list + "4365", -- 'expression': conversion from 'type1' to 'type2', signed/unsigned mismatch + "4388", -- 'expression': signed/unsigned mismatch + "4389", -- 'operator': signed/unsigned mismatch + "4458", -- declaration of 'identifier' hides class member + "4514", -- 'function': unreferenced inline function has been removed + "4583", -- 'Catch::clara::detail::ResultValueBase::m_value': destructor is not + -- implicitly called + "4623", -- 'Catch::AssertionInfo': default constructor was implicitly defined as deleted + "4625", -- 'derived class': copy constructor was implicitly defined as deleted because a + -- base class copy constructor is inaccessible or deleted + "4626", -- 'derived class': assignment operator was implicitly defined as deleted + -- because a base class assignment operator is inaccessible or deleted + "4820", -- 'bytes' bytes padding added after construct 'member_name' + "4868", -- (catch.hpp) compiler may not enforce left-to-right evaluation order in braced + -- initializer list + "5026", -- 'type': move constructor was implicitly defined as deleted + "5027", -- 'type': move assignment operator was implicitly defined as deleted + "5039", -- (catch.hpp) 'AddVectoredExceptionHandler': pointer or reference to + -- potentially throwing function passed to 'extern "C"' function under -EHc. + -- Undefined behavior may occur if this function throws an exception. + "5045", -- Compiler will insert Spectre mitigation for memory load if /Qspectre switch + -- specified + "5204", -- 'Catch::Matchers::Impl::MatcherMethod': class has virtual functions, but + -- its trivial destructor is not virtual; instances of objects derived from this + -- class may not be destructed correctly + "5219", -- implicit conversion from 'type-1' to 'type-2', possible loss of data + "5262", -- MSVC\14.34.31933\include\atomic(917,9): implicit fall-through occurs here; + -- are you missing a break statement? + "5264", -- 'rive::math::PI': 'const' variable is not used + "4647", -- behavior change: __is_pod(rive::Vec2D) has different value in previous versions + } +end + +filter{} + +-- Don't use filter() here because we don't want to generate the "android_ndk" toolset if not +-- building for android. +if _OPTIONS["os"] == "android" +then + pic "on" -- Position-independent code is required for NDK libraries. + + local ndk = os.getenv("NDK_PATH") + if not ndk or ndk == "" then + error("export $NDK_PATH") + end + + local ndk_toolchain = ndk .. "/toolchains/llvm/prebuilt" + if os.host() == 'windows' then + ndk_toolchain = ndk_toolchain .. "/windows-x86_64" + elseif os.host() == 'macosx' then + ndk_toolchain = ndk_toolchain .. "/darwin-x86_64" + else + ndk_toolchain = ndk_toolchain .. "/linux-x86_64" + end + + -- clone the clang toolset into a custom one called "android_ndk". + premake.tools.android_ndk = {} + for k,v in pairs(premake.tools.clang) do + premake.tools.android_ndk[k] = v + end + + -- update the android_ndk toolset to use the appropriate binaries. + local android_ndk_tools = { + cc = ndk_toolchain .. "/bin/clang", + cxx = ndk_toolchain .. "/bin/clang++", + ar = ndk_toolchain .. "/bin/llvm-ar" + } + function premake.tools.android_ndk.gettoolname(cfg, tool) + return android_ndk_tools[tool] + end + + toolset "android_ndk" + + buildoptions { + "--sysroot=" .. ndk_toolchain .. "/sysroot", + "-fdata-sections", + "-ffunction-sections", + "-funwind-tables", + "-fstack-protector-strong", + "-no-canonical-prefixes", + } + + linkoptions { + "--sysroot=" .. ndk_toolchain .. "/sysroot", + "-fdata-sections", + "-ffunction-sections", + "-funwind-tables", + "-fstack-protector-strong", + "-no-canonical-prefixes", + "-Wl,--fatal-warnings", + "-Wl,--gc-sections", + "-Wl,--no-rosegment", + "-Wl,--no-undefined", + "-static-libstdc++", + } + + filter "options:arch=x86" + do + architecture "x86" + buildoptions {"--target=i686-none-linux-android21"} + linkoptions {"--target=i686-none-linux-android21"} + end + filter "options:arch=x64" + do + architecture "x64" + buildoptions {"--target=x86_64-none-linux-android21"} + linkoptions {"--target=x86_64-none-linux-android21"} + end + filter "options:arch=arm" + do + architecture "arm" + buildoptions {"--target=armv7a-none-linux-android21"} + linkoptions {"--target=armv7a-none-linux-android21"} + end + filter "options:arch=arm64" + do + architecture "arm64" + buildoptions {"--target=aarch64-none-linux-android21"} + linkoptions {"--target=aarch64-none-linux-android21"} + end + + filter {} +end + +if os.host() == 'macosx' then + iphoneos_sysroot = os.outputof('xcrun --sdk iphoneos --show-sdk-path') + iphonesimulator_sysroot = os.outputof('xcrun --sdk iphonesimulator --show-sdk-path') + + filter 'system:ios' + do + buildoptions {'-fembed-bitcode '} + end + + filter {'system:ios', 'options:variant=system'} + do + buildoptions { + '--target=arm64-apple-ios13.0.0', + '-mios-version-min=13.0.0', + '-isysroot ' .. iphoneos_sysroot + } + end + + filter {'system:ios', 'options:variant=emulator'} + do + buildoptions { + '--target=arm64-apple-ios13.0.0-simulator', + '-mios-version-min=13.0.0', + '-isysroot ' .. iphonesimulator_sysroot + } + end + + filter "system:macosx" + do + buildoptions {"-fobjc-arc"} + end + + filter {'system:macosx', 'options:arch=arm64 or arch=universal'} + do + buildoptions {'-arch arm64'} + end + + filter {'system:macosx', 'options:arch=x64 or arch=universal'} + do + buildoptions {'-arch x86_64'} + end + + filter {'system:ios', 'options:variant=system', 'options:arch=arm64 or arch=universal'} + do + buildoptions {'-arch arm64'} + end + + filter {'system:ios', 'options:variant=emulator', 'options:arch=x64 or arch=universal'} + do + buildoptions {'-arch x86_64'} + end + + filter {'system:ios', 'options:variant=emulator', 'options:arch=arm64 or arch=universal'} + do + buildoptions {'-arch arm64'} + end + + filter{} +end + +if _OPTIONS['arch'] == 'wasm' or _OPTIONS['arch'] == 'js' +then + -- Target emscripten via https://github.com/TurkeyMan/premake-emscripten.git + -- Premake doesn't properly load the _preload.lua for this module, so we load it here manually. + -- BUG: https://github.com/premake/premake-core/issues/1235 + require "premake-emscripten/_preload" + require "premake-emscripten/emscripten" + system "emscripten" + toolset "emcc" + + linkoptions { + "-sALLOW_MEMORY_GROWTH", + } + + filter "options:arch=wasm" + do + buildoptions { + "-msimd128", + } + linkoptions { + "-sWASM=1", + } + end + + filter "options:arch=js" + do + linkoptions { + "-sWASM=0", + } + end + + filter{} +end diff --git a/cg_renderer/build/premake5.lua b/cg_renderer/build/premake5.lua deleted file mode 100644 index 5524bf9a..00000000 --- a/cg_renderer/build/premake5.lua +++ /dev/null @@ -1,125 +0,0 @@ -workspace 'rive' -configurations {'debug', 'release'} - -require 'setup_compiler' - -dependencies = os.getenv('DEPENDENCIES') - -project 'rive_cg_renderer' -do - kind 'StaticLib' - language 'C++' - cppdialect 'C++17' - targetdir '%{cfg.system}/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/obj/%{cfg.buildcfg}' - includedirs { - '../include', - '../../include', - } - - libdirs {'../../../build/%{cfg.system}/bin/%{cfg.buildcfg}'} - - files { - '../src/**.cpp', - } - - flags { - 'FatalCompileWarnings', - } - - filter "system:windows" - do - architecture 'x64' - defines {'_USE_MATH_DEFINES'} - end - - filter {'system:macosx', 'options:variant=runtime'} - do - buildoptions { - '-fembed-bitcode -arch arm64 -arch x86_64', - } - end - - if os.host() == 'macosx' then - iphoneos_sysroot = os.outputof('xcrun --sdk iphoneos --show-sdk-path') - iphonesimulator_sysroot = os.outputof('xcrun --sdk iphonesimulator --show-sdk-path') - - filter {'system:ios', 'options:variant=system'} - do - buildoptions { - '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. iphoneos_sysroot - } - end - - filter {'system:ios', 'options:variant=emulator'} - do - buildoptions { - '--target=arm64-apple-ios13.0.0-simulator -mios-version-min=13.0 -arch x86_64 -arch arm64 -isysroot ' .. - iphonesimulator_sysroot - } - targetdir '%{cfg.system}_sim/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}_sim/obj/%{cfg.buildcfg}' - end - end - - filter {'configurations:release', 'system:macosx'} - do - buildoptions {'-flto=full'} - end - - filter {'configurations:release', 'system:android'} - do - buildoptions {'-flto=full'} - end - - filter {'configurations:release', 'system:ios'} - do - buildoptions {'-flto=full'} - end - - filter 'configurations:debug' - do - defines {'DEBUG'} - symbols 'On' - end - - filter 'configurations:release' - do - defines {'RELEASE', 'NDEBUG'} - optimize 'On' - end - - filter {'options:with_rive_text'} - do - defines {'WITH_RIVE_TEXT'} - end -end - -newoption { - trigger = 'with_rive_text', - description = 'Enables text experiments' -} - -newoption { - trigger = 'variant', - value = 'type', - description = 'Choose a particular variant to build', - allowed = { - {'system', 'Builds the static library for the provided system'}, - {'emulator', 'Builds for an emulator/simulator for the provided system'}, - {'runtime', 'Build the static library specifically targeting our runtimes'} - }, - default = 'system' -} - -newoption { - trigger = 'arch', - value = 'ABI', - description = 'The ABI with the right toolchain for this build, generally with Android', - allowed = { - {'x86'}, - {'x64'}, - {'arm'}, - {'arm64'} - } -} diff --git a/cg_renderer/premake5.lua b/cg_renderer/premake5.lua new file mode 100644 index 00000000..51507a51 --- /dev/null +++ b/cg_renderer/premake5.lua @@ -0,0 +1,65 @@ +dofile 'rive_build_config.lua' + +dependencies = os.getenv('DEPENDENCIES') + +project 'rive_cg_renderer' +do + kind 'StaticLib' + includedirs { + 'include', + '../include', + } + + libdirs {'../../build/%{cfg.system}/bin/' .. RIVE_BUILD_CONFIG} + + files { + 'src/**.cpp', + } + + flags { + 'FatalCompileWarnings', + } + + filter "system:windows" + do + architecture 'x64' + defines {'_USE_MATH_DEFINES'} + end + + filter {'system:macosx', 'options:variant=runtime'} + do + buildoptions { + '-fembed-bitcode -arch arm64 -arch x86_64', + } + end + + if os.host() == 'macosx' then + iphoneos_sysroot = os.outputof('xcrun --sdk iphoneos --show-sdk-path') + iphonesimulator_sysroot = os.outputof('xcrun --sdk iphonesimulator --show-sdk-path') + + filter {'system:ios', 'options:variant=system'} + do + buildoptions { + '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. iphoneos_sysroot + } + end + + filter {'system:ios', 'options:variant=emulator'} + do + buildoptions { + '--target=arm64-apple-ios13.0.0-simulator -mios-version-min=13.0 -arch x86_64 -arch arm64 -isysroot ' .. + iphonesimulator_sysroot + } + end + end + + filter {'options:with_rive_text'} + do + defines {'WITH_RIVE_TEXT'} + end +end + +newoption { + trigger = 'with_rive_text', + description = 'Enables text experiments' +} diff --git a/decoders/premake5_v2.lua b/decoders/premake5_v2.lua new file mode 100644 index 00000000..7338bdc2 --- /dev/null +++ b/decoders/premake5_v2.lua @@ -0,0 +1,20 @@ +dofile 'setup_compiler.lua' + +rive = path.getabsolute("../") + +dofile(rive .. '/dependencies/premake5_libpng_v2.lua') + +project 'rive_decoders' + dependson 'libpng' + kind 'StaticLib' + flags { "FatalWarnings" } + + includedirs { + 'include', + '../include', + libpng, + } + + files { + 'src/**.cpp' + } diff --git a/dependencies/premake5_harfbuzz_v2.lua b/dependencies/premake5_harfbuzz_v2.lua new file mode 100644 index 00000000..6c5a52be --- /dev/null +++ b/dependencies/premake5_harfbuzz_v2.lua @@ -0,0 +1,247 @@ +dofile 'rive_build_config.lua' + +local dependency = require 'dependency' +harfbuzz = dependency.github('harfbuzz/harfbuzz', '6.0.0') + +project 'rive_harfbuzz' +do + kind 'StaticLib' + + 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-shaper-arabic-fallback.hh', + harfbuzz .. '/src/hb-ot-shaper-arabic-joining-list.hh', + harfbuzz .. '/src/hb-ot-shaper-arabic-pua.hh', + harfbuzz .. '/src/hb-ot-shaper-arabic-table.hh', + harfbuzz .. '/src/hb-ot-shaper-arabic-win1256.hh', + harfbuzz .. '/src/hb-ot-shaper-arabic.cc', + harfbuzz .. '/src/hb-ot-shaper-arabic.hh', + harfbuzz .. '/src/hb-ot-shaper-default.cc', + harfbuzz .. '/src/hb-ot-shaper-hangul.cc', + harfbuzz .. '/src/hb-ot-shaper-hebrew.cc', + harfbuzz .. '/src/hb-ot-shaper-indic-table.cc', + harfbuzz .. '/src/hb-ot-shaper-indic.cc', + harfbuzz .. '/src/hb-ot-shaper-indic.hh', + harfbuzz .. '/src/hb-ot-shaper-khmer.cc', + harfbuzz .. '/src/hb-ot-shaper-myanmar.cc', + harfbuzz .. '/src/hb-ot-shaper-syllabic.cc', + harfbuzz .. '/src/hb-ot-shaper-syllabic.hh', + harfbuzz .. '/src/hb-ot-shaper-thai.cc', + harfbuzz .. '/src/hb-ot-shaper-use-table.hh', + harfbuzz .. '/src/hb-ot-shaper-use.cc', + harfbuzz .. '/src/hb-ot-shaper-vowel-constraints.cc', + harfbuzz .. '/src/hb-ot-shaper-vowel-constraints.hh', + harfbuzz .. '/src/hb-ot-shaper.hh', + harfbuzz .. '/src/hb-ot-shaper-indic-machine.hh', + harfbuzz .. '/src/hb-ot-shaper-khmer-machine.hh', + harfbuzz .. '/src/hb-ot-shaper-myanmar-machine.hh', + harfbuzz .. '/src/hb-ot-shaper-use-machine.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', + harfbuzz .. '/src/graph/gsubgpos-context.cc' + } + + warnings 'Off' + + defines { + 'HAVE_OT', + 'HB_NO_FALLBACK_SHAPE', + 'HB_NO_WIN1256' + } + + filter 'system:emscripten' + do + buildoptions {'-pthread'} + end + + filter 'toolset:clang' + do + flags {'FatalWarnings'} + buildoptions { + '-Werror=format', + '-Wimplicit-int-conversion', + '-Werror=vla' + } + end + + filter 'options:config=release' + do + optimize 'Size' + end +end diff --git a/dependencies/premake5_libpng_v2.lua b/dependencies/premake5_libpng_v2.lua new file mode 100644 index 00000000..afbcf612 --- /dev/null +++ b/dependencies/premake5_libpng_v2.lua @@ -0,0 +1,72 @@ +dofile 'rive_build_config.lua' + +local dependency = require 'dependency' +libpng = dependency.github('glennrp/libpng', 'libpng16') +zlib = dependency.github('madler/zlib', '04f42ceca40f73e2978b50e93806c2a18c1281fc') + +project 'libpng' +do + kind 'StaticLib' + os.copyfile(libpng .. '/scripts/pnglibconf.h.prebuilt', libpng .. '/pnglibconf.h') + includedirs { + './', + libpng, + zlib, + } + files { + libpng .. '/png.c', + libpng .. '/pngerror.c', + libpng .. '/pngget.c', + libpng .. '/pngmem.c', + libpng .. '/pngpread.c', + libpng .. '/pngread.c', + libpng .. '/pngrio.c', + libpng .. '/pngrtran.c', + libpng .. '/pngrutil.c', + libpng .. '/pngset.c', + libpng .. '/pngtrans.c', + libpng .. '/pngwio.c', + libpng .. '/pngwrite.c', + libpng .. '/pngwtran.c', + libpng .. '/pngwutil.c' + } + + do + files { + libpng .. '/arm/arm_init.c', + libpng .. '/arm/filter_neon_intrinsics.c', + libpng .. '/arm/palette_neon_intrinsics.c' + } + end +end + +project 'zlib' +do + kind 'StaticLib' + defines {'ZLIB_IMPLEMENTATION'} + includedirs { + zlib + } + files { + zlib .. '/adler32.c', + zlib .. '/compress.c', + zlib .. '/crc32.c', + zlib .. '/deflate.c', + zlib .. '/gzclose.c', + zlib .. '/gzlib.c', + zlib .. '/gzread.c', + zlib .. '/gzwrite.c', + zlib .. '/infback.c', + zlib .. '/inffast.c', + zlib .. '/inftrees.c', + zlib .. '/trees.c', + zlib .. '/uncompr.c', + zlib .. '/zutil.c', + zlib .. '/inflate.c' + } + + filter 'system:not windows' + do + defines {'HAVE_UNISTD_H'} + end +end diff --git a/dependencies/premake5_miniaudio_v2.lua b/dependencies/premake5_miniaudio_v2.lua new file mode 100644 index 00000000..d3d073eb --- /dev/null +++ b/dependencies/premake5_miniaudio_v2.lua @@ -0,0 +1,3 @@ +dofile 'rive_build_config.lua' +local dependency = require 'dependency' +miniaudio = dependency.github('rive-app/miniaudio', 'rive') diff --git a/dependencies/premake5_sheenbidi_v2.lua b/dependencies/premake5_sheenbidi_v2.lua new file mode 100644 index 00000000..ea851791 --- /dev/null +++ b/dependencies/premake5_sheenbidi_v2.lua @@ -0,0 +1,65 @@ +dofile "rive_build_config.lua" + +local dependency = require 'dependency' +sheenbidi = dependency.github('Tehreer/SheenBidi', 'v2.6') + +project 'rive_sheenbidi' +do + kind 'StaticLib' + language 'C' + warnings 'Off' + + includedirs { + sheenbidi .. '/Headers' + } + + buildoptions { + '-Wall', + '-ansi', + '-pedantic' + } + + linkoptions {'-r'} + + filter 'system:emscripten' + do + buildoptions {'-pthread'} + end + + filter 'options:config=debug' + do + files { + sheenbidi .. '/Source/BidiChain.c', + sheenbidi .. '/Source/BidiTypeLookup.c', + sheenbidi .. '/Source/BracketQueue.c', + sheenbidi .. '/Source/GeneralCategoryLookup.c', + sheenbidi .. '/Source/IsolatingRun.c', + sheenbidi .. '/Source/LevelRun.c', + sheenbidi .. '/Source/PairingLookup.c', + sheenbidi .. '/Source/RunQueue.c', + sheenbidi .. '/Source/SBAlgorithm.c', + sheenbidi .. '/Source/SBBase.c', + sheenbidi .. '/Source/SBCodepointSequence.c', + sheenbidi .. '/Source/SBLine.c', + sheenbidi .. '/Source/SBLog.c', + sheenbidi .. '/Source/SBMirrorLocator.c', + sheenbidi .. '/Source/SBParagraph.c', + sheenbidi .. '/Source/SBScriptLocator.c', + sheenbidi .. '/Source/ScriptLookup.c', + sheenbidi .. '/Source/ScriptStack.c', + sheenbidi .. '/Source/StatusStack.c' + } + end + filter 'options:config=release' + do + files { + sheenbidi .. '/Source/SheenBidi.c' + } + end + + filter 'options:config=release' + do + defines {'SB_CONFIG_UNITY'} + optimize 'Size' + end +end diff --git a/premake5_v2.lua b/premake5_v2.lua new file mode 100644 index 00000000..f253bc93 --- /dev/null +++ b/premake5_v2.lua @@ -0,0 +1,135 @@ +dofile 'rive_build_config.lua' + +filter {'options:with_rive_tools'} +do + defines {'WITH_RIVE_TOOLS'} +end +filter {'options:with_rive_text'} +do + defines {'WITH_RIVE_TEXT'} +end +filter {} +filter {'options:with_rive_audio=system'} +do + defines {'WITH_RIVE_AUDIO'} +end +filter {'options:with_rive_audio=external'} +do + defines {'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO'} +end +filter {} + +dofile(path.join(path.getabsolute('dependencies/'), 'premake5_harfbuzz_v2.lua')) +dofile(path.join(path.getabsolute('dependencies/'), 'premake5_sheenbidi_v2.lua')) +dofile(path.join(path.getabsolute('dependencies/'), 'premake5_miniaudio_v2.lua')) + +project 'rive' +do + kind 'StaticLib' + cppdialect 'C++11' + includedirs { + 'include', + harfbuzz .. '/src', + sheenbidi .. '/Headers', + miniaudio + } + + files {'src/**.cpp'} + + flags { + 'FatalCompileWarnings' + } + + filter {'system:macosx'} + do + buildoptions { + -- this triggers too much on linux, so just enable here for now + '-Wimplicit-float-conversion' + } + end + + -- filter {'toolset:not msc', 'files:src/audio/audio_engine.cpp'} + filter {'system:not windows', 'files:src/audio/audio_engine.cpp'} + do + buildoptions { + '-Wno-implicit-int-conversion' + } + end + + filter {'system:windows', 'files:src/audio/audio_engine.cpp'} + do + -- Too many warnings from miniaudio.h + removeflags {'FatalCompileWarnings'} + end + + -- filter 'files:src/audio/audio_engine.cpp' + -- do + -- buildoptions { + -- '-Wno-implicit-int-conversion' + -- } + -- end + + filter {'system:macosx', 'options:variant=runtime'} + do + buildoptions { + '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' .. + (os.getenv('MACOS_SYSROOT') or '') + } + end + + filter {'system:ios'} + do + buildoptions {'-flto=full', '-Wno-implicit-int-conversion'} + files {'src/audio/audio_engine.m'} + end + + filter 'system:windows' + do + architecture 'x64' + defines {'_USE_MATH_DEFINES'} + end + + filter 'system:emscripten' + do + buildoptions {'-pthread'} + end +end + +newoption { + trigger = 'variant', + value = 'type', + description = 'Choose a particular variant to build', + allowed = { + {'system', 'Builds the static library for the provided system'}, + {'emulator', 'Builds for an emulator/simulator for the provided system'}, + {'runtime', 'Build the static library specifically targeting our runtimes'} + }, + default = 'system' +} + +newoption { + trigger = 'with_rive_tools', + description = 'Enables tools usually not necessary for runtime.' +} + +newoption { + trigger = 'with_rive_text', + description = 'Compiles in text features.' +} + +newoption { + trigger = 'with_rive_audio', + value = 'disabled', + description = 'The audio mode to use.', + allowed = { + { + 'disabled' + }, + { + 'system' + }, + { + 'external' + } + } +} diff --git a/skia/renderer/build/macosx/build_skia_renderer.sh b/skia/renderer/build/macosx/build_skia_renderer.sh deleted file mode 100755 index fe9a3b49..00000000 --- a/skia/renderer/build/macosx/build_skia_renderer.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/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/skia/renderer/premake5_v2.lua b/skia/renderer/premake5_v2.lua new file mode 100644 index 00000000..e4daa874 --- /dev/null +++ b/skia/renderer/premake5_v2.lua @@ -0,0 +1,99 @@ +dofile 'rive_build_config.lua' + +SKIA_DIR = os.getenv('SKIA_DIR') +dependencies = os.getenv('DEPENDENCIES') + +if SKIA_DIR == nil and dependencies ~= nil then + SKIA_DIR = dependencies .. '/skia' +else + if SKIA_DIR == nil then + SKIA_DIR = 'skia' + end + SKIA_DIR = '../dependencies/' .. SKIA_DIR +end + +project 'rive_skia_renderer' +do + kind 'StaticLib' + includedirs { + 'include', + '../../cg_renderer/include', + '../../include' + } + + libdirs {'../../build/%{cfg.system}/bin/' .. RIVE_BUILD_CONFIG} + + files { + 'src/**.cpp' + } + + flags { + 'FatalCompileWarnings' + } + + filter {'system:macosx or linux or windows or ios'} + do + includedirs {SKIA_DIR} + libdirs {SKIA_DIR .. '/out/static'} + end + + filter {'system:android'} + do + includedirs {SKIA_DIR} + + filter {'system:android', 'options:arch=x86'} + do + libdirs {SKIA_DIR .. '/out/x86'} + end + + filter {'system:android', 'options:arch=x64'} + do + libdirs {SKIA_DIR .. '/out/x64'} + end + + filter {'system:android', 'options:arch=arm'} + do + libdirs {SKIA_DIR .. '/out/arm'} + end + + filter {'system:android', 'options:arch=arm64'} + do + libdirs {SKIA_DIR .. '/out/arm64'} + end + end + + filter {'options:with_rive_text'} + do + defines {'WITH_RIVE_TEXT'} + end + filter {'options:with_rive_audio=system'} + do + defines {'WITH_RIVE_AUDIO'} + end + filter {'options:with_rive_audio=external'} + do + defines {'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO'} + end +end + +newoption { + trigger = 'with_rive_text', + description = 'Enables text experiments' +} + +newoption { + trigger = 'with_rive_audio', + value = 'disabled', + description = 'The audio mode to use.', + allowed = { + { + 'disabled' + }, + { + 'system' + }, + { + 'external' + } + } +}