diff --git a/.rive_head b/.rive_head index 2c71c3eb..7ba5f38d 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -b8875ef3109298913c20335cfb70eb9831f1703f +858215cc481f86081b04390b67304f932fc45d10 diff --git a/build/dependency.lua b/build/dependency.lua index a3093bc9..fe609d25 100644 --- a/build/dependency.lua +++ b/build/dependency.lua @@ -9,10 +9,7 @@ function iop(str) last_str = str end -newoption { - trigger = 'no-download-progress', - description = 'Hide progress?', -} +newoption({ trigger = 'no-download-progress', description = 'Hide progress?' }) function m.github(project, tag) local dependencies = os.getenv('DEPENDENCIES') @@ -39,7 +36,11 @@ function m.github(project, tag) downloadFilename, -- Download progress explodes the github logs with megabytes of text. -- github runners have a "CI" environment variable. - {progress = not _OPTIONS['no-download-progress'] and os.getenv('CI' ) ~= "true" and progress} + { + progress = not _OPTIONS['no-download-progress'] + and os.getenv('CI') ~= 'true' + and progress, + } ) print('Downloaded ' .. project .. '.') zip.extract(downloadFilename, dependencies .. '/' .. hash) diff --git a/build/premake5.lua b/build/premake5.lua index 9580b97e..4c34b540 100644 --- a/build/premake5.lua +++ b/build/premake5.lua @@ -1,71 +1,67 @@ -workspace 'rive' -configurations {'debug', 'release'} +workspace('rive') +configurations({ 'debug', 'release' }) -require 'setup_compiler' +require('setup_compiler') -filter {'options:with_rive_tools'} +filter({ 'options:with_rive_tools' }) do - defines {'WITH_RIVE_TOOLS'} + defines({ 'WITH_RIVE_TOOLS' }) end -filter {'options:with_rive_text'} +filter({ 'options:with_rive_text' }) do - defines {'WITH_RIVE_TEXT'} + defines({ 'WITH_RIVE_TEXT' }) end -filter {} -filter {'options:with_rive_audio=system'} +filter({}) +filter({ 'options:with_rive_audio=system' }) do - defines {'WITH_RIVE_AUDIO'} + defines({ 'WITH_RIVE_AUDIO' }) end -filter {'options:with_rive_audio=external'} +filter({ 'options:with_rive_audio=external' }) do - defines {'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO'} + defines({ 'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO' }) end -filter {} +filter({}) dofile(path.join(path.getabsolute('../dependencies/'), 'premake5_harfbuzz.lua')) dofile(path.join(path.getabsolute('../dependencies/'), 'premake5_sheenbidi.lua')) dofile(path.join(path.getabsolute('../dependencies/'), 'premake5_miniaudio.lua')) -project 'rive' +project('rive') do - kind 'StaticLib' - language 'C++' - cppdialect 'C++11' - targetdir '%{cfg.system}/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/obj/%{cfg.buildcfg}' - includedirs { + kind('StaticLib') + language('C++') + cppdialect('C++11') + targetdir('%{cfg.system}/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/obj/%{cfg.buildcfg}') + includedirs({ '../include', harfbuzz .. '/src', sheenbidi .. '/Headers', - miniaudio - } + miniaudio, + }) - files {'../src/**.cpp'} + files({ '../src/**.cpp' }) - flags { - 'FatalCompileWarnings' - } + flags({ 'FatalCompileWarnings' }) - filter {'system:macosx'} + filter({ 'system:macosx' }) do - buildoptions { + buildoptions({ -- this triggers too much on linux, so just enable here for now - '-Wimplicit-float-conversion' - } + '-Wimplicit-float-conversion', + }) end -- filter {'toolset:not msc', 'files:../src/audio/audio_engine.cpp'} - filter {'system:not windows', 'files:../src/audio/audio_engine.cpp'} + filter({ 'system:not windows', 'files:../src/audio/audio_engine.cpp' }) do - buildoptions { - '-Wno-implicit-int-conversion' - } + buildoptions({ '-Wno-implicit-int-conversion' }) end - filter {'system:windows', 'files:../src/audio/audio_engine.cpp'} + filter({ 'system:windows', 'files:../src/audio/audio_engine.cpp' }) do -- Too many warnings from miniaudio.h - removeflags {'FatalCompileWarnings'} + removeflags({ 'FatalCompileWarnings' }) end -- filter 'files:../src/audio/audio_engine.cpp' @@ -75,137 +71,132 @@ do -- } -- end - filter {'system:macosx', 'options:variant=runtime'} + filter({ 'system:macosx', 'options:variant=runtime' }) do - buildoptions { - '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' .. - (os.getenv('MACOS_SYSROOT') or '') - } + buildoptions({ + '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('MACOS_SYSROOT') or ''), + }) end - filter {'system:macosx', 'configurations:release'} + filter({ 'system:macosx', 'configurations:release' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter {'system:ios'} + filter({ 'system:ios' }) do - buildoptions {'-flto=full', '-Wno-implicit-int-conversion'} - files {'../src/audio/audio_engine.m'} + buildoptions({ '-flto=full', '-Wno-implicit-int-conversion' }) + files({ '../src/audio/audio_engine.m' }) end - filter 'system:windows' + filter('system:windows') do - architecture 'x64' - defines {'_USE_MATH_DEFINES'} + architecture('x64') + defines({ '_USE_MATH_DEFINES' }) end - filter {'system:ios', 'options:variant=system'} + filter({ 'system:ios', 'options:variant=system' }) do - buildoptions { - '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. (os.getenv('IOS_SYSROOT') or '') - } + buildoptions({ + '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) end - filter {'system:ios', 'options:variant=emulator'} + filter({ 'system:ios', 'options:variant=emulator' }) do - buildoptions { + buildoptions({ '--target=arm64-apple-ios13.0.0-simulator', - '-mios-version-min=13.0 -arch arm64 -arch x86_64 -isysroot ' .. (os.getenv('IOS_SYSROOT') or '') - } - targetdir '%{cfg.system}_sim/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}_sim/obj/%{cfg.buildcfg}' + '-mios-version-min=13.0 -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) + targetdir('%{cfg.system}_sim/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}_sim/obj/%{cfg.buildcfg}') end - filter {'system:android', 'configurations:release'} + filter({ 'system:android', 'configurations:release' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end -- Is there a way to pass 'arch' as a variable here? - filter {'system:android', 'options:arch=x86'} + filter({ 'system:android', 'options:arch=x86' }) do - targetdir '%{cfg.system}/x86/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/x86/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/x86/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/x86/obj/%{cfg.buildcfg}') -- Ignore fatal warning for miniaudio on x86 devices. - filter {'files:../src/audio/audio_engine.cpp'} + filter({ 'files:../src/audio/audio_engine.cpp' }) do - buildoptions {'-Wno-atomic-alignment'} + buildoptions({ '-Wno-atomic-alignment' }) end end - filter {'system:android', 'options:arch=x64'} + filter({ 'system:android', 'options:arch=x64' }) do - targetdir '%{cfg.system}/x64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/x64/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/x64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/x64/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=arm'} + filter({ 'system:android', 'options:arch=arm' }) do - targetdir '%{cfg.system}/arm/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/arm/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/arm/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/arm/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=arm64'} + filter({ 'system:android', 'options:arch=arm64' }) do - targetdir '%{cfg.system}/arm64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/arm64/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/arm64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/arm64/obj/%{cfg.buildcfg}') end - filter 'system:emscripten' + filter('system:emscripten') do - buildoptions {'-pthread'} + buildoptions({ '-pthread' }) end - filter 'configurations:debug' + filter('configurations:debug') do - defines {'DEBUG'} - symbols 'On' + defines({ 'DEBUG' }) + symbols('On') end - filter 'configurations:release' + filter('configurations:release') do - defines {'RELEASE'} - defines {'NDEBUG'} - optimize 'On' + defines({ 'RELEASE' }) + defines({ 'NDEBUG' }) + optimize('On') end end -newoption { +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'} + { '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' -} + default = 'system', +}) -newoption { +newoption({ trigger = 'with_rive_tools', - description = 'Enables tools usually not necessary for runtime.' -} + description = 'Enables tools usually not necessary for runtime.', +}) -newoption { +newoption({ trigger = 'with_rive_text', - description = 'Compiles in text features.' -} + description = 'Compiles in text features.', +}) -newoption { +newoption({ trigger = 'with_rive_audio', value = 'disabled', description = 'The audio mode to use.', - allowed = { - { - 'disabled' - }, - { - 'system' - }, - { - 'external' - } - } -} + allowed = { { 'disabled' }, { 'system' }, { 'external' } }, +}) diff --git a/build/rive_build_config.lua b/build/rive_build_config.lua index bff74eb3..8d7e1e26 100644 --- a/build/rive_build_config.lua +++ b/build/rive_build_config.lua @@ -1,126 +1,124 @@ -workspace 'rive' +workspace('rive') -newoption { - trigger = "config", - description = "one-and-only config (for multiple configs, target a new --out directory)", - allowed = {{'debug'}, {'release'}, {nil}}, +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)") +}) +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" + _OPTIONS['config'] = 'release' + _OPTIONS['release'] = nil +elseif not _OPTIONS['config'] then + _OPTIONS['config'] = 'debug' end -RIVE_BUILD_CONFIG = _OPTIONS["config"] +RIVE_BUILD_CONFIG = _OPTIONS['config'] -newoption { - trigger = "out", - description = "Directory to generate build files", +newoption({ + trigger = 'out', + description = 'Directory to generate build files', default = nil, -} -RIVE_BUILD_OUT = _OPTIONS["out"] or ("out/" .. RIVE_BUILD_CONFIG) +}) +RIVE_BUILD_OUT = _OPTIONS['out'] or ('out/' .. RIVE_BUILD_CONFIG) -newoption { +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'} + { 'clang', 'Build with Clang' }, + { 'msc', 'Build with the Microsoft C/C++ compiler' }, }, default = 'clang', -} +}) -newoption { +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'} + { 'host' }, + { 'x86' }, + { 'x64' }, + { 'arm' }, + { 'arm64' }, + { 'universal', '"fat" library on apple platforms' }, + { 'wasm', 'emscripten targeting web assembly' }, + { 'js', 'emscripten targeting javascript' }, }, default = 'host', -} +}) -newoption { +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'} + { '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' +}) + +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' + defines({ 'DEBUG' }) + symbols('On') end -filter 'options:config=release' +filter('options:config=release') do - defines {'RELEASE'} - defines {'NDEBUG'} - optimize 'On' + defines({ 'RELEASE' }) + defines({ 'NDEBUG' }) + optimize('On') end -filter {'system:not windows', 'options:config=release'} +filter({ 'system:not windows', 'options:config=release' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end -filter 'system:windows' +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'} + 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'} +filter({ 'system:windows', 'options:toolset=clang' }) do - buildoptions { + buildoptions({ '-Wno-c++98-compat', '-Wno-c++20-compat', '-Wno-c++98-compat-pedantic', @@ -148,238 +146,240 @@ do '-Wno-unreachable-code', '-Wno-switch-enum', '-Wno-missing-field-initializers', - '-Wno-unsafe-buffer-usage' - } + '-Wno-unsafe-buffer-usage', + }) end -filter {'system:windows', 'options:toolset=msc'} +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 - } + 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{} +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. +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") + local ndk = os.getenv('NDK_PATH') + if not ndk or ndk == '' then + error('export $NDK_PATH') end - local ndk_toolchain = ndk .. "/toolchains/llvm/prebuilt" + local ndk_toolchain = ndk .. '/toolchains/llvm/prebuilt' if os.host() == 'windows' then - ndk_toolchain = ndk_toolchain .. "/windows-x86_64" + ndk_toolchain = ndk_toolchain .. '/windows-x86_64' elseif os.host() == 'macosx' then - ndk_toolchain = ndk_toolchain .. "/darwin-x86_64" + ndk_toolchain = ndk_toolchain .. '/darwin-x86_64' else - ndk_toolchain = ndk_toolchain .. "/linux-x86_64" + 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 + 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" + 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" + 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"} + architecture('x86') + buildoptions({ '--target=i686-none-linux-android21' }) + linkoptions({ '--target=i686-none-linux-android21' }) end - filter "options:arch=x64" + filter('options:arch=x64') do - architecture "x64" - buildoptions {"--target=x86_64-none-linux-android21"} - linkoptions {"--target=x86_64-none-linux-android21"} + architecture('x64') + buildoptions({ '--target=x86_64-none-linux-android21' }) + linkoptions({ '--target=x86_64-none-linux-android21' }) end - filter "options:arch=arm" + filter('options:arch=arm') do - architecture "arm" - buildoptions {"--target=armv7a-none-linux-android21"} - linkoptions {"--target=armv7a-none-linux-android21"} + architecture('arm') + buildoptions({ '--target=armv7a-none-linux-android21' }) + linkoptions({ '--target=armv7a-none-linux-android21' }) end - filter "options:arch=arm64" + filter('options:arch=arm64') do - architecture "arm64" - buildoptions {"--target=aarch64-none-linux-android21"} - linkoptions {"--target=aarch64-none-linux-android21"} + architecture('arm64') + buildoptions({ '--target=aarch64-none-linux-android21' }) + linkoptions({ '--target=aarch64-none-linux-android21' }) end - filter {} + 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' + filter('system:ios') do - buildoptions {'-fembed-bitcode '} + buildoptions({ '-fembed-bitcode ' }) end - filter {'system:ios', 'options:variant=system'} + filter({ 'system:ios', 'options:variant=system' }) do - buildoptions { + buildoptions({ '--target=arm64-apple-ios13.0.0', '-mios-version-min=13.0.0', - '-isysroot ' .. iphoneos_sysroot - } + '-isysroot ' .. iphoneos_sysroot, + }) end - filter {'system:ios', 'options:variant=emulator'} + filter({ 'system:ios', 'options:variant=emulator' }) do - buildoptions { + buildoptions({ '--target=arm64-apple-ios13.0.0-simulator', '-mios-version-min=13.0.0', - '-isysroot ' .. iphonesimulator_sysroot - } + '-isysroot ' .. iphonesimulator_sysroot, + }) end - filter "system:macosx" + filter('system:macosx') do - buildoptions {"-fobjc-arc"} + buildoptions({ '-fobjc-arc' }) end - filter {'system:macosx', 'options:arch=arm64 or arch=universal'} + filter({ 'system:macosx', 'options:arch=arm64 or arch=universal' }) do - buildoptions {'-arch arm64'} + buildoptions({ '-arch arm64' }) end - filter {'system:macosx', 'options:arch=x64 or arch=universal'} + filter({ 'system:macosx', 'options:arch=x64 or arch=universal' }) do - buildoptions {'-arch x86_64'} + buildoptions({ '-arch x86_64' }) end - filter {'system:ios', 'options:variant=system', 'options:arch=arm64 or arch=universal'} + filter({ + 'system:ios', + 'options:variant=system', + 'options:arch=arm64 or arch=universal', + }) do - buildoptions {'-arch arm64'} + buildoptions({ '-arch arm64' }) end - filter {'system:ios', 'options:variant=emulator', 'options:arch=x64 or arch=universal'} + filter({ + 'system:ios', + 'options:variant=emulator', + 'options:arch=x64 or arch=universal', + }) do - buildoptions {'-arch x86_64'} + buildoptions({ '-arch x86_64' }) end - filter {'system:ios', 'options:variant=emulator', 'options:arch=arm64 or arch=universal'} + filter({ + 'system:ios', + 'options:variant=emulator', + 'options:arch=arm64 or arch=universal', + }) do - buildoptions {'-arch arm64'} + buildoptions({ '-arch arm64' }) end - filter{} + filter({}) end -if _OPTIONS['arch'] == 'wasm' or _OPTIONS['arch'] == 'js' -then +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" + require('premake-emscripten/_preload') + require('premake-emscripten/emscripten') + system('emscripten') + toolset('emcc') - linkoptions { - "-sALLOW_MEMORY_GROWTH", - } + linkoptions({ '-sALLOW_MEMORY_GROWTH' }) - filter "options:arch=wasm" + filter('options:arch=wasm') do - buildoptions { - "-msimd128", - } - linkoptions { - "-sWASM=1", - } + buildoptions({ '-msimd128' }) + linkoptions({ '-sWASM=1' }) end - filter "options:arch=js" + filter('options:arch=js') do - linkoptions { - "-sWASM=0", - } + linkoptions({ '-sWASM=0' }) end - filter{} + filter({}) end diff --git a/build/setup_compiler.lua b/build/setup_compiler.lua index 618ce395..88f54630 100644 --- a/build/setup_compiler.lua +++ b/build/setup_compiler.lua @@ -1,66 +1,57 @@ -- https://github.com/TurkeyMan/premake-emscripten.git adds "emscripten" as a valid system, but -- premake5 still doesn't accept "--os=emscripten" from the command line. To work around this we add -- a custom "--wasm" flag that sets system to "emscripten" for us. -newoption { +newoption({ trigger = 'emsdk', value = 'type', description = 'Build with emscripten', allowed = { - {'none', "don't use emscripten"}, - {'wasm', 'build WASM with emscripten'}, - {'js', 'build Javascript with emscripten'}, + { 'none', 'don\'t use emscripten' }, + { 'wasm', 'build WASM with emscripten' }, + { 'js', 'build Javascript with emscripten' }, }, - default = 'none' -} -if _OPTIONS['emsdk'] ~= 'none' -then + default = 'none', +}) +if _OPTIONS['emsdk'] ~= 'none' 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 - dofile "premake-emscripten/_preload.lua" - dofile "premake-emscripten/emscripten.lua" - system "emscripten" - toolset "emcc" + dofile('premake-emscripten/_preload.lua') + dofile('premake-emscripten/emscripten.lua') + system('emscripten') + toolset('emcc') end -filter {'system:emscripten'} +filter({ 'system:emscripten' }) do - linkoptions { - "-sALLOW_MEMORY_GROWTH", - } + linkoptions({ '-sALLOW_MEMORY_GROWTH' }) end -filter {'system:emscripten', 'options:emsdk=wasm'} +filter({ 'system:emscripten', 'options:emsdk=wasm' }) do - buildoptions { - "-msimd128", - } - linkoptions { - "-sWASM=1", - } + buildoptions({ '-msimd128' }) + linkoptions({ '-sWASM=1' }) end -filter {'system:emscripten', 'options:emsdk=js'} +filter({ 'system:emscripten', 'options:emsdk=js' }) do - linkoptions { - "-sWASM=0", - } + linkoptions({ '-sWASM=0' }) end -filter 'system:not emscripten' +filter('system:not emscripten') do - toolset (_OPTIONS["toolset"] or "clang") + toolset(_OPTIONS['toolset'] or 'clang') end -filter 'system:windows' +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) + staticruntime('on') -- Match Skia's /MT flag for link compatibility + runtime('Release') -- Use /MT even in debug (/MTd is incompatible with Skia) end -filter {'system:windows', 'options:toolset=clang'} +filter({ 'system:windows', 'options:toolset=clang' }) do - buildoptions { + buildoptions({ '-Wno-c++98-compat', '-Wno-c++20-compat', '-Wno-c++98-compat-pedantic', @@ -88,179 +79,177 @@ do '-Wno-unreachable-code', '-Wno-switch-enum', '-Wno-missing-field-initializers', - '-Wno-unsafe-buffer-usage' - } + '-Wno-unsafe-buffer-usage', + }) end -filter {'system:windows', 'options:toolset=msc'} +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 - } + 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{} - -newoption { - trigger = "with-rtti", - description = "don't disable rtti (nonstandard for Rive)", -} -newoption { - trigger = "with-exceptions", - description = "don't disable exceptions (nonstandard for Rive)", -} -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{} +filter({}) + +newoption({ + trigger = 'with-rtti', + description = 'don\'t disable rtti (nonstandard for Rive)', +}) +newoption({ + trigger = 'with-exceptions', + description = 'don\'t disable exceptions (nonstandard for Rive)', +}) +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({}) -- 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 - local ndk = os.getenv("NDK_PATH") - if not ndk or ndk == "" then - error("export $NDK_PATH") +if _OPTIONS['os'] == 'android' then + local ndk = os.getenv('NDK_PATH') + if not ndk or ndk == '' then + error('export $NDK_PATH') end - local ndk_toolchain = ndk .. "/toolchains/llvm/prebuilt" + local ndk_toolchain = ndk .. '/toolchains/llvm/prebuilt' if os.host() == 'windows' then - ndk_toolchain = ndk_toolchain .. "/windows-x86_64" + ndk_toolchain = ndk_toolchain .. '/windows-x86_64' elseif os.host() == 'macosx' then - ndk_toolchain = ndk_toolchain .. "/darwin-x86_64" + ndk_toolchain = ndk_toolchain .. '/darwin-x86_64' else - ndk_toolchain = ndk_toolchain .. "/linux-x86_64" + 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 + 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" + 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++", - } - - pic "on" -- Position-independent code is required for NDK libraries. - filter "options:arch=x86" + 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++', + }) + + pic('on') -- Position-independent code is required for NDK libraries. + filter('options:arch=x86') do - architecture "x86" - buildoptions {"--target=i686-none-linux-android21"} - linkoptions {"--target=i686-none-linux-android21"} + architecture('x86') + buildoptions({ '--target=i686-none-linux-android21' }) + linkoptions({ '--target=i686-none-linux-android21' }) end - filter "options:arch=x64" + filter('options:arch=x64') do - architecture "x64" - buildoptions {"--target=x86_64-none-linux-android21"} - linkoptions {"--target=x86_64-none-linux-android21"} + architecture('x64') + buildoptions({ '--target=x86_64-none-linux-android21' }) + linkoptions({ '--target=x86_64-none-linux-android21' }) end - filter "options:arch=arm" + filter('options:arch=arm') do - architecture "arm" - buildoptions {"--target=armv7a-none-linux-android21"} - linkoptions {"--target=armv7a-none-linux-android21"} + architecture('arm') + buildoptions({ '--target=armv7a-none-linux-android21' }) + linkoptions({ '--target=armv7a-none-linux-android21' }) end - filter "options:arch=arm64" + filter('options:arch=arm64') do - architecture "arm64" - buildoptions {"--target=aarch64-none-linux-android21"} - linkoptions {"--target=aarch64-none-linux-android21"} + architecture('arm64') + buildoptions({ '--target=aarch64-none-linux-android21' }) + linkoptions({ '--target=aarch64-none-linux-android21' }) end - filter {} + filter({}) end -newoption { +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'} + { 'clang', 'Build with Clang' }, + { 'msc', 'Build with the Microsoft C/C++ compiler' }, }, - default = 'clang' -} + default = 'clang', +}) -newoption { +newoption({ trigger = 'arch', value = 'ABI', description = 'The ABI with the right toolchain for this build, generally with Android', - allowed = { - {'x86'}, - {'x64'}, - {'arm'}, - {'arm64'} - } -} + allowed = { { 'x86' }, { 'x64' }, { 'arm' }, { 'arm64' } }, +}) diff --git a/cg_renderer/premake5.lua b/cg_renderer/premake5.lua index 51507a51..d54c7e52 100644 --- a/cg_renderer/premake5.lua +++ b/cg_renderer/premake5.lua @@ -1,65 +1,53 @@ -dofile 'rive_build_config.lua' +dofile('rive_build_config.lua') dependencies = os.getenv('DEPENDENCIES') -project 'rive_cg_renderer' +project('rive_cg_renderer') do - kind 'StaticLib' - includedirs { - 'include', - '../include', - } + kind('StaticLib') + includedirs({ 'include', '../include' }) - libdirs {'../../build/%{cfg.system}/bin/' .. RIVE_BUILD_CONFIG} + libdirs({ '../../build/%{cfg.system}/bin/' .. RIVE_BUILD_CONFIG }) - files { - 'src/**.cpp', - } + files({ 'src/**.cpp' }) - flags { - 'FatalCompileWarnings', - } + flags({ 'FatalCompileWarnings' }) - filter "system:windows" + filter('system:windows') do - architecture 'x64' - defines {'_USE_MATH_DEFINES'} + architecture('x64') + defines({ '_USE_MATH_DEFINES' }) end - filter {'system:macosx', 'options:variant=runtime'} + filter({ 'system:macosx', 'options:variant=runtime' }) do - buildoptions { - '-fembed-bitcode -arch arm64 -arch x86_64', - } + 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'} + filter({ 'system:ios', 'options:variant=system' }) do - buildoptions { - '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. iphoneos_sysroot - } + buildoptions({ + '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. iphoneos_sysroot, + }) end - filter {'system:ios', 'options:variant=emulator'} + 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 - } + 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'} + filter({ 'options:with_rive_text' }) do - defines {'WITH_RIVE_TEXT'} + defines({ 'WITH_RIVE_TEXT' }) end end -newoption { - trigger = 'with_rive_text', - description = 'Enables text experiments' -} +newoption({ trigger = 'with_rive_text', description = 'Enables text experiments' }) diff --git a/decoders/build/premake5.lua b/decoders/build/premake5.lua index 44c5f66e..ee183fae 100644 --- a/decoders/build/premake5.lua +++ b/decoders/build/premake5.lua @@ -1,45 +1,39 @@ -workspace 'rive' -configurations {"debug", "release"} +workspace('rive') +configurations({ 'debug', 'release' }) -require 'setup_compiler' +require('setup_compiler') -rive = path.getabsolute("../../") +rive = path.getabsolute('../../') dofile(rive .. '/dependencies/premake5_libpng.lua') -project 'rive_decoders' - dependson 'libpng' - kind 'StaticLib' - language "C++" - cppdialect "C++17" - targetdir "%{cfg.buildcfg}" - objdir "obj/%{cfg.buildcfg}" - flags { "FatalWarnings" } - - includedirs { - '../include', - '../../include', - libpng, - } - - files { - '../src/**.cpp' - } - - filter { "system:windows" } - do - architecture "x64" - end - - filter "configurations:debug" - do - defines {"DEBUG"} - symbols "On" - end - - filter "configurations:release" - do - defines {"RELEASE"} - defines {"NDEBUG"} - optimize "On" - end +project('rive_decoders') +dependson('libpng') +kind('StaticLib') +language('C++') +cppdialect('C++17') +targetdir('%{cfg.buildcfg}') +objdir('obj/%{cfg.buildcfg}') +flags({ 'FatalWarnings' }) + +includedirs({ '../include', '../../include', libpng }) + +files({ '../src/**.cpp' }) + +filter({ 'system:windows' }) +do + architecture('x64') +end + +filter('configurations:debug') +do + defines({ 'DEBUG' }) + symbols('On') +end + +filter('configurations:release') +do + defines({ 'RELEASE' }) + defines({ 'NDEBUG' }) + optimize('On') +end diff --git a/decoders/premake5_v2.lua b/decoders/premake5_v2.lua index 7338bdc2..bbf3bc30 100644 --- a/decoders/premake5_v2.lua +++ b/decoders/premake5_v2.lua @@ -1,20 +1,14 @@ -dofile 'setup_compiler.lua' +dofile('setup_compiler.lua') -rive = path.getabsolute("../") +rive = path.getabsolute('../') dofile(rive .. '/dependencies/premake5_libpng_v2.lua') -project 'rive_decoders' - dependson 'libpng' - kind 'StaticLib' - flags { "FatalWarnings" } +project('rive_decoders') +dependson('libpng') +kind('StaticLib') +flags({ 'FatalWarnings' }) - includedirs { - 'include', - '../include', - libpng, - } +includedirs({ 'include', '../include', libpng }) - files { - 'src/**.cpp' - } +files({ 'src/**.cpp' }) diff --git a/dependencies/premake5_harfbuzz.lua b/dependencies/premake5_harfbuzz.lua index b3469446..ed5cc1d6 100644 --- a/dependencies/premake5_harfbuzz.lua +++ b/dependencies/premake5_harfbuzz.lua @@ -1,24 +1,21 @@ -require 'setup_compiler' -local dependency = require 'dependency' +require('setup_compiler') +local dependency = require('dependency') harfbuzz = dependency.github('harfbuzz/harfbuzz', '6.0.0') -workspace 'rive' -configurations {'debug', 'release'} +workspace('rive') +configurations({ 'debug', 'release' }) -project 'rive_harfbuzz' +project('rive_harfbuzz') do - kind 'StaticLib' - language 'C++' - cppdialect 'C++17' - targetdir '%{cfg.system}/cache/bin/%{cfg.buildcfg}/' - objdir '%{cfg.system}/cache/obj/%{cfg.buildcfg}/' + kind('StaticLib') + language('C++') + cppdialect('C++17') + targetdir('%{cfg.system}/cache/bin/%{cfg.buildcfg}/') + objdir('%{cfg.system}/cache/obj/%{cfg.buildcfg}/') - includedirs { - '../', - harfbuzz .. '/src' - } + includedirs({ '../', harfbuzz .. '/src' }) - files { + files({ harfbuzz .. '/src/hb-aat-layout-ankr-table.hh', harfbuzz .. '/src/hb-aat-layout-bsln-table.hh', harfbuzz .. '/src/hb-aat-layout-common.hh', @@ -220,114 +217,111 @@ do harfbuzz .. '/src/hb-utf.hh', harfbuzz .. '/src/hb-vector.hh', harfbuzz .. '/src/hb.hh', - harfbuzz .. '/src/graph/gsubgpos-context.cc' - } + harfbuzz .. '/src/graph/gsubgpos-context.cc', + }) - warnings 'Off' + warnings('Off') - defines { - 'HAVE_OT', - 'HB_NO_FALLBACK_SHAPE', - 'HB_NO_WIN1256' - } + defines({ 'HAVE_OT', 'HB_NO_FALLBACK_SHAPE', 'HB_NO_WIN1256' }) - filter 'system:emscripten' + filter('system:emscripten') do - buildoptions {'-pthread'} + buildoptions({ '-pthread' }) end - filter 'toolset:clang' + filter('toolset:clang') do - flags {'FatalWarnings'} - buildoptions { + flags({ 'FatalWarnings' }) + buildoptions({ '-Werror=format', '-Wimplicit-int-conversion', - '-Werror=vla' - } + '-Werror=vla', + }) end - filter 'configurations:debug' + filter('configurations:debug') do - defines {'DEBUG'} - symbols 'On' + defines({ 'DEBUG' }) + symbols('On') end - filter 'configurations:release' + filter('configurations:release') do - defines {'RELEASE'} - defines {'NDEBUG'} - optimize 'On' + defines({ 'RELEASE' }) + defines({ 'NDEBUG' }) + optimize('On') end - filter {'system:macosx', 'options:variant=runtime'} + filter({ 'system:macosx', 'options:variant=runtime' }) do - buildoptions { - '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' .. - (os.getenv('MACOS_SYSROOT') or '') - } + buildoptions({ + '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('MACOS_SYSROOT') or ''), + }) end - filter {'system:macosx', 'configurations:release'} + filter({ 'system:macosx', 'configurations:release' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter {'system:ios'} + filter({ 'system:ios' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter 'system:windows' + filter('system:windows') do - architecture 'x64' - defines {'_USE_MATH_DEFINES'} + architecture('x64') + defines({ '_USE_MATH_DEFINES' }) end - filter {'system:ios', 'options:variant=system'} + filter({ 'system:ios', 'options:variant=system' }) do - buildoptions { - '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. - (os.getenv('IOS_SYSROOT') or '') - } + buildoptions({ + '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) end - filter {'system:ios', 'options:variant=emulator'} + filter({ 'system:ios', 'options:variant=emulator' }) do - buildoptions { + buildoptions({ '--target=arm64-apple-ios13.0.0-simulator', - '-mios-version-min=13.0 -arch arm64 -arch x86_64 -isysroot ' .. (os.getenv('IOS_SYSROOT') or '') - } - targetdir '%{cfg.system}_sim/cache/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}_sim/cache/obj/%{cfg.buildcfg}' + '-mios-version-min=13.0 -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) + targetdir('%{cfg.system}_sim/cache/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}_sim/cache/obj/%{cfg.buildcfg}') end - filter {'system:android', 'configurations:release'} + filter({ 'system:android', 'configurations:release' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end -- Is there a way to pass 'arch' as a variable here? - filter {'system:android', 'options:arch=x86'} + filter({ 'system:android', 'options:arch=x86' }) do - targetdir '%{cfg.system}/cache/x86/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/x86/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/x86/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/x86/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=x64'} + filter({ 'system:android', 'options:arch=x64' }) do - targetdir '%{cfg.system}/cache/x64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/x64/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/x64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/x64/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=arm'} + filter({ 'system:android', 'options:arch=arm' }) do - targetdir '%{cfg.system}/cache/arm/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/arm/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/arm/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/arm/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=arm64'} + filter({ 'system:android', 'options:arch=arm64' }) do - targetdir '%{cfg.system}/cache/arm64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/arm64/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/arm64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/arm64/obj/%{cfg.buildcfg}') end end diff --git a/dependencies/premake5_harfbuzz_v2.lua b/dependencies/premake5_harfbuzz_v2.lua index 6c5a52be..0dbecaad 100644 --- a/dependencies/premake5_harfbuzz_v2.lua +++ b/dependencies/premake5_harfbuzz_v2.lua @@ -1,18 +1,15 @@ -dofile 'rive_build_config.lua' +dofile('rive_build_config.lua') -local dependency = require 'dependency' +local dependency = require('dependency') harfbuzz = dependency.github('harfbuzz/harfbuzz', '6.0.0') -project 'rive_harfbuzz' +project('rive_harfbuzz') do - kind 'StaticLib' + kind('StaticLib') - includedirs { - '../', - harfbuzz .. '/src' - } + includedirs({ '../', harfbuzz .. '/src' }) - files { + files({ harfbuzz .. '/src/hb-aat-layout-ankr-table.hh', harfbuzz .. '/src/hb-aat-layout-bsln-table.hh', harfbuzz .. '/src/hb-aat-layout-common.hh', @@ -214,34 +211,30 @@ do harfbuzz .. '/src/hb-utf.hh', harfbuzz .. '/src/hb-vector.hh', harfbuzz .. '/src/hb.hh', - harfbuzz .. '/src/graph/gsubgpos-context.cc' - } + harfbuzz .. '/src/graph/gsubgpos-context.cc', + }) - warnings 'Off' + warnings('Off') - defines { - 'HAVE_OT', - 'HB_NO_FALLBACK_SHAPE', - 'HB_NO_WIN1256' - } + defines({ 'HAVE_OT', 'HB_NO_FALLBACK_SHAPE', 'HB_NO_WIN1256' }) - filter 'system:emscripten' + filter('system:emscripten') do - buildoptions {'-pthread'} + buildoptions({ '-pthread' }) end - filter 'toolset:clang' + filter('toolset:clang') do - flags {'FatalWarnings'} - buildoptions { + flags({ 'FatalWarnings' }) + buildoptions({ '-Werror=format', '-Wimplicit-int-conversion', - '-Werror=vla' - } + '-Werror=vla', + }) end - filter 'options:config=release' + filter('options:config=release') do - optimize 'Size' + optimize('Size') end end diff --git a/dependencies/premake5_libpng.lua b/dependencies/premake5_libpng.lua index 818d8688..4d217a9d 100644 --- a/dependencies/premake5_libpng.lua +++ b/dependencies/premake5_libpng.lua @@ -1,22 +1,18 @@ -require 'setup_compiler' -local dependency = require 'dependency' +require('setup_compiler') +local dependency = require('dependency') libpng = dependency.github('glennrp/libpng', 'libpng16') zlib = dependency.github('madler/zlib', '04f42ceca40f73e2978b50e93806c2a18c1281fc') -project 'libpng' +project('libpng') do - kind 'StaticLib' - language 'C++' - cppdialect 'C++17' - targetdir '%{cfg.system}/cache/bin/%{cfg.buildcfg}/' - objdir '%{cfg.system}/cache/obj/%{cfg.buildcfg}/' + kind('StaticLib') + language('C++') + cppdialect('C++17') + targetdir('%{cfg.system}/cache/bin/%{cfg.buildcfg}/') + objdir('%{cfg.system}/cache/obj/%{cfg.buildcfg}/') os.copyfile(libpng .. '/scripts/pnglibconf.h.prebuilt', libpng .. '/pnglibconf.h') - includedirs { - './', - libpng, - zlib, - } - files { + includedirs({ './', libpng, zlib }) + files({ libpng .. '/png.c', libpng .. '/pngerror.c', libpng .. '/pngget.c', @@ -31,35 +27,33 @@ do libpng .. '/pngwio.c', libpng .. '/pngwrite.c', libpng .. '/pngwtran.c', - libpng .. '/pngwutil.c' - } + libpng .. '/pngwutil.c', + }) do - files { + files({ libpng .. '/arm/arm_init.c', libpng .. '/arm/filter_neon_intrinsics.c', - libpng .. '/arm/palette_neon_intrinsics.c' - } + libpng .. '/arm/palette_neon_intrinsics.c', + }) end - filter 'system:windows' + filter('system:windows') do - architecture 'x64' + architecture('x64') end end -project 'zlib' +project('zlib') do - kind 'StaticLib' - language 'C++' - cppdialect 'C++17' - targetdir '%{cfg.system}/cache/bin/%{cfg.buildcfg}/' - objdir '%{cfg.system}/cache/obj/%{cfg.buildcfg}/' - defines {'ZLIB_IMPLEMENTATION'} - includedirs { - zlib - } - files { + kind('StaticLib') + language('C++') + cppdialect('C++17') + targetdir('%{cfg.system}/cache/bin/%{cfg.buildcfg}/') + objdir('%{cfg.system}/cache/obj/%{cfg.buildcfg}/') + defines({ 'ZLIB_IMPLEMENTATION' }) + includedirs({ zlib }) + files({ zlib .. '/adler32.c', zlib .. '/compress.c', zlib .. '/crc32.c', @@ -74,16 +68,16 @@ do zlib .. '/trees.c', zlib .. '/uncompr.c', zlib .. '/zutil.c', - zlib .. '/inflate.c' - } + zlib .. '/inflate.c', + }) - filter 'system:windows' + filter('system:windows') do - architecture 'x64' + architecture('x64') end - filter 'system:not windows' + filter('system:not windows') do - defines {'HAVE_UNISTD_H'} + defines({ 'HAVE_UNISTD_H' }) end end diff --git a/dependencies/premake5_libpng_v2.lua b/dependencies/premake5_libpng_v2.lua index afbcf612..325de38a 100644 --- a/dependencies/premake5_libpng_v2.lua +++ b/dependencies/premake5_libpng_v2.lua @@ -1,19 +1,15 @@ -dofile 'rive_build_config.lua' +dofile('rive_build_config.lua') -local dependency = require 'dependency' +local dependency = require('dependency') libpng = dependency.github('glennrp/libpng', 'libpng16') zlib = dependency.github('madler/zlib', '04f42ceca40f73e2978b50e93806c2a18c1281fc') -project 'libpng' +project('libpng') do - kind 'StaticLib' + kind('StaticLib') os.copyfile(libpng .. '/scripts/pnglibconf.h.prebuilt', libpng .. '/pnglibconf.h') - includedirs { - './', - libpng, - zlib, - } - files { + includedirs({ './', libpng, zlib }) + files({ libpng .. '/png.c', libpng .. '/pngerror.c', libpng .. '/pngget.c', @@ -28,26 +24,24 @@ do libpng .. '/pngwio.c', libpng .. '/pngwrite.c', libpng .. '/pngwtran.c', - libpng .. '/pngwutil.c' - } + libpng .. '/pngwutil.c', + }) do - files { + files({ libpng .. '/arm/arm_init.c', libpng .. '/arm/filter_neon_intrinsics.c', - libpng .. '/arm/palette_neon_intrinsics.c' - } + libpng .. '/arm/palette_neon_intrinsics.c', + }) end end -project 'zlib' +project('zlib') do - kind 'StaticLib' - defines {'ZLIB_IMPLEMENTATION'} - includedirs { - zlib - } - files { + kind('StaticLib') + defines({ 'ZLIB_IMPLEMENTATION' }) + includedirs({ zlib }) + files({ zlib .. '/adler32.c', zlib .. '/compress.c', zlib .. '/crc32.c', @@ -62,11 +56,11 @@ do zlib .. '/trees.c', zlib .. '/uncompr.c', zlib .. '/zutil.c', - zlib .. '/inflate.c' - } + zlib .. '/inflate.c', + }) - filter 'system:not windows' + filter('system:not windows') do - defines {'HAVE_UNISTD_H'} + defines({ 'HAVE_UNISTD_H' }) end end diff --git a/dependencies/premake5_miniaudio.lua b/dependencies/premake5_miniaudio.lua index b8cf0a9f..183cfdce 100644 --- a/dependencies/premake5_miniaudio.lua +++ b/dependencies/premake5_miniaudio.lua @@ -1,4 +1,3 @@ -local dependency = require 'dependency' +local dependency = require('dependency') -- miniaudio = dependency.github('rive-app/miniaudio', 'rive') miniaudio = dependency.github('rive-app/miniaudio', 'rive_changes') - diff --git a/dependencies/premake5_miniaudio_v2.lua b/dependencies/premake5_miniaudio_v2.lua index d3d073eb..c2661349 100644 --- a/dependencies/premake5_miniaudio_v2.lua +++ b/dependencies/premake5_miniaudio_v2.lua @@ -1,3 +1,3 @@ -dofile 'rive_build_config.lua' -local dependency = require 'dependency' +dofile('rive_build_config.lua') +local dependency = require('dependency') miniaudio = dependency.github('rive-app/miniaudio', 'rive') diff --git a/dependencies/premake5_sheenbidi.lua b/dependencies/premake5_sheenbidi.lua index 7cd1d99a..61ccb572 100644 --- a/dependencies/premake5_sheenbidi.lua +++ b/dependencies/premake5_sheenbidi.lua @@ -1,37 +1,31 @@ -local dependency = require 'dependency' +local dependency = require('dependency') sheenbidi = dependency.github('Tehreer/SheenBidi', 'v2.6') -workspace 'rive' -configurations {'debug', 'release'} +workspace('rive') +configurations({ 'debug', 'release' }) -project 'rive_sheenbidi' +project('rive_sheenbidi') do - kind 'StaticLib' - language 'C' - targetdir '%{cfg.system}/cache/bin/%{cfg.buildcfg}/' - objdir '%{cfg.system}/cache/obj/%{cfg.buildcfg}/' - warnings 'Off' + kind('StaticLib') + language('C') + targetdir('%{cfg.system}/cache/bin/%{cfg.buildcfg}/') + objdir('%{cfg.system}/cache/obj/%{cfg.buildcfg}/') + warnings('Off') - includedirs { - sheenbidi .. '/Headers' - } + includedirs({ sheenbidi .. '/Headers' }) - buildoptions { - '-Wall', - '-ansi', - '-pedantic' - } + buildoptions({ '-Wall', '-ansi', '-pedantic' }) - linkoptions {'-r'} + linkoptions({ '-r' }) - filter 'system:emscripten' + filter('system:emscripten') do - buildoptions {'-pthread'} + buildoptions({ '-pthread' }) end - filter 'configurations:debug' + filter('configurations:debug') do - files { + files({ sheenbidi .. '/Source/BidiChain.c', sheenbidi .. '/Source/BidiTypeLookup.c', sheenbidi .. '/Source/BracketQueue.c', @@ -50,98 +44,97 @@ do sheenbidi .. '/Source/SBScriptLocator.c', sheenbidi .. '/Source/ScriptLookup.c', sheenbidi .. '/Source/ScriptStack.c', - sheenbidi .. '/Source/StatusStack.c' - } + sheenbidi .. '/Source/StatusStack.c', + }) end - filter 'configurations:release' + filter('configurations:release') do - files { - sheenbidi .. '/Source/SheenBidi.c' - } + files({ sheenbidi .. '/Source/SheenBidi.c' }) end - filter 'configurations:debug' + filter('configurations:debug') do - defines {'DEBUG'} - symbols 'On' + defines({ 'DEBUG' }) + symbols('On') end - filter 'configurations:release' + filter('configurations:release') do - buildoptions {'-Oz'} - defines {'RELEASE', 'NDEBUG', 'SB_CONFIG_UNITY'} - optimize 'On' + buildoptions({ '-Oz' }) + defines({ 'RELEASE', 'NDEBUG', 'SB_CONFIG_UNITY' }) + optimize('On') end - filter {'system:macosx', 'options:variant=runtime'} + filter({ 'system:macosx', 'options:variant=runtime' }) do - buildoptions { - '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' .. - (os.getenv('MACOS_SYSROOT') or '') - } + buildoptions({ + '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('MACOS_SYSROOT') or ''), + }) end - filter {'system:macosx', 'configurations:release'} + filter({ 'system:macosx', 'configurations:release' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter {'system:ios'} + filter({ 'system:ios' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter 'system:windows' + filter('system:windows') do - architecture 'x64' - defines {'_USE_MATH_DEFINES'} + architecture('x64') + defines({ '_USE_MATH_DEFINES' }) end - filter {'system:ios', 'options:variant=system'} + filter({ 'system:ios', 'options:variant=system' }) do - buildoptions { - '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. - (os.getenv('IOS_SYSROOT') or '') - } + buildoptions({ + '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) end - filter {'system:ios', 'options:variant=emulator'} + filter({ 'system:ios', 'options:variant=emulator' }) do - buildoptions { + buildoptions({ '--target=arm64-apple-ios13.0.0-simulator', - '-mios-version-min=13.0 -arch arm64 -arch x86_64 -isysroot ' .. (os.getenv('IOS_SYSROOT') or '') - } - targetdir '%{cfg.system}_sim/cache/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}_sim/cache/obj/%{cfg.buildcfg}' + '-mios-version-min=13.0 -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) + targetdir('%{cfg.system}_sim/cache/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}_sim/cache/obj/%{cfg.buildcfg}') end - filter {'system:android', 'configurations:release'} + filter({ 'system:android', 'configurations:release' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end -- Is there a way to pass 'arch' as a variable here? - filter {'system:android', 'options:arch=x86'} + filter({ 'system:android', 'options:arch=x86' }) do - targetdir '%{cfg.system}/cache/x86/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/x86/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/x86/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/x86/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=x64'} + filter({ 'system:android', 'options:arch=x64' }) do - targetdir '%{cfg.system}/cache/x64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/x64/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/x64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/x64/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=arm'} + filter({ 'system:android', 'options:arch=arm' }) do - targetdir '%{cfg.system}/cache/arm/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/arm/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/arm/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/arm/obj/%{cfg.buildcfg}') end - filter {'system:android', 'options:arch=arm64'} + filter({ 'system:android', 'options:arch=arm64' }) do - targetdir '%{cfg.system}/cache/arm64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/cache/arm64/obj/%{cfg.buildcfg}' + targetdir('%{cfg.system}/cache/arm64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/cache/arm64/obj/%{cfg.buildcfg}') end end diff --git a/dependencies/premake5_sheenbidi_v2.lua b/dependencies/premake5_sheenbidi_v2.lua index ea851791..7f251bb8 100644 --- a/dependencies/premake5_sheenbidi_v2.lua +++ b/dependencies/premake5_sheenbidi_v2.lua @@ -1,34 +1,28 @@ -dofile "rive_build_config.lua" +dofile('rive_build_config.lua') -local dependency = require 'dependency' +local dependency = require('dependency') sheenbidi = dependency.github('Tehreer/SheenBidi', 'v2.6') -project 'rive_sheenbidi' +project('rive_sheenbidi') do - kind 'StaticLib' - language 'C' - warnings 'Off' + kind('StaticLib') + language('C') + warnings('Off') - includedirs { - sheenbidi .. '/Headers' - } + includedirs({ sheenbidi .. '/Headers' }) - buildoptions { - '-Wall', - '-ansi', - '-pedantic' - } + buildoptions({ '-Wall', '-ansi', '-pedantic' }) - linkoptions {'-r'} + linkoptions({ '-r' }) - filter 'system:emscripten' + filter('system:emscripten') do - buildoptions {'-pthread'} + buildoptions({ '-pthread' }) end - filter 'options:config=debug' + filter('options:config=debug') do - files { + files({ sheenbidi .. '/Source/BidiChain.c', sheenbidi .. '/Source/BidiTypeLookup.c', sheenbidi .. '/Source/BracketQueue.c', @@ -47,19 +41,17 @@ do sheenbidi .. '/Source/SBScriptLocator.c', sheenbidi .. '/Source/ScriptLookup.c', sheenbidi .. '/Source/ScriptStack.c', - sheenbidi .. '/Source/StatusStack.c' - } + sheenbidi .. '/Source/StatusStack.c', + }) end - filter 'options:config=release' + filter('options:config=release') do - files { - sheenbidi .. '/Source/SheenBidi.c' - } + files({ sheenbidi .. '/Source/SheenBidi.c' }) end - filter 'options:config=release' + filter('options:config=release') do - defines {'SB_CONFIG_UNITY'} - optimize 'Size' + defines({ 'SB_CONFIG_UNITY' }) + optimize('Size') end end diff --git a/dev/test/premake5.lua b/dev/test/premake5.lua index 0018775f..5c9975c1 100644 --- a/dev/test/premake5.lua +++ b/dev/test/premake5.lua @@ -1,6 +1,6 @@ -- require "lfs" -- Clean Function -- -newaction { +newaction({ trigger = 'clean', description = 'clean the build', execute = function() @@ -10,11 +10,11 @@ newaction { -- no wildcards in os.remove, so use shell os.execute('rm *.make') print('build cleaned') - end -} + end, +}) -workspace 'rive' -configurations {'debug'} +workspace('rive') +configurations({ 'debug' }) dofile(path.join(path.getabsolute('../../dependencies/'), 'premake5_harfbuzz.lua')) dofile(path.join(path.getabsolute('../../dependencies/'), 'premake5_sheenbidi.lua')) @@ -22,46 +22,49 @@ dofile(path.join(path.getabsolute('../../dependencies/'), 'premake5_miniaudio.lu project('tests') do - kind 'ConsoleApp' - language 'C++' - cppdialect 'C++11' - targetdir 'build/bin/%{cfg.buildcfg}' - objdir 'build/obj/%{cfg.buildcfg}' - flags {'FatalWarnings'} - buildoptions {'-Wall', '-fno-exceptions', '-fno-rtti'} - exceptionhandling 'On' + kind('ConsoleApp') + language('C++') + cppdialect('C++11') + targetdir('build/bin/%{cfg.buildcfg}') + objdir('build/obj/%{cfg.buildcfg}') + flags({ 'FatalWarnings' }) + buildoptions({ '-Wall', '-fno-exceptions', '-fno-rtti' }) + exceptionhandling('On') - includedirs { + includedirs({ './include', '../../include', harfbuzz .. '/src', sheenbidi .. '/Headers', - miniaudio - } - links { - 'rive_harfbuzz', - 'rive_sheenbidi' - } + miniaudio, + }) + links({ 'rive_harfbuzz', 'rive_sheenbidi' }) - files { + files({ '../../src/**.cpp', -- the Rive runtime source '../../test/**.cpp', -- the tests - '../../utils/**.cpp' -- no_op utils - } + '../../utils/**.cpp', -- no_op utils + }) - defines {'TESTING', 'ENABLE_QUERY_FLAT_VERTICES', 'WITH_RIVE_TOOLS', 'WITH_RIVE_TEXT', 'WITH_RIVE_AUDIO'} + defines({ + 'TESTING', + 'ENABLE_QUERY_FLAT_VERTICES', + 'WITH_RIVE_TOOLS', + 'WITH_RIVE_TEXT', + 'WITH_RIVE_AUDIO', + }) - filter {'system:windows', 'files:../../src/audio/audio_engine.cpp'} + filter({ 'system:windows', 'files:../../src/audio/audio_engine.cpp' }) do -- Too many warnings from miniaudio.h - removeflags {'FatalCompileWarnings'} - removebuildoptions {'-Wall'} + removeflags({ 'FatalCompileWarnings' }) + removebuildoptions({ '-Wall' }) end - filter {'system:windows', 'toolset:clang'} + filter({ 'system:windows', 'toolset:clang' }) do -- Too many warnings from miniaudio.h - buildoptions { + buildoptions({ '-Wno-nonportable-system-include-path', '-Wno-zero-as-null-pointer-constant', '-Wno-missing-prototypes', @@ -75,34 +78,34 @@ do '-Wno-tautological-constant-out-of-range-compare', '-Wno-implicit-fallthrough', '-Wno-implicit-int-conversion', - '-Wno-undef' - } + '-Wno-undef', + }) end - filter 'configurations:debug' + filter('configurations:debug') do - defines {'DEBUG'} - symbols 'On' + defines({ 'DEBUG' }) + symbols('On') end - filter 'system:linux' + filter('system:linux') do - defines {'EXTERNAL_RIVE_AUDIO_ENGINE'} - links {'dl', 'pthread'} + defines({ 'EXTERNAL_RIVE_AUDIO_ENGINE' }) + links({ 'dl', 'pthread' }) end - filter 'system:windows' + filter('system:windows') do - removebuildoptions { + removebuildoptions({ -- vs clang doesn't recognize these on windows '-fno-exceptions', - '-fno-rtti' - } - architecture 'x64' - defines { + '-fno-rtti', + }) + architecture('x64') + defines({ '_USE_MATH_DEFINES', '_CRT_SECURE_NO_WARNINGS', - '_CRT_NONSTDC_NO_DEPRECATE' - } + '_CRT_NONSTDC_NO_DEPRECATE', + }) end end diff --git a/premake5_v2.lua b/premake5_v2.lua index f253bc93..d6098bc7 100644 --- a/premake5_v2.lua +++ b/premake5_v2.lua @@ -1,65 +1,61 @@ -dofile 'rive_build_config.lua' +dofile('rive_build_config.lua') -filter {'options:with_rive_tools'} +filter({ 'options:with_rive_tools' }) do - defines {'WITH_RIVE_TOOLS'} + defines({ 'WITH_RIVE_TOOLS' }) end -filter {'options:with_rive_text'} +filter({ 'options:with_rive_text' }) do - defines {'WITH_RIVE_TEXT'} + defines({ 'WITH_RIVE_TEXT' }) end -filter {} -filter {'options:with_rive_audio=system'} +filter({}) +filter({ 'options:with_rive_audio=system' }) do - defines {'WITH_RIVE_AUDIO'} + defines({ 'WITH_RIVE_AUDIO' }) end -filter {'options:with_rive_audio=external'} +filter({ 'options:with_rive_audio=external' }) do - defines {'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO'} + defines({ 'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO' }) end -filter {} +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' +project('rive') do - kind 'StaticLib' - cppdialect 'C++11' - includedirs { + kind('StaticLib') + cppdialect('C++11') + includedirs({ 'include', harfbuzz .. '/src', sheenbidi .. '/Headers', - miniaudio - } + miniaudio, + }) - files {'src/**.cpp'} + files({ 'src/**.cpp' }) - flags { - 'FatalCompileWarnings' - } + flags({ 'FatalCompileWarnings' }) - filter {'system:macosx'} + filter({ 'system:macosx' }) do - buildoptions { + buildoptions({ -- this triggers too much on linux, so just enable here for now - '-Wimplicit-float-conversion' - } + '-Wimplicit-float-conversion', + }) end -- filter {'toolset:not msc', 'files:src/audio/audio_engine.cpp'} - filter {'system:not windows', 'files:src/audio/audio_engine.cpp'} + filter({ 'system:not windows', 'files:src/audio/audio_engine.cpp' }) do - buildoptions { - '-Wno-implicit-int-conversion' - } + buildoptions({ '-Wno-implicit-int-conversion' }) end - filter {'system:windows', 'files:src/audio/audio_engine.cpp'} + filter({ 'system:windows', 'files:src/audio/audio_engine.cpp' }) do -- Too many warnings from miniaudio.h - removeflags {'FatalCompileWarnings'} + removeflags({ 'FatalCompileWarnings' }) end -- filter 'files:src/audio/audio_engine.cpp' @@ -69,67 +65,60 @@ do -- } -- end - filter {'system:macosx', 'options:variant=runtime'} + filter({ 'system:macosx', 'options:variant=runtime' }) do - buildoptions { - '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' .. - (os.getenv('MACOS_SYSROOT') or '') - } + buildoptions({ + '-Wimplicit-float-conversion -fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('MACOS_SYSROOT') or ''), + }) end - filter {'system:ios'} + filter({ 'system:ios' }) do - buildoptions {'-flto=full', '-Wno-implicit-int-conversion'} - files {'src/audio/audio_engine.m'} + buildoptions({ '-flto=full', '-Wno-implicit-int-conversion' }) + files({ 'src/audio/audio_engine.m' }) end - filter 'system:windows' + filter('system:windows') do - architecture 'x64' - defines {'_USE_MATH_DEFINES'} + architecture('x64') + defines({ '_USE_MATH_DEFINES' }) end - filter 'system:emscripten' + filter('system:emscripten') do - buildoptions {'-pthread'} + buildoptions({ '-pthread' }) end end -newoption { +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'} + { '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' -} + default = 'system', +}) -newoption { +newoption({ trigger = 'with_rive_tools', - description = 'Enables tools usually not necessary for runtime.' -} + description = 'Enables tools usually not necessary for runtime.', +}) -newoption { +newoption({ trigger = 'with_rive_text', - description = 'Compiles in text features.' -} + description = 'Compiles in text features.', +}) -newoption { +newoption({ trigger = 'with_rive_audio', value = 'disabled', description = 'The audio mode to use.', - allowed = { - { - 'disabled' - }, - { - 'system' - }, - { - 'external' - } - } -} + allowed = { { 'disabled' }, { 'system' }, { 'external' } }, +}) diff --git a/rivinfo/build/premake5.lua b/rivinfo/build/premake5.lua index 897904ef..dba3e5f1 100644 --- a/rivinfo/build/premake5.lua +++ b/rivinfo/build/premake5.lua @@ -1,73 +1,65 @@ -workspace "rive" -configurations {"debug", "release"} +workspace('rive') +configurations({ 'debug', 'release' }) -project "rivinfo" - kind "ConsoleApp" - language "C++" - cppdialect "C++17" - targetdir "%{cfg.system}/bin/%{cfg.buildcfg}" - objdir "%{cfg.system}/obj/%{cfg.buildcfg}" - includedirs { - "../../include", - "../../test", - "/usr/local/include", - "/usr/include", - } +project('rivinfo') +kind('ConsoleApp') +language('C++') +cppdialect('C++17') +targetdir('%{cfg.system}/bin/%{cfg.buildcfg}') +objdir('%{cfg.system}/obj/%{cfg.buildcfg}') +includedirs({ + '../../include', + '../../test', + '/usr/local/include', + '/usr/include', +}) - if os.host() == 'macosx' then - links { - "Cocoa.framework", - "CoreFoundation.framework", - "IOKit.framework", - "Security.framework", - "bz2", - "iconv", - "lzma", - "rive", - "z", -- lib av format - } - else - links { - "m", - "rive", - "z", - "dl", - } - end +if os.host() == 'macosx' then + links({ + 'Cocoa.framework', + 'CoreFoundation.framework', + 'IOKit.framework', + 'Security.framework', + 'bz2', + 'iconv', + 'lzma', + 'rive', + 'z', -- lib av format + }) +else + links({ 'm', 'rive', 'z', 'dl' }) +end - libdirs { - "../../build/%{cfg.system}/bin/%{cfg.buildcfg}", - "/usr/local/lib", - "/usr/lib", - } +libdirs({ + '../../build/%{cfg.system}/bin/%{cfg.buildcfg}', + '/usr/local/lib', + '/usr/lib', +}) - files { - "../**.cpp", - "../../utils/no_op_factory.cpp", - } +files({ '../**.cpp', '../../utils/no_op_factory.cpp' }) - buildoptions {"-Wall", "-fno-rtti", "-g"} +buildoptions({ '-Wall', '-fno-rtti', '-g' }) - filter "configurations:debug" - defines {"DEBUG"} - symbols "On" +filter('configurations:debug') +defines({ 'DEBUG' }) +symbols('On') - filter "configurations:release" - defines {"RELEASE"} - defines {"NDEBUG"} - optimize "On" +filter('configurations:release') +defines({ 'RELEASE' }) +defines({ 'NDEBUG' }) +optimize('On') -- Clean Function -- -newaction { - trigger = "clean", - description = "clean the build", +newaction({ + trigger = 'clean', + description = 'clean the build', execute = function() - print("clean the build...") - os.rmdir("./bin") - os.rmdir("./obj") - os.remove("Makefile") + print('clean the build...') + os.rmdir('./bin') + os.rmdir('./obj') + os.remove('Makefile') -- no wildcards in os.remove, so use shell - os.execute("rm *.make") - print("build cleaned") - end -} + os.execute('rm *.make') + print('build cleaned') + end, +}) diff --git a/skia/font_converter/build/premake5.lua b/skia/font_converter/build/premake5.lua index 5d6df520..3c50826c 100644 --- a/skia/font_converter/build/premake5.lua +++ b/skia/font_converter/build/premake5.lua @@ -1,73 +1,63 @@ -workspace "rive" -configurations {"debug", "release"} - -project "font_converter" -kind "ConsoleApp" -language "C++" -cppdialect "C++17" -targetdir "%{cfg.system}/bin/%{cfg.buildcfg}" -objdir "%{cfg.system}/obj/%{cfg.buildcfg}" -includedirs { - "../include", - "../../../include", - "../../renderer/include", - "../../dependencies/skia", - "/usr/local/include", - "/usr/include", -} - -if os.host() == 'macosx' then - links { - "Cocoa.framework", - "CoreFoundation.framework", - "IOKit.framework", - "Security.framework", - "bz2", - "iconv", - "lzma", - "skia", - "z", -- lib av format - } +workspace('rive') +configurations({ 'debug', 'release' }) + +project('font_converter') +kind('ConsoleApp') +language('C++') +cppdialect('C++17') +targetdir('%{cfg.system}/bin/%{cfg.buildcfg}') +objdir('%{cfg.system}/obj/%{cfg.buildcfg}') +includedirs({ + '../include', + '../../../include', + '../../renderer/include', + '../../dependencies/skia', + '/usr/local/include', + '/usr/include', +}) + +if os.host() == 'macosx' then + links({ + 'Cocoa.framework', + 'CoreFoundation.framework', + 'IOKit.framework', + 'Security.framework', + 'bz2', + 'iconv', + 'lzma', + 'skia', + 'z', -- lib av format + }) else - links { - "m", - "skia", - "z", - "dl", - "fontconfig" - } -end + links({ 'm', 'skia', 'z', 'dl', 'fontconfig' }) +end -libdirs { - "../../dependencies/skia/out/static", - "/usr/local/lib", - "/usr/lib", -} +libdirs({ '../../dependencies/skia/out/static', '/usr/local/lib', '/usr/lib' }) -files {"../src/**.cpp", "../src/**.c"} +files({ '../src/**.cpp', '../src/**.c' }) -buildoptions {"-Wall", "-fno-rtti"} +buildoptions({ '-Wall', '-fno-rtti' }) -filter "configurations:debug" -defines {"DEBUG"} -symbols "On" +filter('configurations:debug') +defines({ 'DEBUG' }) +symbols('On') -filter "configurations:release" -defines {"RELEASE"} -defines {"NDEBUG"} -optimize "On" +filter('configurations:release') +defines({ 'RELEASE' }) +defines({ 'NDEBUG' }) +optimize('On') -- Clean Function -- -newaction { - trigger = "clean", - description = "clean the build", +newaction({ + trigger = 'clean', + description = 'clean the build', execute = function() - print("clean the build...") - os.rmdir("./bin") - os.rmdir("./obj") - os.remove("Makefile") + print('clean the build...') + os.rmdir('./bin') + os.rmdir('./obj') + os.remove('Makefile') -- no wildcards in os.remove, so use shell - os.execute("rm *.make") - print("build cleaned") - end -} + os.execute('rm *.make') + print('build cleaned') + end, +}) diff --git a/skia/renderer/build/premake5.lua b/skia/renderer/build/premake5.lua index 2376a520..43f147bb 100644 --- a/skia/renderer/build/premake5.lua +++ b/skia/renderer/build/premake5.lua @@ -1,7 +1,7 @@ -workspace 'rive' -configurations {'debug', 'release'} +workspace('rive') +configurations({ 'debug', 'release' }) -require 'setup_compiler' +require('setup_compiler') SKIA_DIR = os.getenv('SKIA_DIR') dependencies = os.getenv('DEPENDENCIES') @@ -15,197 +15,184 @@ else SKIA_DIR = '../../dependencies/' .. SKIA_DIR end -project 'rive_skia_renderer' +project('rive_skia_renderer') do - kind 'StaticLib' - language 'C++' - cppdialect 'C++17' - targetdir '%{cfg.system}/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/obj/%{cfg.buildcfg}' - includedirs { + kind('StaticLib') + language('C++') + cppdialect('C++17') + targetdir('%{cfg.system}/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/obj/%{cfg.buildcfg}') + includedirs({ '../include', '../../../cg_renderer/include', - '../../../include' - } + '../../../include', + }) - libdirs {'../../../build/%{cfg.system}/bin/%{cfg.buildcfg}'} + libdirs({ '../../../build/%{cfg.system}/bin/%{cfg.buildcfg}' }) - files { - '../src/**.cpp' - } + files({ '../src/**.cpp' }) - flags { - 'FatalCompileWarnings' - } + flags({ 'FatalCompileWarnings' }) - filter 'system:windows' + filter('system:windows') do - architecture 'x64' - defines {'_USE_MATH_DEFINES'} + architecture('x64') + defines({ '_USE_MATH_DEFINES' }) end - filter {'system:macosx'} + filter({ 'system:macosx' }) do - includedirs {SKIA_DIR} - libdirs {SKIA_DIR .. '/out/static'} - links {'Cocoa.framework', 'rive', 'skia'} + includedirs({ SKIA_DIR }) + libdirs({ SKIA_DIR .. '/out/static' }) + links({ 'Cocoa.framework', 'rive', 'skia' }) end - filter {'system:macosx', 'options:variant=runtime'} + filter({ 'system:macosx', 'options:variant=runtime' }) do - links {} - buildoptions { - '-fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' .. (os.getenv('MACOS_SYSROOT') or '') - } + links({}) + buildoptions({ + '-fembed-bitcode -arch arm64 -arch x86_64 -isysroot ' + .. (os.getenv('MACOS_SYSROOT') or ''), + }) end - filter {'system:linux or windows'} + filter({ 'system:linux or windows' }) do - includedirs {SKIA_DIR} - libdirs {SKIA_DIR .. '/out/static'} - links {'rive', 'skia'} + includedirs({ SKIA_DIR }) + libdirs({ SKIA_DIR .. '/out/static' }) + links({ 'rive', 'skia' }) end - filter {'system:ios'} + filter({ 'system:ios' }) do - includedirs {SKIA_DIR} - libdirs {SKIA_DIR .. '/out/static'} + includedirs({ SKIA_DIR }) + libdirs({ SKIA_DIR .. '/out/static' }) end - filter {'system:ios', 'options:variant=system'} + filter({ 'system:ios', 'options:variant=system' }) do - buildoptions { - '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' .. (os.getenv('IOS_SYSROOT') or '') - } + buildoptions({ + '-mios-version-min=13.0 -fembed-bitcode -arch arm64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) end - filter {'system:ios', 'options:variant=emulator'} + 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 ' .. - (os.getenv('IOS_SYSROOT') or '') - } - targetdir '%{cfg.system}_sim/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}_sim/obj/%{cfg.buildcfg}' + buildoptions({ + '--target=arm64-apple-ios13.0.0-simulator -mios-version-min=13.0 -arch x86_64 -arch arm64 -isysroot ' + .. (os.getenv('IOS_SYSROOT') or ''), + }) + targetdir('%{cfg.system}_sim/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}_sim/obj/%{cfg.buildcfg}') end -- Is there a way to pass 'arch' as a variable here? - filter {'system:android'} + filter({ 'system:android' }) do - includedirs {SKIA_DIR} + includedirs({ SKIA_DIR }) - filter {'system:android', 'options:arch=x86'} + filter({ 'system:android', 'options:arch=x86' }) do - targetdir '%{cfg.system}/x86/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/x86/obj/%{cfg.buildcfg}' - libdirs {SKIA_DIR .. '/out/x86'} + targetdir('%{cfg.system}/x86/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/x86/obj/%{cfg.buildcfg}') + libdirs({ SKIA_DIR .. '/out/x86' }) end - filter {'system:android', 'options:arch=x64'} + filter({ 'system:android', 'options:arch=x64' }) do - targetdir '%{cfg.system}/x64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/x64/obj/%{cfg.buildcfg}' - libdirs {SKIA_DIR .. '/out/x64'} + targetdir('%{cfg.system}/x64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/x64/obj/%{cfg.buildcfg}') + libdirs({ SKIA_DIR .. '/out/x64' }) end - filter {'system:android', 'options:arch=arm'} + filter({ 'system:android', 'options:arch=arm' }) do - targetdir '%{cfg.system}/arm/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/arm/obj/%{cfg.buildcfg}' - libdirs {SKIA_DIR .. '/out/arm'} + targetdir('%{cfg.system}/arm/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/arm/obj/%{cfg.buildcfg}') + libdirs({ SKIA_DIR .. '/out/arm' }) end - filter {'system:android', 'options:arch=arm64'} + filter({ 'system:android', 'options:arch=arm64' }) do - targetdir '%{cfg.system}/arm64/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/arm64/obj/%{cfg.buildcfg}' - libdirs {SKIA_DIR .. '/out/arm64'} + targetdir('%{cfg.system}/arm64/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/arm64/obj/%{cfg.buildcfg}') + libdirs({ SKIA_DIR .. '/out/arm64' }) end end - filter {'configurations:release', 'system:macosx'} + filter({ 'configurations:release', 'system:macosx' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter {'configurations:release', 'system:android'} + filter({ 'configurations:release', 'system:android' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter {'configurations:release', 'system:ios'} + filter({ 'configurations:release', 'system:ios' }) do - buildoptions {'-flto=full'} + buildoptions({ '-flto=full' }) end - filter 'configurations:debug' + filter('configurations:debug') do - defines {'DEBUG'} - symbols 'On' + defines({ 'DEBUG' }) + symbols('On') end - filter 'configurations:release' + filter('configurations:release') do - defines {'RELEASE', 'NDEBUG'} - optimize 'On' + defines({ 'RELEASE', 'NDEBUG' }) + optimize('On') end - filter {'options:with_rive_text'} + filter({ 'options:with_rive_text' }) do - defines {'WITH_RIVE_TEXT'} + defines({ 'WITH_RIVE_TEXT' }) end - filter {'options:with_rive_audio=system'} + filter({ 'options:with_rive_audio=system' }) do - defines {'WITH_RIVE_AUDIO'} + defines({ 'WITH_RIVE_AUDIO' }) end - filter {'options:with_rive_audio=external'} + filter({ 'options:with_rive_audio=external' }) do - defines {'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO'} + 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_text', description = 'Enables text experiments' }) -newoption { +newoption({ trigger = 'with_rive_audio', value = 'disabled', description = 'The audio mode to use.', - allowed = { - { - 'disabled' - }, - { - 'system' - }, - { - 'external' - } - } -} + allowed = { { 'disabled' }, { 'system' }, { 'external' } }, +}) -newoption { +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'} + { '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' -} + default = 'system', +}) -newoption { +newoption({ trigger = 'arch', value = 'ABI', description = 'The ABI with the right toolchain for this build, generally with Android', - allowed = { - {'x86'}, - {'x64'}, - {'arm'}, - {'arm64'} - } -} + allowed = { { 'x86' }, { 'x64' }, { 'arm' }, { 'arm64' } }, +}) diff --git a/skia/renderer/premake5_v2.lua b/skia/renderer/premake5_v2.lua index e4daa874..5a41efa2 100644 --- a/skia/renderer/premake5_v2.lua +++ b/skia/renderer/premake5_v2.lua @@ -1,4 +1,4 @@ -dofile 'rive_build_config.lua' +dofile('rive_build_config.lua') SKIA_DIR = os.getenv('SKIA_DIR') dependencies = os.getenv('DEPENDENCIES') @@ -12,88 +12,71 @@ else SKIA_DIR = '../dependencies/' .. SKIA_DIR end -project 'rive_skia_renderer' +project('rive_skia_renderer') do - kind 'StaticLib' - includedirs { - 'include', - '../../cg_renderer/include', - '../../include' - } + kind('StaticLib') + includedirs({ 'include', '../../cg_renderer/include', '../../include' }) - libdirs {'../../build/%{cfg.system}/bin/' .. RIVE_BUILD_CONFIG} + libdirs({ '../../build/%{cfg.system}/bin/' .. RIVE_BUILD_CONFIG }) - files { - 'src/**.cpp' - } + files({ 'src/**.cpp' }) - flags { - 'FatalCompileWarnings' - } + flags({ 'FatalCompileWarnings' }) - filter {'system:macosx or linux or windows or ios'} + filter({ 'system:macosx or linux or windows or ios' }) do - includedirs {SKIA_DIR} - libdirs {SKIA_DIR .. '/out/static'} + includedirs({ SKIA_DIR }) + libdirs({ SKIA_DIR .. '/out/static' }) end - filter {'system:android'} + filter({ 'system:android' }) do - includedirs {SKIA_DIR} + includedirs({ SKIA_DIR }) - filter {'system:android', 'options:arch=x86'} + filter({ 'system:android', 'options:arch=x86' }) do - libdirs {SKIA_DIR .. '/out/x86'} + libdirs({ SKIA_DIR .. '/out/x86' }) end - filter {'system:android', 'options:arch=x64'} + filter({ 'system:android', 'options:arch=x64' }) do - libdirs {SKIA_DIR .. '/out/x64'} + libdirs({ SKIA_DIR .. '/out/x64' }) end - filter {'system:android', 'options:arch=arm'} + filter({ 'system:android', 'options:arch=arm' }) do - libdirs {SKIA_DIR .. '/out/arm'} + libdirs({ SKIA_DIR .. '/out/arm' }) end - filter {'system:android', 'options:arch=arm64'} + filter({ 'system:android', 'options:arch=arm64' }) do - libdirs {SKIA_DIR .. '/out/arm64'} + libdirs({ SKIA_DIR .. '/out/arm64' }) end end - filter {'options:with_rive_text'} + filter({ 'options:with_rive_text' }) do - defines {'WITH_RIVE_TEXT'} + defines({ 'WITH_RIVE_TEXT' }) end - filter {'options:with_rive_audio=system'} + filter({ 'options:with_rive_audio=system' }) do - defines {'WITH_RIVE_AUDIO'} + defines({ 'WITH_RIVE_AUDIO' }) end - filter {'options:with_rive_audio=external'} + filter({ 'options:with_rive_audio=external' }) do - defines {'WITH_RIVE_AUDIO', 'EXTERNAL_RIVE_AUDIO_ENGINE', 'MA_NO_DEVICE_IO'} + 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_text', description = 'Enables text experiments' }) -newoption { +newoption({ trigger = 'with_rive_audio', value = 'disabled', description = 'The audio mode to use.', - allowed = { - { - 'disabled' - }, - { - 'system' - }, - { - 'external' - } - } -} + allowed = { { 'disabled' }, { 'system' }, { 'external' } }, +}) diff --git a/skia/thumbnail_generator/build/premake5.lua b/skia/thumbnail_generator/build/premake5.lua index e14492e7..66fb3d7c 100644 --- a/skia/thumbnail_generator/build/premake5.lua +++ b/skia/thumbnail_generator/build/premake5.lua @@ -1,7 +1,7 @@ -workspace 'rive' -configurations {'debug', 'release'} +workspace('rive') +configurations({ 'debug', 'release' }) -require 'setup_compiler' +require('setup_compiler') RIVE_RUNTIME_DIR = os.getenv('RIVE_RUNTIME_DIR') or '../../../' SKIA_DIR_NAME = os.getenv('SKIA_DIR_NAME') or 'skia' @@ -14,50 +14,64 @@ BASE_DIR = path.getabsolute(RIVE_RUNTIME_DIR .. '/skia/renderer/build') location('./') dofile(path.join(BASE_DIR, 'premake5.lua')) -project 'rive_thumbnail_generator' -kind 'ConsoleApp' -language 'C++' -cppdialect 'C++17' -targetdir '%{cfg.system}/bin/%{cfg.buildcfg}' -objdir '%{cfg.system}/obj/%{cfg.buildcfg}' +project('rive_thumbnail_generator') +kind('ConsoleApp') +language('C++') +cppdialect('C++17') +targetdir('%{cfg.system}/bin/%{cfg.buildcfg}') +objdir('%{cfg.system}/obj/%{cfg.buildcfg}') -includedirs { +includedirs({ RIVE_RUNTIME_DIR .. '/include', RIVE_RUNTIME_DIR .. '/skia/renderer/include', RIVE_RUNTIME_DIR .. '/skia/dependencies/' .. SKIA_DIR_NAME, RIVE_RUNTIME_DIR .. '/skia/dependencies/' .. SKIA_DIR_NAME .. '/include/core', RIVE_RUNTIME_DIR .. '/skia/dependencies/' .. SKIA_DIR_NAME .. '/include/effects', RIVE_RUNTIME_DIR .. '/skia/dependencies/' .. SKIA_DIR_NAME .. '/include/gpu', - RIVE_RUNTIME_DIR .. '/skia/dependencies/' .. SKIA_DIR_NAME .. '/include/config' -} + RIVE_RUNTIME_DIR .. '/skia/dependencies/' .. SKIA_DIR_NAME .. '/include/config', +}) if os.host() == 'macosx' then - links {'Cocoa.framework', 'rive', 'skia', 'rive_skia_renderer', 'rive_harfbuzz', 'rive_sheenbidi'} + links({ + 'Cocoa.framework', + 'rive', + 'skia', + 'rive_skia_renderer', + 'rive_harfbuzz', + 'rive_sheenbidi', + }) else - links {'rive', 'rive_skia_renderer', 'skia', 'GL', 'rive_harfbuzz', 'rive_sheenbidi'} + links({ + 'rive', + 'rive_skia_renderer', + 'skia', + 'GL', + 'rive_harfbuzz', + 'rive_sheenbidi', + }) end -libdirs { +libdirs({ '../../../build/%{cfg.system}/bin/%{cfg.buildcfg}', '../../dependencies/skia/out/static', - '../../renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}' -} + '../../renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}', +}) -files {'../src/**.cpp'} +files({ '../src/**.cpp' }) -buildoptions {'-Wall', '-fno-exceptions', '-fno-rtti'} +buildoptions({ '-Wall', '-fno-exceptions', '-fno-rtti' }) -filter 'configurations:debug' -defines {'DEBUG'} -symbols 'On' +filter('configurations:debug') +defines({ 'DEBUG' }) +symbols('On') -filter 'configurations:release' -defines {'RELEASE'} -defines {'NDEBUG'} -optimize 'On' +filter('configurations:release') +defines({ 'RELEASE' }) +defines({ 'NDEBUG' }) +optimize('On') -- Clean Function -- -newaction { +newaction({ trigger = 'clean', description = 'clean the build', execute = function() @@ -68,5 +82,5 @@ newaction { -- no wildcards in os.remove, so use shell os.execute('rm *.make') print('build cleaned') - end -} + end, +}) diff --git a/tess/build/premake5_tess.lua b/tess/build/premake5_tess.lua index 53885867..7a07170e 100644 --- a/tess/build/premake5_tess.lua +++ b/tess/build/premake5_tess.lua @@ -1,5 +1,5 @@ -workspace 'rive' -configurations {'debug', 'release'} +workspace('rive') +configurations({ 'debug', 'release' }) dependencies = os.getenv('DEPENDENCIES') @@ -7,110 +7,95 @@ rive = '../../' dofile(path.join(path.getabsolute(rive) .. '/build', 'premake5.lua')) -project 'rive_tess_renderer' +project('rive_tess_renderer') do - kind 'StaticLib' - language 'C++' - cppdialect 'C++11' - toolset 'clang' - targetdir '%{cfg.system}/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/obj/%{cfg.buildcfg}' - includedirs { + kind('StaticLib') + language('C++') + cppdialect('C++11') + toolset('clang') + targetdir('%{cfg.system}/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/obj/%{cfg.buildcfg}') + includedirs({ '../include', rive .. '/include', dependencies .. '/sokol', dependencies .. '/earcut.hpp/include/mapbox', - dependencies .. '/libtess2/Include' - } - files { - '../src/**.cpp', - dependencies .. '/libtess2/Source/**.c' - } - buildoptions {'-Wall', '-fno-exceptions', '-fno-rtti', '-Werror=format'} + dependencies .. '/libtess2/Include', + }) + files({ '../src/**.cpp', dependencies .. '/libtess2/Source/**.c' }) + buildoptions({ '-Wall', '-fno-exceptions', '-fno-rtti', '-Werror=format' }) - filter 'configurations:debug' + filter('configurations:debug') do - buildoptions {'-g'} - defines {'DEBUG'} - symbols 'On' + buildoptions({ '-g' }) + defines({ 'DEBUG' }) + symbols('On') end - filter 'configurations:release' + filter('configurations:release') do - buildoptions {'-flto=full'} - defines {'RELEASE', 'NDEBUG'} - optimize 'On' + buildoptions({ '-flto=full' }) + defines({ 'RELEASE', 'NDEBUG' }) + optimize('On') end - filter {'options:graphics=gl'} + filter({ 'options:graphics=gl' }) do - defines {'SOKOL_GLCORE33'} + defines({ 'SOKOL_GLCORE33' }) end - filter {'options:graphics=metal'} + filter({ 'options:graphics=metal' }) do - defines {'SOKOL_METAL'} + defines({ 'SOKOL_METAL' }) end - filter {'options:graphics=d3d'} + filter({ 'options:graphics=d3d' }) do - defines {'SOKOL_D3D11'} + defines({ 'SOKOL_D3D11' }) end - newoption { + newoption({ trigger = 'graphics', value = 'gl', description = 'The graphics api to use.', - allowed = { - {'gl'}, - {'metal'}, - {'d3d'} - } - } + allowed = { { 'gl' }, { 'metal' }, { 'd3d' } }, + }) end -project 'rive_tess_tests' +project('rive_tess_tests') do - dependson 'rive_tess_renderer' - dependson 'rive' - kind 'ConsoleApp' - language 'C++' - cppdialect 'C++17' - toolset 'clang' - targetdir '%{cfg.system}/bin/%{cfg.buildcfg}' - objdir '%{cfg.system}/obj/%{cfg.buildcfg}' - includedirs { + dependson('rive_tess_renderer') + dependson('rive') + kind('ConsoleApp') + language('C++') + cppdialect('C++17') + toolset('clang') + targetdir('%{cfg.system}/bin/%{cfg.buildcfg}') + objdir('%{cfg.system}/obj/%{cfg.buildcfg}') + includedirs({ rive .. 'dev/test/include', -- for catch.hpp rive .. 'test', -- for things like rive_file_reader.hpp '../include', rive .. '/include', dependencies .. '/sokol', - dependencies .. '/earcut.hpp/include/mapbox' - } - files { - '../test/**.cpp', - rive .. 'utils/no_op_factory.cpp' - } - links { - 'rive_tess_renderer', - 'rive', - 'rive_harfbuzz', - 'rive_sheenbidi' - } - buildoptions {'-Wall', '-fno-exceptions', '-fno-rtti', '-Werror=format'} - defines {'TESTING'} + dependencies .. '/earcut.hpp/include/mapbox', + }) + files({ '../test/**.cpp', rive .. 'utils/no_op_factory.cpp' }) + links({ 'rive_tess_renderer', 'rive', 'rive_harfbuzz', 'rive_sheenbidi' }) + buildoptions({ '-Wall', '-fno-exceptions', '-fno-rtti', '-Werror=format' }) + defines({ 'TESTING' }) - filter 'configurations:debug' + filter('configurations:debug') do - buildoptions {'-g'} - defines {'DEBUG'} - symbols 'On' + buildoptions({ '-g' }) + defines({ 'DEBUG' }) + symbols('On') end - filter 'configurations:release' + filter('configurations:release') do - buildoptions {'-flto=full'} - defines {'RELEASE', 'NDEBUG'} - optimize 'On' + buildoptions({ '-flto=full' }) + defines({ 'RELEASE', 'NDEBUG' }) + optimize('On') end end diff --git a/viewer/build/premake5_viewer.lua b/viewer/build/premake5_viewer.lua index 72be65b4..e92b48bc 100644 --- a/viewer/build/premake5_viewer.lua +++ b/viewer/build/premake5_viewer.lua @@ -1,8 +1,5 @@ -workspace 'rive' -configurations { - 'debug', - 'release' -} +workspace('rive') +configurations({ 'debug', 'release' }) dependencies = os.getenv('DEPENDENCIES') @@ -21,268 +18,153 @@ end dofile(path.join(path.getabsolute(rive) .. '/cg_renderer/build', 'premake5.lua')) -project 'rive_viewer' +project('rive_viewer') do if _OPTIONS.renderer == 'tess' then - dependson 'rive_decoders' + dependson('rive_decoders') end - kind 'ConsoleApp' - language 'C++' - cppdialect 'C++17' - toolset 'clang' + 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'} + defines({ 'WITH_RIVE_TEXT', 'WITH_RIVE_AUDIO' }) - includedirs { + includedirs({ '../include', rive .. '/include', rive .. '/skia/renderer/include', -- for font backends dependencies, dependencies .. '/sokol', dependencies .. '/imgui', - miniaudio - } + miniaudio, + }) - links { - 'rive', - 'rive_harfbuzz', - 'rive_sheenbidi' - } + links({ 'rive', 'rive_harfbuzz', 'rive_sheenbidi' }) - libdirs { - rive .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' - } + libdirs({ rive .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' }) - files { + 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' - } + dependencies .. '/imgui/imgui_draw.cpp', + }) - buildoptions { - '-Wall', - '-fno-exceptions', - '-fno-rtti' - } + buildoptions({ '-Wall', '-fno-exceptions', '-fno-rtti' }) - filter { - 'system:macosx' - } + filter({ 'system:macosx' }) do - links { + links({ 'Cocoa.framework', 'IOKit.framework', 'CoreVideo.framework', 'OpenGL.framework', - 'rive_cg_renderer' - } - files { - '../src/**.m', - '../src/**.mm' - } + 'rive_cg_renderer', + }) + files({ '../src/**.m', '../src/**.mm' }) end - filter { - 'system:macosx', - 'options:graphics=gl' - } + filter({ 'system:macosx', 'options:graphics=gl' }) do - links { - 'OpenGL.framework' - } + links({ 'OpenGL.framework' }) end - filter { - 'system:macosx', - 'options:graphics=metal' - } + filter({ 'system:macosx', 'options:graphics=metal' }) do - links { - 'Metal.framework', - 'MetalKit.framework', - 'QuartzCore.framework' - } + links({ 'Metal.framework', 'MetalKit.framework', 'QuartzCore.framework' }) end -- Tess Renderer Configuration - filter { - 'options:renderer=tess' - } + filter({ 'options:renderer=tess' }) do - includedirs { - rive_tess .. '/include', - rive .. '/decoders/include' - } - defines { - 'RIVE_RENDERER_TESS' - } - links { - 'rive_tess_renderer', - 'rive_decoders', - 'libpng', - 'zlib' - } - libdirs { - rive_tess .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' - } + includedirs({ rive_tess .. '/include', rive .. '/decoders/include' }) + defines({ 'RIVE_RENDERER_TESS' }) + links({ 'rive_tess_renderer', 'rive_decoders', 'libpng', 'zlib' }) + libdirs({ rive_tess .. '/build/%{cfg.system}/bin/%{cfg.buildcfg}' }) end - filter { - 'options:renderer=tess', - 'options:graphics=gl' - } + filter({ 'options:renderer=tess', 'options:graphics=gl' }) do - defines { - 'SOKOL_GLCORE33' - } + defines({ 'SOKOL_GLCORE33' }) end - filter { - 'options:renderer=tess', - 'options:graphics=metal' - } + filter({ 'options:renderer=tess', 'options:graphics=metal' }) do - defines { - 'SOKOL_METAL' - } + defines({ 'SOKOL_METAL' }) end - filter { - 'options:renderer=tess', - 'options:graphics=d3d' - } + filter({ 'options:renderer=tess', 'options:graphics=d3d' }) do - defines { - 'SOKOL_D3D11' - } + defines({ 'SOKOL_D3D11' }) end - filter { - 'options:renderer=skia', - 'options:graphics=gl' - } + 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}' - } + 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' - } + filter({ 'options:renderer=skia', 'options:graphics=metal' }) do - defines { - 'SK_METAL', - 'SOKOL_METAL' - } - libdirs { - skia .. '/out/metal/%{cfg.buildcfg}' - } + defines({ 'SK_METAL', 'SOKOL_METAL' }) + libdirs({ skia .. '/out/metal/%{cfg.buildcfg}' }) end - filter { - 'options:renderer=skia', - 'options:graphics=d3d' - } + filter({ 'options:renderer=skia', 'options:graphics=d3d' }) do - defines { - 'SK_DIRECT3D' - } - libdirs { - skia .. '/out/d3d/%{cfg.buildcfg}' - } + defines({ 'SK_DIRECT3D' }) + libdirs({ skia .. '/out/d3d/%{cfg.buildcfg}' }) end - filter { - 'options:renderer=skia' - } + filter({ 'options:renderer=skia' }) do - includedirs { + 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' - } + skia .. '/include/config', + }) + defines({ 'RIVE_RENDERER_SKIA' }) + libdirs({ + rive_skia .. '/renderer/build/%{cfg.system}/bin/%{cfg.buildcfg}', + }) + links({ 'skia', 'rive_skia_renderer' }) end - filter 'configurations:debug' + filter('configurations:debug') do - buildoptions { - '-g' - } - defines { - 'DEBUG' - } - symbols 'On' + buildoptions({ '-g' }) + defines({ 'DEBUG' }) + symbols('On') end - filter 'configurations:release' + filter('configurations:release') do - buildoptions { - '-flto=full' - } - defines { - 'RELEASE' - } - defines { - 'NDEBUG' - } - optimize 'On' + buildoptions({ '-flto=full' }) + defines({ 'RELEASE' }) + defines({ 'NDEBUG' }) + optimize('On') end -- CLI config options - newoption { + newoption({ trigger = 'graphics', value = 'gl', description = 'The graphics api to use.', - allowed = { - { - 'gl' - }, - { - 'metal' - }, - { - 'd3d' - } - } - } + allowed = { { 'gl' }, { 'metal' }, { 'd3d' } }, + }) - newoption { + newoption({ trigger = 'renderer', value = 'skia', description = 'The renderer to use.', - allowed = { - { - 'skia' - }, - { - 'tess' - } - } - } + allowed = { { 'skia' }, { 'tess' } }, + }) end