1 Star 0 Fork 26

Jianghengbo/chromium_third_party_skia_1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BUILD.gn 88.85 KB
一键复制 编辑 原始数据 按行查看 历史
李想 提交于 2023-08-12 10:59 . chromium 99.0.4844.88 origin init
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("gn/flutter_defines.gni")
import("gn/fuchsia_defines.gni")
import("gn/shared_sources.gni")
import("gn/skia.gni")
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
import("build/fuchsia/fuchsia_download_sdk.gni")
}
if (skia_use_dawn) {
import("//third_party/externals/dawn/scripts/dawn_features.gni")
}
if (defined(skia_settings)) {
import(skia_settings)
}
import("gn/ios.gni")
# Skia public API, generally provided by :skia.
config("skia_public") {
include_dirs = [ "." ]
defines = []
cflags_objcc = []
if (is_component_build) {
defines += [ "SKIA_DLL" ]
}
if (is_fuchsia || is_linux) {
defines += [ "SK_R32_SHIFT=16" ]
}
if (skia_enable_flutter_defines) {
defines += flutter_defines
}
if (!skia_enable_gpu) {
defines += [ "SK_SUPPORT_GPU=0" ]
}
if (skia_enable_sksl) {
defines += [ "SK_ENABLE_SKSL" ]
}
if (is_fuchsia) {
defines += fuchsia_defines
}
if (skia_gl_standard == "gles") {
defines += [ "SK_ASSUME_GL_ES=1" ]
} else if (skia_gl_standard == "gl") {
defines += [ "SK_ASSUME_GL=1" ]
} else if (skia_gl_standard == "webgl") {
defines += [
"SK_ASSUME_WEBGL=1",
"SK_USE_WEBGL",
]
}
if (!skia_enable_skgpu_v1) {
defines += [ "SK_GPU_V1=0" ]
}
# Some older versions of the Clang toolchain change the visibility of
# symbols decorated with API_AVAILABLE macro to be visible. Users of such
# toolchains suppress the use of this macro till toolchain updates are made.
if (is_mac || is_ios) {
if (skia_enable_api_available_macro) {
defines += [ "SK_ENABLE_API_AVAILABLE" ]
} else {
cflags_objcc += [ "-Wno-unguarded-availability" ]
}
}
}
# Skia internal APIs, used by Skia itself and a few test tools.
config("skia_private") {
visibility = [ "./*" ]
defines = [ "SK_GAMMA_APPLY_TO_A8" ]
if (skia_use_fixed_gamma_text) {
defines += [
"SK_GAMMA_EXPONENT=1.4",
"SK_GAMMA_CONTRAST=0.0",
]
}
if (is_skia_dev_build) {
defines += [
"SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
"GR_TEST_UTILS=1",
]
if (skia_enable_graphite) {
defines += [ "GRAPHITE_TEST_UTILS=1" ]
}
}
libs = []
lib_dirs = []
if (skia_use_gl && skia_use_angle) {
defines += [ "SK_ANGLE" ]
}
if (skia_use_vma) {
defines += [ "SK_USE_VMA" ]
}
if (skia_enable_winuwp) {
defines += [ "SK_WINUWP" ]
}
}
# Any code that's linked into Skia-the-library should use this config via += skia_library_configs.
config("skia_library") {
visibility = [ "./*" ]
defines = [ "SKIA_IMPLEMENTATION=1" ]
}
skia_library_configs = [
":skia_public",
":skia_private",
":skia_library",
]
# Use for CPU-specific Skia code that needs particular compiler flags.
template("opts") {
if (invoker.enabled) {
skia_source_set(target_name) {
visibility = [ ":*" ]
check_includes = false
configs = skia_library_configs
forward_variables_from(invoker, "*")
if (defined(invoker.configs)) {
configs += invoker.configs
}
}
} else {
# If not enabled, a phony empty target that swallows all otherwise unused variables.
skia_source_set(target_name) {
visibility = [ ":*" ]
check_includes = false
forward_variables_from(invoker,
"*",
[
"sources",
"cflags",
])
}
}
}
is_x86 = current_cpu == "x64" || current_cpu == "x86"
opts("none") {
enabled = !is_x86 && current_cpu != "arm" && current_cpu != "arm64"
sources = skia_opts.none_sources
cflags = []
}
opts("armv7") {
enabled = current_cpu == "arm"
sources = skia_opts.armv7_sources + skia_opts.neon_sources
cflags = []
}
opts("arm64") {
enabled = current_cpu == "arm64"
sources = skia_opts.arm64_sources
cflags = []
}
opts("crc32") {
enabled = current_cpu == "arm64"
sources = skia_opts.crc32_sources
cflags = [ "-march=armv8-a+crc" ]
}
opts("sse2") {
enabled = is_x86
sources = skia_opts.sse2_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ]
} else {
cflags = [ "-msse2" ]
}
}
opts("ssse3") {
enabled = is_x86
sources = skia_opts.ssse3_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ]
} else {
cflags = [ "-mssse3" ]
}
}
opts("sse41") {
enabled = is_x86
sources = skia_opts.sse41_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ]
} else {
cflags = [ "-msse4.1" ]
}
}
opts("sse42") {
enabled = is_x86
sources = skia_opts.sse42_sources
if (!is_clang && is_win) {
defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ]
} else {
cflags = [ "-msse4.2" ]
}
}
opts("avx") {
enabled = is_x86
sources = skia_opts.avx_sources
if (is_win) {
cflags = [ "/arch:AVX" ]
} else {
cflags = [ "-mavx" ]
if (is_mac && is_debug) {
cflags += [ "-fno-stack-check" ] # Work around skia:9709
}
}
}
opts("hsw") {
enabled = is_x86
sources = skia_opts.hsw_sources
if (is_win) {
cflags = [ "/arch:AVX2" ]
} else {
cflags = [ "-march=haswell" ]
if (is_mac && is_debug) {
cflags += [ "-fno-stack-check" ] # Work around skia:9709
}
}
}
opts("skx") {
enabled = is_x86
sources = skia_opts.skx_sources
if (is_win) {
cflags = [ "/arch:AVX512" ]
} else {
cflags = [ "-march=skylake-avx512" ]
if (is_mac && is_debug) {
cflags += [ "-fno-stack-check" ] # Work around skia:9709
}
}
}
# Any feature of Skia that requires third-party code should be optional and use this template.
template("optional") {
if (invoker.enabled) {
config(target_name + "_public") {
if (defined(invoker.public_defines)) {
defines = invoker.public_defines
}
if (defined(invoker.public_configs)) {
configs = invoker.public_configs
}
if (defined(invoker.public_include_dirs)) {
include_dirs = invoker.public_include_dirs
}
}
skia_source_set(target_name) {
visibility = [ ":*" ]
check_includes = false
configs = skia_library_configs
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
"*",
[
"configs",
"public_defines",
"sources_for_tests",
"sources_when_disabled",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
all_dependent_configs = [ ":" + target_name + "_public" ]
}
if (defined(invoker.sources_for_tests) && skia_enable_tools) {
skia_source_set(target_name + "_tests") {
visibility = [ ":*" ]
check_includes = false
configs = skia_library_configs
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
"*",
[
"configs",
"public_defines",
"sources",
"sources_for_tests",
"sources_when_disabled",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
testonly = true
sources = invoker.sources_for_tests
if (!defined(deps)) {
deps = []
}
deps += [ ":test" ]
all_dependent_configs = [ ":" + target_name + "_public" ]
}
}
} else {
skia_source_set(target_name) {
visibility = [ ":*" ]
configs = skia_library_configs
# "*" clobbers the current scope; append to existing configs
forward_variables_from(invoker,
"*",
[
"configs",
"public",
"public_defines",
"public_deps",
"deps",
"libs",
"frameworks",
"sources",
"sources_for_tests",
"sources_when_disabled",
])
if (defined(invoker.configs)) {
configs += invoker.configs
}
if (defined(invoker.sources_when_disabled)) {
sources = invoker.sources_when_disabled
}
}
if (defined(invoker.sources_for_tests)) {
skia_source_set(target_name + "_tests") {
visibility = [ ":*" ]
}
}
}
}
optional("android_utils") {
enabled = skia_enable_android_utils
public = [
"client_utils/android/BRDAllocator.h",
"client_utils/android/BitmapRegionDecoder.h",
"client_utils/android/FrontBufferedStream.h",
]
public_defines = [ "SK_ENABLE_ANDROID_UTILS" ]
sources = [
"client_utils/android/BitmapRegionDecoder.cpp",
"client_utils/android/FrontBufferedStream.cpp",
]
}
group("fontmgr_factory") {
public_deps = [ skia_fontmgr_factory ]
}
optional("fontmgr_empty_factory") {
enabled = true
sources = [ "src/ports/SkFontMgr_empty_factory.cpp" ]
}
optional("fontmgr_android") {
enabled = skia_enable_fontmgr_android
deps = [
":typeface_freetype",
"//third_party/expat",
]
public = [ "include/ports/SkFontMgr_android.h" ]
sources = [
"src/ports/SkFontMgr_android.cpp",
"src/ports/SkFontMgr_android_parser.cpp",
"src/ports/SkFontMgr_android_parser.h",
]
sources_for_tests = [ "tests/FontMgrAndroidParserTest.cpp" ]
}
optional("fontmgr_android_factory") {
enabled = skia_enable_fontmgr_android
deps = [ ":fontmgr_android" ]
sources = [ "src/ports/SkFontMgr_android_factory.cpp" ]
}
optional("fontmgr_custom") {
enabled =
skia_enable_fontmgr_custom_directory ||
skia_enable_fontmgr_custom_embedded || skia_enable_fontmgr_custom_empty
deps = [ ":typeface_freetype" ]
public = [ "src/ports/SkFontMgr_custom.h" ]
sources = [ "src/ports/SkFontMgr_custom.cpp" ]
}
optional("fontmgr_custom_directory") {
enabled = skia_enable_fontmgr_custom_directory
deps = [
":fontmgr_custom",
":typeface_freetype",
]
public = [ "include/ports/SkFontMgr_directory.h" ]
sources = [ "src/ports/SkFontMgr_custom_directory.cpp" ]
}
optional("fontmgr_custom_directory_factory") {
enabled = skia_enable_fontmgr_custom_directory
deps = [ ":fontmgr_custom_directory" ]
sources = [ "src/ports/SkFontMgr_custom_directory_factory.cpp" ]
}
optional("fontmgr_custom_embedded") {
enabled = skia_enable_fontmgr_custom_embedded
deps = [
":fontmgr_custom",
":typeface_freetype",
]
sources = [ "src/ports/SkFontMgr_custom_embedded.cpp" ]
}
optional("fontmgr_custom_embedded_factory") {
enabled = skia_enable_fontmgr_custom_embedded
deps = [ ":fontmgr_custom_embedded" ]
sources = [ "src/ports/SkFontMgr_custom_embedded_factory.cpp" ]
}
optional("fontmgr_custom_empty") {
enabled = skia_enable_fontmgr_custom_empty
deps = [
":fontmgr_custom",
":typeface_freetype",
]
public = [ "include/ports/SkFontMgr_empty.h" ]
sources = [ "src/ports/SkFontMgr_custom_empty.cpp" ]
}
optional("fontmgr_custom_empty_factory") {
enabled = skia_enable_fontmgr_custom_empty
deps = [ ":fontmgr_custom_empty" ]
sources = [ "src/ports/SkFontMgr_custom_empty_factory.cpp" ]
}
optional("fontmgr_fontconfig") {
enabled = skia_enable_fontmgr_fontconfig
# The public header includes fontconfig.h and uses FcConfig*
public_deps = [ "//third_party:fontconfig" ]
public = [ "include/ports/SkFontMgr_fontconfig.h" ]
deps = [ ":typeface_freetype" ]
sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
sources_for_tests = [ "tests/FontMgrFontConfigTest.cpp" ]
}
optional("fontmgr_fontconfig_factory") {
enabled = skia_enable_fontmgr_fontconfig
deps = [ ":fontmgr_fontconfig" ]
sources = [ "src/ports/SkFontMgr_fontconfig_factory.cpp" ]
}
optional("fontmgr_FontConfigInterface") {
enabled = skia_enable_fontmgr_FontConfigInterface
deps = [
":typeface_freetype",
"//third_party:fontconfig",
]
public = [
"include/ports/SkFontConfigInterface.h",
"include/ports/SkFontMgr_FontConfigInterface.h",
]
sources = [
"src/ports/SkFontConfigInterface.cpp",
"src/ports/SkFontConfigInterface_direct.cpp",
"src/ports/SkFontConfigInterface_direct_factory.cpp",
"src/ports/SkFontConfigTypeface.h",
"src/ports/SkFontMgr_FontConfigInterface.cpp",
]
}
optional("fontmgr_FontConfigInterface_factory") {
enabled = skia_enable_fontmgr_FontConfigInterface
deps = [ ":fontmgr_FontConfigInterface" ]
sources = [ "src/ports/SkFontMgr_FontConfigInterface_factory.cpp" ]
}
optional("fontmgr_fuchsia") {
enabled = skia_enable_fontmgr_fuchsia
deps = []
if (is_fuchsia && using_fuchsia_sdk) {
deps += [ "//build/fuchsia/fidl:fuchsia.fonts" ]
} else {
deps = [ "//sdk/fidl/fuchsia.fonts" ]
}
public = [ "src/ports/SkFontMgr_fuchsia.h" ]
sources = [ "src/ports/SkFontMgr_fuchsia.cpp" ]
}
optional("fontmgr_mac_ct") {
enabled = skia_use_fonthost_mac
public = [
"include/ports/SkFontMgr_mac_ct.h",
"include/ports/SkTypeface_mac.h",
]
sources = [
"src/ports/SkFontMgr_mac_ct.cpp",
"src/ports/SkScalerContext_mac_ct.cpp",
"src/ports/SkScalerContext_mac_ct.h",
"src/ports/SkTypeface_mac_ct.cpp",
"src/ports/SkTypeface_mac_ct.h",
]
sources_for_tests = [ "tests/TypefaceMacTest.cpp" ]
if (is_mac) {
frameworks = [
# AppKit symbols NSFontWeightXXX may be dlsym'ed.
"AppKit.framework",
"ApplicationServices.framework",
]
}
if (is_ios) {
frameworks = [
"CoreFoundation.framework",
"CoreGraphics.framework",
"CoreText.framework",
# UIKit symbols UIFontWeightXXX may be dlsym'ed.
"UIKit.framework",
]
}
}
optional("fontmgr_mac_ct_factory") {
enabled = skia_use_fonthost_mac
deps = [ ":fontmgr_mac_ct" ]
sources = [ "src/ports/SkFontMgr_mac_ct_factory.cpp" ]
}
optional("fontmgr_win") {
enabled = skia_enable_fontmgr_win
public = [ "include/ports/SkTypeface_win.h" ]
sources = [
"src/fonts/SkFontMgr_indirect.cpp",
"src/ports/SkFontMgr_win_dw.cpp",
"src/ports/SkScalerContext_win_dw.cpp",
"src/ports/SkScalerContext_win_dw.h",
"src/ports/SkTypeface_win_dw.cpp",
"src/ports/SkTypeface_win_dw.h",
]
}
optional("fontmgr_win_factory") {
enabled = skia_enable_fontmgr_win
deps = [ ":fontmgr_win" ]
sources = [ "src/ports/SkFontMgr_win_dw_factory.cpp" ]
}
optional("fontmgr_win_gdi") {
enabled = skia_enable_fontmgr_win_gdi
public = [ "include/ports/SkTypeface_win.h" ]
sources = [ "src/ports/SkFontHost_win.cpp" ]
libs = [ "Gdi32.lib" ]
}
if (skia_lex) {
skia_executable("sksllex") {
sources = [
"src/sksl/lex/DFA.h",
"src/sksl/lex/DFAState.h",
"src/sksl/lex/LexUtil.h",
"src/sksl/lex/Main.cpp",
"src/sksl/lex/NFA.cpp",
"src/sksl/lex/NFA.h",
"src/sksl/lex/NFAState.h",
"src/sksl/lex/NFAtoDFA.h",
"src/sksl/lex/RegexNode.cpp",
"src/sksl/lex/RegexNode.h",
"src/sksl/lex/RegexParser.cpp",
"src/sksl/lex/RegexParser.h",
"src/sksl/lex/TransitionTable.cpp",
"src/sksl/lex/TransitionTable.h",
]
include_dirs = [ "." ]
}
action("run_sksllex") {
script = "gn/run_sksllex.py"
deps = [ ":sksllex(//gn/toolchain:$host_toolchain)" ]
sources = [ "src/sksl/lex/sksl.lex" ]
# GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
# path that starts with target_out_dir and then uses ".." to back up into the src dir.
outputs = [
"$target_out_dir/" + rebase_path("src/sksl/SkSLLexer.h", target_out_dir),
# the script also modifies the corresponding .cpp file, but if we tell GN that it gets
# confused due to the same file being named by two different paths
]
sksllex_path = "$root_out_dir/"
sksllex_path += "sksllex"
if (host_os == "win") {
sksllex_path += ".exe"
}
args = [
rebase_path(sksllex_path),
rebase_path("bin/clang-format"),
rebase_path("bin/fetch-clang-format"),
rebase_path("src"),
]
}
} else {
group("run_sksllex") {
}
}
# `Compile SkSL Tests` relies on skslc.
if (skia_compile_sksl_tests) {
skia_executable("skslc") {
defines = [
"SKSL_STANDALONE",
"SK_DISABLE_TRACING",
"SK_ENABLE_SPIRV_CROSS",
"SK_ENABLE_SPIRV_VALIDATION",
]
sources = [
"src/core/SkArenaAlloc.cpp",
"src/core/SkBlockAllocator.cpp",
"src/core/SkCpu.cpp",
"src/core/SkData.cpp",
"src/core/SkHalf.cpp",
"src/core/SkMalloc.cpp",
"src/core/SkMath.cpp",
"src/core/SkMatrixInvert.cpp",
"src/core/SkSemaphore.cpp",
"src/core/SkStream.cpp",
"src/core/SkString.cpp",
"src/core/SkStringUtils.cpp",
"src/core/SkStringView.cpp",
"src/core/SkThreadID.cpp",
"src/core/SkUtils.cpp",
"src/core/SkVM.cpp",
"src/gpu/GrMemoryPool.cpp",
"src/ports/SkMemory_malloc.cpp",
"src/ports/SkOSFile_stdio.cpp",
"src/sksl/SkSLMain.cpp",
"src/utils/SkJSON.cpp",
"src/utils/SkJSONWriter.cpp",
"src/utils/SkParse.cpp",
"src/utils/SkShaderUtils.cpp",
"src/utils/SkUTF.cpp",
"src/utils/SkVMVisualizer.cpp",
]
libs = []
if (is_win) {
sources += [ "src/ports/SkOSFile_win.cpp" ]
} else {
sources += [ "src/ports/SkOSFile_posix.cpp" ]
libs += [ "dl" ]
}
sources += skia_sksl_sources
sources += skia_sksl_gpu_sources
include_dirs = [ "." ]
deps = [
":run_sksllex",
":skvm_jit",
"//third_party/externals/spirv-tools:spvtools",
"//third_party/externals/spirv-tools:spvtools_val",
"//third_party/spirv-cross:spirv_cross",
]
}
skslc_path = "$root_out_dir/"
if (host_toolchain != default_toolchain_name) {
skslc_path += "$host_toolchain/"
}
skslc_path += "skslc"
if (host_os == "win") {
skslc_path += ".exe"
}
copy("sksl_pre_includes") {
sources = [
"src/sksl/sksl_frag.sksl",
"src/sksl/sksl_gpu.sksl",
"src/sksl/sksl_public.sksl",
"src/sksl/sksl_rt_shader.sksl",
"src/sksl/sksl_vert.sksl",
]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
dehydrate_sksl_sources = get_target_outputs(":sksl_pre_includes")
dehydrate_sksl_outputs = []
foreach(src, dehydrate_sksl_sources) {
name = get_path_info(src, "name")
# GN insists its outputs should go somewhere underneath target_out_dir, so we trick it with a
# path that starts with target_out_dir and then uses ".." to back up into the src dir.
dehydrate_sksl_outputs += [ "$target_out_dir/" + rebase_path(
"src/sksl/generated/$name.dehydrated.sksl",
target_out_dir) ]
}
action("dehydrate_sksl") {
script = "gn/dehydrate_sksl.py"
deps = [
":sksl_pre_includes",
":skslc(//gn/toolchain:$host_toolchain)",
]
sources = dehydrate_sksl_sources
outputs = dehydrate_sksl_outputs
args = [
rebase_path(skslc_path),
rebase_path("src/sksl/generated"),
]
args += rebase_path(dehydrate_sksl_sources)
}
} else {
group("dehydrate_sksl") {
}
}
if (skia_compile_sksl_tests) {
import("gn/sksl_tests.gni")
template("compile_sksl") {
# Compile the passed-in `sources` into `outputs` using skslc, with the given language/settings.
action("compile_sksl_${target_name}") {
script = "gn/compile_sksl_tests.py"
deps = [
":sksl_pre_includes",
":skslc(//gn/toolchain:$host_toolchain)",
]
sources = []
outputs = []
response_file_contents = []
args = [
rebase_path(skslc_path),
invoker.lang,
invoker.settings,
"{{response_file_name}}",
]
testsDir = get_path_info("tests", "abspath")
resourcesDir = get_path_info("resources", "abspath")
foreach(partialPath, invoker.sources) {
dst = testsDir + partialPath
src = resourcesDir + partialPath
dir = get_path_info(dst, "dir")
# We want to support double-extensions (for '.dsl.cpp') but GN doesn't natively handle this.
# Workaround: http://go/ggroup/a/chromium.org/g/gn-dev/c/RdEpjeYtb-4
# For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
# For input path "file.cc", name will contain "file" and ext will contain ".cc".
nameTmp = get_path_info(dst, "name")
name = get_path_info(nameTmp, "name")
ext = get_path_info(nameTmp, "extension")
ext += get_path_info(dst, "extension")
response_file_contents += rebase_path([
src,
dir,
])
sources += [ src ]
foreach(outExtension, invoker.outExtensions) {
# SPIR-V uses separate extensions for .vert shaders.
if (ext == "vert" && outExtension == ".asm.frag") {
outExtension = ".asm.vert"
}
outputs +=
[ target_out_dir + "/" +
rebase_path(dir + "/" + name + outExtension, target_out_dir) ]
}
}
}
}
compile_sksl("glsl_tests") {
sources = sksl_glsl_tests_sources + sksl_glsl_settings_tests_sources
outExtensions = [ ".glsl" ]
lang = "--glsl"
settings = "--settings"
}
compile_sksl("glsl_nosettings_tests") {
sources = sksl_glsl_settings_tests_sources
outExtensions = [ "StandaloneSettings.glsl" ]
lang = "--glsl"
settings = "--nosettings"
}
compile_sksl("metal_tests") {
sources = sksl_metal_tests_sources
outExtensions = [ ".metal" ]
lang = "--metal"
settings = "--settings"
}
compile_sksl("skvm_tests") {
sources = sksl_skvm_tests_sources
outExtensions = [ ".skvm" ]
lang = "--skvm"
settings = "--settings"
}
compile_sksl("stage_tests") {
sources = sksl_stage_tests_sources
outExtensions = [ ".stage" ]
lang = "--stage"
settings = "--settings"
}
compile_sksl("spirv_tests") {
sources = sksl_spirv_tests_sources
outExtensions = [ ".asm.frag" ]
lang = "--spirv"
settings = "--settings"
}
} else {
group("compile_sksl_glsl_tests") {
}
group("compile_sksl_glsl_nosettings_tests") {
}
group("compile_sksl_metal_tests") {
}
group("compile_sksl_skvm_tests") {
}
group("compile_sksl_spirv_tests") {
}
}
optional("gpu_shared") {
enabled = skia_enable_gpu || skia_enable_graphite
sources = skia_shared_gpu_sources
}
optional("gpu") {
enabled = skia_enable_gpu
deps = [
":compile_sksl_glsl_nosettings_tests",
":compile_sksl_glsl_tests",
":compile_sksl_metal_tests",
":compile_sksl_skvm_tests",
":compile_sksl_spirv_tests",
":dehydrate_sksl",
":gpu_shared",
":run_sksllex",
]
if (skia_generate_workarounds) {
deps += [ ":workaround_list" ]
}
public_defines = []
public_configs = []
public_deps = []
sources = skia_gpu_sources + skia_sksl_gpu_sources
if (!skia_enable_skgpu_v1) {
sources -= skia_skgpu_v1_sources
}
libs = []
frameworks = []
if (skia_use_gl) {
public_defines += [ "SK_GL" ]
if (is_android) {
sources += [
"src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
"src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
]
# this lib is required to link against AHardwareBuffer
if (defined(ndk_api) && ndk_api >= 26) {
libs += [ "android" ]
}
} else if (skia_use_egl) {
sources += [
"src/gpu/gl/egl/GrGLMakeEGLInterface.cpp",
"src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp",
]
libs += [ "EGL" ]
} else if (skia_use_webgl) {
sources += [ "src/gpu/gl/webgl/GrGLMakeNativeInterface_webgl.cpp" ]
} else if (is_linux && skia_use_x11) {
sources += [
"src/gpu/gl/glx/GrGLMakeGLXInterface.cpp",
"src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp",
]
libs += [ "GL" ]
} else if (is_mac) {
sources += [ "src/gpu/gl/mac/GrGLMakeNativeInterface_mac.cpp" ]
} else if (is_ios) {
sources += [ "src/gpu/gl/iOS/GrGLMakeNativeInterface_iOS.cpp" ]
} else if (is_win && !skia_enable_winuwp) {
sources += [ "src/gpu/gl/win/GrGLMakeNativeInterface_win.cpp" ]
if (target_cpu != "arm64") {
libs += [ "OpenGL32.lib" ]
}
} else {
sources += [ "src/gpu/gl/GrGLMakeNativeInterface_none.cpp" ]
}
sources += skia_gl_gpu_sources
}
if (skia_use_vulkan) {
public_defines += [ "SK_VULKAN" ]
if (skia_use_vma) {
deps += [ "third_party/vulkanmemoryallocator" ]
}
sources += skia_vk_sources
if (skia_enable_vulkan_debug_layers) {
public_defines += [ "SK_ENABLE_VK_LAYERS" ]
}
if (is_fuchsia) {
if (using_fuchsia_sdk) {
public_deps += [ "$fuchsia_sdk_root/pkg:vulkan" ]
} else {
public_deps += [ "//src/graphics/lib/vulkan" ]
}
}
}
if (is_android && (skia_use_gl || skia_use_vulkan)) {
# this lib is required to link against AHardwareBuffer
if (defined(ndk_api) && ndk_api >= 26) {
libs += [ "android" ]
}
}
if (skia_use_dawn) {
public_defines += [ "SK_DAWN" ]
sources += skia_dawn_sources
public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
deps += [
"//third_party/externals/dawn/src/dawn:dawn_proc",
"//third_party/externals/dawn/src/dawn:dawncpp",
]
if (dawn_enable_d3d12 || dawn_enable_desktop_gl || dawn_enable_metal ||
dawn_enable_opengles || dawn_enable_vulkan) {
deps += [ "//third_party/externals/dawn/src/dawn_native" ]
}
if (dawn_enable_d3d12) {
libs += [
"d3d12.lib",
"dxgi.lib",
"d3dcompiler.lib",
]
} else if (dawn_enable_metal) {
frameworks += [ "Metal.framework" ]
}
}
if (skia_use_direct3d) {
public_defines += [
"SK_DIRECT3D",
"SK_ENABLE_SPIRV_CROSS",
]
deps += [
"//third_party/d3d12allocator",
"//third_party/spirv-cross:spirv_cross",
]
sources += skia_direct3d_sources
if (skia_enable_direct3d_debug_layer) {
public_defines += [ "SK_ENABLE_D3D_DEBUG_LAYER" ]
}
libs += [
"d3d12.lib",
"dxgi.lib",
"d3dcompiler.lib",
]
}
cflags_objcc = []
if (skia_use_metal) {
public_defines += [ "SK_METAL" ]
sources += skia_metal_sources
if (skia_enable_metal_debug_info) {
public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
}
frameworks += [ "Metal.framework" ]
frameworks += [ "Foundation.framework" ]
if (is_ios) {
frameworks += [ "UIKit.framework" ]
}
cflags_objcc += [ "-fobjc-arc" ]
}
if (is_debug) {
public_defines += [ "SK_ENABLE_DUMP_GPU" ]
}
}
optional("gif") {
enabled = !skia_use_wuffs && skia_use_libgifcodec
_libgifcodec_gni_path = "third_party/externals/libgifcodec/libgifcodec.gni"
if ("True" ==
exec_script("gn/checkpath.py",
[ rebase_path(_libgifcodec_gni_path, root_build_dir) ],
"trim string")) {
public_defines = [ "SK_USE_LIBGIFCODEC" ]
public_include_dirs = [
".",
skia_libgifcodec_path,
]
include_dirs = public_include_dirs
import(_libgifcodec_gni_path)
sources = rebase_path(libgifcodec_sources + libgifcodec_public,
".",
skia_libgifcodec_path)
}
}
optional("heif") {
enabled = skia_use_libheif
public_defines = [ "SK_HAS_HEIF_LIBRARY" ]
# This HEIF decoding functionality is a part of the Android Framework.
# https://android.googlesource.com/platform/frameworks/av/+/master/media/libheif/include/HeifDecoderAPI.h
# There isn't a way to compile that library outside of it, so we just link against
# the library. This feature is not supported on other platforms (and we haven't
# yet tried something like https://github.com/strukturag/libheif/tree/master/libheif).
# The dependency for Android is set in gn_to_bp.py.
deps = []
sources = [ "src/codec/SkHeifCodec.cpp" ]
}
optional("jpeg_decode") {
enabled = skia_use_libjpeg_turbo_decode
public_defines = [ "SK_CODEC_DECODES_JPEG" ]
deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
sources = [
"src/codec/SkJpegCodec.cpp",
"src/codec/SkJpegDecoderMgr.cpp",
"src/codec/SkJpegUtility.cpp",
]
}
optional("jpeg_encode") {
enabled = skia_use_libjpeg_turbo_encode
public_defines = [ "SK_ENCODE_JPEG" ]
deps = [ "//third_party/libjpeg-turbo:libjpeg" ]
public = [ "include/encode/SkJpegEncoder.h" ]
sources = [
"src/images/SkJPEGWriteUtility.cpp",
"src/images/SkJpegEncoder.cpp",
]
}
optional("ndk_images") {
enabled = skia_use_ndk_images
public_defines = [ "SK_ENABLE_NDK_IMAGES" ]
sources = [
"src/ports/SkImageEncoder_NDK.cpp",
"src/ports/SkImageGeneratorNDK.cpp",
"src/ports/SkNDKConversions.cpp",
]
libs = [ "jnigraphics" ]
}
optional("graphite") {
libs = []
frameworks = []
enabled = skia_enable_graphite
deps = [ ":gpu_shared" ]
public_defines = [ "SK_GRAPHITE_ENABLED" ]
public = skia_graphite_public
sources = skia_graphite_sources
if (skia_use_metal) {
public_defines += [ "SK_METAL" ]
sources += skia_graphite_mtl_sources
if (skia_enable_metal_debug_info) {
public_defines += [ "SK_ENABLE_MTL_DEBUG_INFO" ]
}
frameworks += [ "Metal.framework" ]
frameworks += [ "Foundation.framework" ]
if (is_ios) {
frameworks += [ "UIKit.framework" ]
}
}
}
optional("pdf") {
enabled = skia_use_zlib && skia_enable_pdf
public_defines = [ "SK_SUPPORT_PDF" ]
deps = [ "//third_party/zlib" ]
if (skia_use_libjpeg_turbo_decode) {
deps += [ ":jpeg_decode" ]
}
if (skia_use_libjpeg_turbo_encode) {
deps += [ ":jpeg_encode" ]
}
public = skia_pdf_public
sources = skia_pdf_sources
sources_when_disabled = [ "src/pdf/SkDocument_PDF_None.cpp" ]
if (skia_use_icu && skia_use_harfbuzz && skia_pdf_subset_harfbuzz) {
deps += [ "//third_party/harfbuzz" ]
defines = [ "SK_PDF_USE_HARFBUZZ_SUBSET" ]
} else if (skia_use_icu && skia_use_sfntly) {
deps += [ "//third_party/sfntly" ]
defines = [ "SK_PDF_USE_SFNTLY" ]
}
}
optional("xps") {
enabled = skia_use_xps && is_win
public_defines = [ "SK_SUPPORT_XPS" ]
public = skia_xps_public
sources = skia_xps_sources
}
optional("png_decode") {
enabled = skia_use_libpng_decode
public_defines = [ "SK_CODEC_DECODES_PNG" ]
deps = [ "//third_party/libpng" ]
sources = [
"src/codec/SkIcoCodec.cpp",
"src/codec/SkPngCodec.cpp",
]
}
optional("png_encode") {
enabled = skia_use_libpng_encode
public_defines = [ "SK_ENCODE_PNG" ]
deps = [ "//third_party/libpng" ]
sources = [ "src/images/SkPngEncoder.cpp" ]
}
optional("raw") {
enabled = skia_use_dng_sdk && skia_use_libjpeg_turbo_decode && skia_use_piex
public_defines = [ "SK_CODEC_DECODES_RAW" ]
deps = [
"//third_party/dng_sdk",
"//third_party/libjpeg-turbo:libjpeg",
"//third_party/piex",
]
# SkRawCodec catches any exceptions thrown by dng_sdk, insulating the rest of
# Skia.
configs = [ "gn/portable:add_exceptions" ]
sources = [ "src/codec/SkRawCodec.cpp" ]
}
import("third_party/skcms/skcms.gni")
skia_source_set("skcms") {
cflags = []
if (!is_win || is_clang) {
cflags += [
"-w",
"-std=c11",
]
}
public = [ "include/third_party/skcms/skcms.h" ]
include_dirs = [ "include/third_party/skcms" ]
sources = rebase_path(skcms_sources, ".", "third_party/skcms")
}
optional("typeface_freetype") {
enabled = skia_use_freetype
deps = [ "//third_party/freetype2" ]
sources = [
"src/ports/SkFontHost_FreeType.cpp",
"src/ports/SkFontHost_FreeType_common.cpp",
"src/ports/SkFontHost_FreeType_common.h",
]
}
optional("webp_decode") {
enabled = skia_use_libwebp_decode
public_defines = [ "SK_CODEC_DECODES_WEBP" ]
deps = [ "//third_party/libwebp" ]
sources = [ "src/codec/SkWebpCodec.cpp" ]
}
optional("webp_encode") {
enabled = skia_use_libwebp_encode
public_defines = [ "SK_ENCODE_WEBP" ]
deps = [ "//third_party/libwebp" ]
sources = [ "src/images/SkWebpEncoder.cpp" ]
}
optional("wuffs") {
enabled = skia_use_wuffs
public_defines = [ "SK_HAS_WUFFS_LIBRARY" ]
deps = [ "//third_party/wuffs" ]
sources = [ "src/codec/SkWuffsCodec.cpp" ]
}
optional("xml") {
enabled = skia_use_expat
public_defines = [ "SK_XML" ]
deps = [ "//third_party/expat" ]
sources = [
"src/svg/SkSVGCanvas.cpp",
"src/svg/SkSVGDevice.cpp",
"src/xml/SkDOM.cpp",
"src/xml/SkXMLParser.cpp",
"src/xml/SkXMLWriter.cpp",
]
}
optional("skvm_jit") {
enabled = skia_enable_skvm_jit_when_possible
public_defines = [ "SKVM_JIT_WHEN_POSSIBLE" ]
if (skia_vtune_path != "") {
public_defines += [ "SKVM_JIT_VTUNE" ]
public_include_dirs = [ "$skia_vtune_path/include" ]
libs = [ "$skia_vtune_path/lib64/jitprofiling.lib" ]
}
}
if (skia_enable_gpu && skia_generate_workarounds) {
action("workaround_list") {
script = "tools/build_workaround_header.py"
inputs = [ "src/gpu/gpu_workaround_list.txt" ]
# GN insists its outputs should go somewhere underneath root_out_dir, so we trick it with a
# path that starts with root_out_dir and then uses ".." to back up into the src dir.
output_file =
rebase_path("include/gpu/GrDriverBugWorkaroundsAutogen.h", root_out_dir)
outputs = [ "$root_out_dir/$output_file" ]
args = [
"--output-file",
"$output_file",
]
foreach(file, inputs) {
args += [ rebase_path(file, root_build_dir) ]
}
}
}
skia_component("skia") {
public_configs = [ ":skia_public" ]
configs = skia_library_configs
public_deps = [
":fontmgr_FontConfigInterface",
":fontmgr_android",
":fontmgr_custom_directory",
":fontmgr_custom_embedded",
":fontmgr_custom_empty",
":fontmgr_fontconfig",
":fontmgr_fuchsia",
":fontmgr_mac_ct",
":fontmgr_win",
":fontmgr_win_gdi",
":gpu",
":graphite",
":pdf",
":skcms",
":xps",
]
deps = [
":android_utils",
":arm64",
":armv7",
":avx",
":crc32",
":fontmgr_factory",
":gif",
":heif",
":hsw",
":jpeg_decode",
":jpeg_encode",
":ndk_images",
":none",
":png_decode",
":png_encode",
":raw",
":skvm_jit",
":skx",
":sse2",
":sse41",
":sse42",
":ssse3",
":webp_decode",
":webp_encode",
":wuffs",
":xml",
]
public = skia_core_public
public += skia_utils_public
public += skia_effects_public
public += skia_effects_imagefilter_public
sources = []
sources += skia_core_sources
sources += skia_utils_sources
sources += skia_effects_sources
sources += skia_effects_imagefilter_sources
sources += [
"src/android/SkAndroidFrameworkUtils.cpp",
"src/android/SkAnimatedImage.cpp",
"src/codec/SkAndroidCodec.cpp",
"src/codec/SkAndroidCodecAdapter.cpp",
"src/codec/SkBmpBaseCodec.cpp",
"src/codec/SkBmpCodec.cpp",
"src/codec/SkBmpMaskCodec.cpp",
"src/codec/SkBmpRLECodec.cpp",
"src/codec/SkBmpStandardCodec.cpp",
"src/codec/SkCodec.cpp",
"src/codec/SkCodecImageGenerator.cpp",
"src/codec/SkColorTable.cpp",
"src/codec/SkEncodedInfo.cpp",
"src/codec/SkMaskSwizzler.cpp",
"src/codec/SkMasks.cpp",
"src/codec/SkParseEncodedOrigin.cpp",
"src/codec/SkSampledCodec.cpp",
"src/codec/SkSampler.cpp",
"src/codec/SkStreamBuffer.cpp",
"src/codec/SkSwizzler.cpp",
"src/codec/SkWbmpCodec.cpp",
"src/images/SkImageEncoder.cpp",
"src/ports/SkDiscardableMemory_none.cpp",
"src/ports/SkGlobalInitialization_default.cpp",
"src/ports/SkImageGenerator_skia.cpp",
"src/ports/SkMemory_malloc.cpp",
"src/ports/SkOSFile_stdio.cpp",
"src/sfnt/SkOTTable_name.cpp",
"src/sfnt/SkOTUtils.cpp",
]
defines = [ "SK_HAS_ANDROID_CODEC" ]
libs = []
if (skia_enable_sksl) {
deps += [ ":dehydrate_sksl" ]
sources += skia_sksl_sources
}
if (is_win) {
sources += [
"src/ports/SkDebug_win.cpp",
"src/ports/SkImageEncoder_WIC.cpp",
"src/ports/SkImageGeneratorWIC.cpp",
"src/ports/SkOSFile_win.cpp",
"src/ports/SkOSLibrary_win.cpp",
]
libs += [
"Ole32.lib",
"OleAut32.lib",
]
if (!skia_enable_winuwp) {
libs += [
"FontSub.lib",
"User32.lib",
"Usp10.lib",
]
}
} else {
sources += [
"src/ports/SkOSFile_posix.cpp",
"src/ports/SkOSLibrary_posix.cpp",
]
libs += [ "dl" ]
}
if (is_android) {
deps += [ "//third_party/expat" ]
if (defined(ndk) && ndk != "") {
deps += [ "//third_party/cpu-features" ]
}
sources += [ "src/ports/SkDebug_android.cpp" ]
libs += [
"EGL",
"GLESv2",
"log",
]
}
if (is_linux || target_cpu == "wasm") {
sources += [ "src/ports/SkDebug_stdio.cpp" ]
if (skia_use_egl) {
libs += [ "GLESv2" ]
}
}
if (is_mac) {
public += [ "include/ports/SkCFObject.h" ]
sources += [
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkImageEncoder_CG.cpp",
"src/ports/SkImageGeneratorCG.cpp",
]
frameworks = [
"ApplicationServices.framework",
"OpenGL.framework",
]
}
if (is_ios) {
public += [ "include/ports/SkCFObject.h" ]
sources += [
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkImageEncoder_CG.cpp",
"src/ports/SkImageGeneratorCG.cpp",
]
frameworks = [
"CoreFoundation.framework",
"ImageIO.framework",
"MobileCoreServices.framework",
]
}
if (is_fuchsia) {
sources += [ "src/ports/SkDebug_stdio.cpp" ]
}
if (skia_enable_spirv_validation) {
deps += [ "//third_party/externals/spirv-tools:spvtools_val" ]
defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
}
if (skia_include_multiframe_procs) {
sources += [ "tools/SkSharingProc.cpp" ]
}
}
# DebugCanvas used in experimental/wasm-skp-debugger
if (target_cpu == "wasm") {
skia_static_library("debugcanvas") {
public_configs = [ ":skia_public" ]
sources = [
"tools/SkSharingProc.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
]
}
}
skia_static_library("pathkit") {
check_includes = false
public_configs = [ ":skia_public" ]
configs = skia_library_configs
deps = [
":arm64",
":armv7",
":avx",
":crc32",
":hsw",
":none",
":sse2",
":sse41",
":sse42",
":ssse3",
]
sources = []
sources += skia_pathops_sources
sources += skia_pathops_public
sources += [
"src/core/SkAnalyticEdge.cpp",
"src/core/SkArenaAlloc.cpp",
"src/core/SkContourMeasure.cpp",
"src/core/SkCubicMap.cpp",
"src/core/SkEdge.cpp",
"src/core/SkEdgeBuilder.cpp",
"src/core/SkEdgeClipper.cpp",
"src/core/SkGeometry.cpp",
"src/core/SkIDChangeListener.cpp",
"src/core/SkLineClipper.cpp",
"src/core/SkMalloc.cpp",
"src/core/SkMallocPixelRef.cpp",
"src/core/SkMath.cpp",
"src/core/SkMatrix.cpp",
"src/core/SkOpts.cpp",
"src/core/SkPaint.cpp",
"src/core/SkPaintPriv.cpp",
"src/core/SkPath.cpp",
"src/core/SkPathBuilder.cpp",
"src/core/SkPathEffect.cpp",
"src/core/SkPathMeasure.cpp",
"src/core/SkPathRef.cpp",
"src/core/SkPoint.cpp",
"src/core/SkRRect.cpp",
"src/core/SkReadBuffer.cpp",
"src/core/SkRect.cpp",
"src/core/SkSemaphore.cpp",
"src/core/SkStream.cpp",
"src/core/SkString.cpp",
"src/core/SkStringUtils.cpp",
"src/core/SkStroke.cpp",
"src/core/SkStrokeRec.cpp",
"src/core/SkStrokerPriv.cpp",
"src/core/SkThreadID.cpp",
"src/core/SkUtils.cpp",
"src/effects/SkDashPathEffect.cpp",
"src/effects/SkTrimPathEffect.cpp",
"src/ports/SkDebug_stdio.cpp",
"src/ports/SkMemory_malloc.cpp",
"src/utils/SkDashPath.cpp",
"src/utils/SkParse.cpp",
"src/utils/SkParsePath.cpp",
"src/utils/SkUTF.cpp",
]
}
group("modules") {
deps = [
"modules/particles",
"modules/skottie",
"modules/skparagraph",
"modules/skshaper",
"modules/svg",
]
}
group("experimental") {
deps = [ "experimental/sktext" ]
}
config("our_vulkan_headers") {
include_dirs = [ "include/third_party/vulkan" ]
}
# Targets guarded by skia_enable_tools may use //third_party freely.
if (skia_enable_tools) {
skia_public_includes = [
"client_utils/android",
"include/android",
"include/c",
"include/codec",
"include/config",
"include/core",
"include/docs",
"include/effects",
"include/encode",
"include/gpu",
"include/pathops",
"include/ports",
"include/svg",
"include/utils",
"include/utils/mac",
"modules/particles/include",
"modules/skottie/include",
"modules/skparagraph/include",
"modules/skshaper/include",
"modules/svg/include",
]
# Used by gn_to_bp.py to list our public include dirs.
skia_source_set("public") {
configs = [ ":skia_public" ]
include_dirs = skia_public_includes
}
config("skia.h_config") {
include_dirs = [ "$target_gen_dir" ]
}
action("skia.h") {
public_configs = [ ":skia.h_config" ]
skia_h = "$target_gen_dir/skia.h"
script = "gn/find_headers.py"
args = [ rebase_path("//bin/gn") ] + [ rebase_path("//") ] +
[ rebase_path(skia_h, root_build_dir) ] +
rebase_path(skia_public_includes)
depfile = "$skia_h.deps"
outputs = [ skia_h ]
}
if (target_cpu == "x64") {
skia_executable("fiddle") {
check_includes = false
libs = []
sources = [
"tools/fiddle/draw.cpp",
"tools/fiddle/fiddle_main.cpp",
]
if (skia_use_egl) {
sources += [ "tools/fiddle/egl_context.cpp" ]
} else {
sources += [ "tools/fiddle/null_context.cpp" ]
}
testonly = true
deps = [
":flags",
":gpu_tool_utils",
":skia",
":skia.h",
"modules/particles",
"modules/skottie",
"modules/skparagraph",
"modules/skshaper",
"modules/svg",
]
}
}
config("cpp14") {
if (is_win) {
cflags_cc = [ "/std:c++14" ]
} else {
cflags_cc = [ "-std=c++14" ]
}
}
skia_source_set("public_headers_warnings_check") {
sources = [ "tools/public_headers_warnings_check.cpp" ]
configs = [
":our_vulkan_headers",
":cpp14",
]
if (defined(skia_header_target_default_configs)) {
configs += skia_header_target_default_configs
}
deps = [
":skia",
":skia.h",
"modules/skottie",
"modules/skshaper",
]
if (skia_use_dawn) {
deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
}
}
template("test_lib") {
config(target_name + "_config") {
if (defined(invoker.public_defines)) {
defines = invoker.public_defines
}
}
skia_source_set(target_name) {
forward_variables_from(invoker, "*", [])
check_includes = false
public_configs = [
":" + target_name + "_config",
":skia_private",
]
if (!defined(deps)) {
deps = []
}
deps += [ ":skia" ]
testonly = true
}
}
template("test_app") {
if (is_ios) {
ios_app_bundle(target_name) {
forward_variables_from(invoker,
"*",
[
"output_name",
"visibility",
"is_shared_library",
])
testonly = true
extra_configs = [ ":skia_private" ]
launchscreen = "platform_tools/ios/app/LaunchScreen.storyboard"
data_sources = [ "resources" ]
if ("True" == exec_script("//gn/checkdir.py",
[ rebase_path("skps", root_build_dir) ],
"trim string")) {
data_sources += [ "skps" ]
}
if ("True" == exec_script("//gn/checkdir.py",
[ rebase_path("mskps", root_build_dir) ],
"trim string")) {
data_sources += [ "mskps" ]
}
}
} else {
# !is_ios
if (defined(invoker.is_shared_library) && invoker.is_shared_library) {
skia_shared_library("lib" + target_name) {
output_dir = root_build_dir
forward_variables_from(invoker, "*", [ "is_shared_library" ])
if (!defined(configs)) {
configs = []
}
configs += [ ":skia_private" ]
testonly = true
}
} else {
_executable = target_name
skia_executable(_executable) {
check_includes = false
output_dir = root_build_dir
forward_variables_from(invoker, "*", [ "is_shared_library" ])
if (!defined(configs)) {
configs = []
}
configs += [ ":skia_private" ]
testonly = true
}
}
if (is_android && skia_android_serial != "" && defined(_executable)) {
action("push_" + target_name) {
output_dir = root_build_dir
script = "gn/push_to_android.py"
deps = [ ":" + _executable ]
_stamp = "$target_gen_dir/$_executable.pushed_$skia_android_serial"
outputs = [ _stamp ]
args = [
rebase_path("$root_build_dir/$_executable"),
skia_android_serial,
rebase_path(_stamp),
]
testonly = true
}
}
}
}
test_lib("gpu_tool_utils") {
public_defines = []
# Bots and even devs may not have Vulkan headers, so put
# include/third_party/vulkan on our path so they're always available.
all_dependent_configs = [ ":our_vulkan_headers" ]
defines = []
if (skia_enable_discrete_gpu) {
defines += [ "SK_ENABLE_DISCRETE_GPU" ]
}
deps = []
public_deps = []
sources = [
"tools/gpu/BackendSurfaceFactory.cpp",
"tools/gpu/BackendSurfaceFactory.h",
"tools/gpu/BackendTextureImageFactory.cpp",
"tools/gpu/BackendTextureImageFactory.h",
"tools/gpu/FlushFinishTracker.cpp",
"tools/gpu/FlushFinishTracker.h",
"tools/gpu/GrContextFactory.cpp",
"tools/gpu/GrTest.cpp",
"tools/gpu/ManagedBackendTexture.cpp",
"tools/gpu/ManagedBackendTexture.h",
"tools/gpu/MemoryCache.cpp",
"tools/gpu/MemoryCache.h",
"tools/gpu/ProxyUtils.cpp",
"tools/gpu/TestContext.cpp",
"tools/gpu/TestOps.cpp",
"tools/gpu/TestOps.h",
"tools/gpu/YUVUtils.cpp",
"tools/gpu/YUVUtils.h",
"tools/gpu/gl/GLTestContext.cpp", # See comment below about
# GrContextFactory workaround.
"tools/gpu/mock/MockTestContext.cpp",
]
libs = []
frameworks = []
if (skia_use_gl) {
sources +=
[ "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp" ]
if (is_ios) {
sources += [ "tools/gpu/gl/iOS/CreatePlatformGLTestContext_iOS.mm" ]
frameworks += [ "OpenGLES.framework" ]
} else if (is_mac) {
sources += [ "tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp" ]
}
if (skia_use_angle) {
deps += [ "//third_party/angle2" ]
sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
}
}
# We need the GLTestContext on Vulkan-only builds for the persistent GL context workaround in
# in GrContextFactory. This only matters for OSes that can run Vulkan.
if ((skia_use_gl || skia_use_vulkan) && target_cpu != "wasm") {
if (is_android || skia_use_egl) {
sources += [ "tools/gpu/gl/egl/CreatePlatformGLTestContext_egl.cpp" ]
libs += [ "EGL" ]
} else if (is_linux) {
sources += [ "tools/gpu/gl/glx/CreatePlatformGLTestContext_glx.cpp" ]
libs += [
"GLU",
"GL",
"X11",
]
} else if (is_win) {
sources += [ "tools/gpu/gl/win/CreatePlatformGLTestContext_win.cpp" ]
libs += [ "Gdi32.lib" ]
if (target_cpu != "arm64") {
libs += [ "OpenGL32.lib" ]
}
}
}
if (skia_use_vulkan) {
sources += [ "tools/gpu/vk/VkTestContext.h" ]
sources += [ "tools/gpu/vk/VkTestContext.cpp" ]
sources += [ "tools/gpu/vk/VkTestHelper.h" ]
sources += [ "tools/gpu/vk/VkTestHelper.cpp" ]
sources += [ "tools/gpu/vk/VkTestUtils.h" ]
sources += [ "tools/gpu/vk/VkTestUtils.cpp" ]
sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.h" ]
sources += [ "tools/gpu/vk/VkYcbcrSamplerHelper.cpp" ]
}
if (skia_use_metal) {
sources += [ "tools/gpu/mtl/MtlTestContext.mm" ]
}
if (skia_use_direct3d) {
sources += [ "tools/gpu/d3d/D3DTestContext.cpp" ]
sources += [ "tools/gpu/d3d/D3DTestUtils.cpp" ]
}
if (skia_use_dawn) {
public_deps += [ "//third_party/externals/dawn/src/dawn:dawn_headers" ]
sources += [ "tools/gpu/dawn/DawnTestContext.cpp" ]
if (is_clang) {
cflags_cc = [ "-Wno-microsoft-cast" ]
}
}
if (!skia_enable_skgpu_v1) {
sources -= [ "tools/gpu/GrTest.cpp" ]
sources -= [ "tools/gpu/TestOps.cpp" ]
sources -= [ "tools/gpu/TestOps.h" ]
}
if (skia_enable_graphite) {
sources += [ "tools/graphite/ContextFactory.h" ]
sources += [ "tools/graphite/ContextFactory.cpp" ]
sources += [ "tools/graphite/GraphiteTestContext.h" ]
sources += [ "tools/graphite/GraphiteTestContext.cpp" ]
if (skia_use_metal) {
sources += [ "tools/graphite/mtl/GraphiteMtlTestContext.h" ]
sources += [ "tools/graphite/mtl/MtlTestContext.mm" ]
}
}
if (is_fuchsia && using_fuchsia_sdk) {
libs +=
[ "${fuchsia_sdk_path}/arch/${target_cpu}/sysroot/lib/libzircon.so" ]
}
} # test_lib("gpu_tool_utils")
test_lib("flags") {
sources = [ "tools/flags/CommandLineFlags.cpp" ]
}
test_lib("common_flags_config") {
sources = [ "tools/flags/CommonFlagsConfig.cpp" ]
deps = [ ":flags" ]
public_deps = [ ":gpu_tool_utils" ]
}
test_lib("common_flags_gpu") {
sources = [ "tools/flags/CommonFlagsGpu.cpp" ]
deps = [ ":flags" ]
public_deps = [ ":gpu_tool_utils" ]
}
test_lib("common_flags_images") {
sources = [ "tools/flags/CommonFlagsImages.cpp" ]
deps = [ ":flags" ]
}
test_lib("common_flags_fontmgr") {
sources = [ "tools/flags/CommonFlagsFontMgr.cpp" ]
deps = [ ":flags" ]
}
test_lib("common_flags_aa") {
sources = [ "tools/flags/CommonFlagsAA.cpp" ]
deps = [ ":flags" ]
}
test_lib("trace") {
deps = [ ":flags" ]
sources = [
"tools/trace/ChromeTracingTracer.cpp",
"tools/trace/ChromeTracingTracer.h",
"tools/trace/EventTracingPriv.cpp",
"tools/trace/EventTracingPriv.h",
"tools/trace/SkDebugfTracer.cpp",
"tools/trace/SkDebugfTracer.h",
]
}
test_lib("tool_utils") {
sources = [
"tools/AndroidSkDebugToStdOut.cpp",
"tools/AutoreleasePool.h",
"tools/DDLPromiseImageHelper.cpp",
"tools/DDLPromiseImageHelper.h",
"tools/DDLTileHelper.cpp",
"tools/DDLTileHelper.h",
"tools/LsanSuppressions.cpp",
"tools/MSKPPlayer.cpp",
"tools/MSKPPlayer.h",
"tools/ProcStats.cpp",
"tools/ProcStats.h",
"tools/Resources.cpp",
"tools/Resources.h",
"tools/RuntimeBlendUtils.cpp",
"tools/RuntimeBlendUtils.h",
"tools/SkMetaData.cpp",
"tools/SkMetaData.h",
"tools/SkSharingProc.cpp",
"tools/SkSharingProc.h",
"tools/Stats.h",
"tools/ToolUtils.cpp",
"tools/ToolUtils.h",
"tools/UrlDataManager.cpp",
"tools/UrlDataManager.h",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugCanvas.h",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DebugLayerManager.h",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/DrawCommand.h",
"tools/debugger/JsonWriteBuffer.cpp",
"tools/debugger/JsonWriteBuffer.h",
"tools/fonts/RandomScalerContext.cpp",
"tools/fonts/RandomScalerContext.h",
"tools/fonts/TestEmptyTypeface.h",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestFontMgr.h",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestSVGTypeface.h",
"tools/fonts/TestTypeface.cpp",
"tools/fonts/TestTypeface.h",
"tools/fonts/ToolUtilsFont.cpp",
"tools/random_parse_path.cpp",
"tools/random_parse_path.h",
"tools/timer/TimeUtils.h",
"tools/timer/Timer.cpp",
"tools/timer/Timer.h",
]
if (target_cpu != "wasm") {
sources += [ "tools/CrashHandler.cpp" ]
}
libs = []
frameworks = []
if (is_ios) {
sources += [ "tools/ios_utils.m" ]
sources += [ "tools/ios_utils.h" ]
if (skia_use_metal) {
sources += [ "tools/AutoreleasePool.mm" ]
}
frameworks += [ "Foundation.framework" ]
} else if (is_mac) {
if (skia_use_metal) {
sources += [ "tools/AutoreleasePool.mm" ]
frameworks += [ "Foundation.framework" ]
}
} else if (is_win && !skia_enable_winuwp) {
libs += [ "DbgHelp.lib" ]
}
defines = []
if (skia_tools_require_resources) {
defines += [ "SK_TOOLS_REQUIRE_RESOURCES" ]
}
deps = [
":flags",
"modules/svg",
]
public_deps = [ ":gpu_tool_utils" ]
}
test_lib("etc1") {
sources = [ "third_party/etc1/etc1.cpp" ]
}
import("gn/gm.gni")
test_lib("gm") {
sources = gm_sources
if (skia_use_gl) {
sources += gl_gm_sources
}
if (!skia_enable_skgpu_v1) {
sources -= skgpu_v1_gm_sources
}
deps = [
":etc1",
":flags",
":skia",
":tool_utils",
"modules/particles",
"modules/skottie",
"modules/skottie:gm",
"modules/skparagraph",
"modules/skparagraph:gm",
"modules/skshaper",
]
if (is_skia_dev_build) {
sources += [ "gm/fiddle.cpp" ]
deps += [ ":skia.h" ]
}
public_deps = [ ":gpu_tool_utils" ]
if (skia_use_ffmpeg) {
deps += [ "experimental/ffmpeg:video_decoder" ]
sources += [ "gm/video_decoder.cpp" ]
}
}
test_lib("test") {
sources = [
"tests/Test.cpp",
"tests/Test.h",
"tests/TestUtils.cpp",
"tests/TestUtils.h",
]
deps = [
":flags",
":skia",
":tool_utils",
]
public_deps = [
":gpu_tool_utils", # Test.h #includes headers from this target.
]
}
import("gn/tests.gni")
test_lib("tests") {
sources = tests_sources + pathops_tests_sources
frameworks = []
if (skia_use_metal) {
sources += metal_tests_sources
cflags_objcc = [ "-fobjc-arc" ]
frameworks += [ "MetalKit.framework" ]
}
if (skia_use_gl) {
sources += gl_tests_sources
}
if (skia_enable_graphite) {
sources += graphite_tests_sources
if (skia_use_metal) {
sources += graphite_metal_tests_sources
}
}
if (!skia_enable_skgpu_v1) {
sources -= skgpu_v1_tests_sources
}
deps = [
":flags",
":fontmgr_android_tests",
":fontmgr_fontconfig_tests",
":fontmgr_mac_ct_tests",
":skia",
":test",
":tool_utils",
"experimental/skrive:tests",
"experimental/sktext:tests",
"modules/skottie:tests",
"modules/skparagraph:tests",
"modules/sksg:tests",
"modules/skshaper",
"modules/svg:tests",
"//third_party/libpng",
"//third_party/libwebp",
"//third_party/zlib",
]
}
import("gn/bench.gni")
test_lib("bench") {
sources = bench_sources
if (skia_enable_graphite) {
sources += graphite_bench_sources
}
if (!skia_enable_skgpu_v1) {
sources -= skgpu_v1_bench_sources
}
deps = [
":flags",
":gm",
":gpu_tool_utils",
":skia",
":tool_utils",
"modules/skparagraph:bench",
"modules/skshaper",
]
}
test_lib("experimental_xform") {
sources = [
"experimental/xform/SkShape.cpp",
"experimental/xform/SkXform.cpp",
"experimental/xform/XContext.cpp",
]
deps = [ ":skia" ]
}
if (is_linux || is_mac) {
if (skia_enable_skottie) {
test_app("skottie_tool") {
deps = [ "modules/skottie:tool" ]
}
}
test_app("svg_tool") {
deps = [ "modules/svg:tool" ]
}
}
import("gn/samples.gni")
test_lib("samples") {
sources = samples_sources
if (!skia_enable_skgpu_v1) {
sources -= skgpu_v1_samples_sources
}
public_deps = [ ":tool_utils" ]
deps = [
":flags",
":gpu_tool_utils",
":xml",
"experimental/sktext:samples",
"modules/audioplayer",
"modules/skparagraph:samples",
"modules/skshaper",
"modules/svg",
"//third_party/imgui",
]
}
test_lib("hash_and_encode") {
sources = [
"tools/HashAndEncode.cpp",
"tools/HashAndEncode.h",
]
deps = [
":flags",
":skia",
"//third_party/libpng",
]
}
if (target_cpu != "wasm") {
test_app("convert-to-nia") {
sources = [ "tools/convert-to-nia.cpp" ]
deps = [ ":skia" ]
}
test_app("imgcvt") {
sources = [ "tools/imgcvt.cpp" ]
deps = [
":skcms",
":skia",
]
}
test_app("fm") {
sources = [
"dm/DMGpuTestProcs.cpp", # blech
"tools/fm/fm.cpp",
]
deps = [
":common_flags_aa",
":common_flags_fontmgr",
":common_flags_gpu",
":flags",
":gm",
":gpu_tool_utils",
":hash_and_encode",
":skia",
":tests",
":tool_utils",
":trace",
"modules/skottie",
"modules/skottie:utils",
"modules/svg",
]
}
test_app("dm") {
sources = [
"dm/DM.cpp",
"dm/DMGpuTestProcs.cpp",
"dm/DMJsonWriter.cpp",
"dm/DMJsonWriter.h",
"dm/DMSrcSink.cpp",
"dm/DMSrcSink.h",
]
deps = [
":common_flags_aa",
":common_flags_config",
":common_flags_fontmgr",
":common_flags_gpu",
":common_flags_images",
":flags",
":gm",
":gpu_tool_utils",
":hash_and_encode",
":skia",
":tests",
":tool_utils",
":trace",
"experimental/skrive",
"modules/skottie",
"modules/skottie:utils",
"modules/svg",
]
}
test_app("sorttoy") {
sources = [
"experimental/sorttoy/Cmds.cpp",
"experimental/sorttoy/Cmds.h",
"experimental/sorttoy/Fake.cpp",
"experimental/sorttoy/Fake.h",
"experimental/sorttoy/SortKey.h",
"experimental/sorttoy/sorttoy.cpp",
"experimental/sorttoy/sorttypes.h",
]
deps = [
":flags",
":skia",
":tool_utils",
]
}
# optional separate library to dlopen when running CanvasStateTests.
skia_shared_library("canvas_state_lib") {
sources = [
"tests/CanvasStateHelpers.cpp",
"tests/CanvasStateHelpers.h",
]
deps = [ ":skia" ]
}
}
if (!is_win) {
test_app("remote_demo") {
sources = [ "tools/remote_demo.cpp" ]
deps = [ ":skia" ]
}
}
if (!is_win) {
test_app("blob_cache_sim") {
sources = [ "tools/blob_cache_sim.cpp" ]
deps = [ ":skia" ]
}
}
test_app("nanobench") {
sources = [ "bench/nanobench.cpp" ]
deps = [
":bench",
":common_flags_aa",
":common_flags_config",
":common_flags_gpu",
":common_flags_images",
":flags",
":gm",
":gpu_tool_utils",
":skia",
":tool_utils",
":trace",
"modules/skparagraph",
"modules/skshaper",
"modules/svg",
]
}
test_app("skpinfo") {
sources = [ "tools/skpinfo.cpp" ]
configs = [ ":our_vulkan_headers" ]
deps = [
":flags",
":skia",
]
}
if (skia_use_ffmpeg) {
test_app("skottie2movie") {
sources = [ "tools/skottie2movie.cpp" ]
deps = [
":flags",
":gpu_tool_utils",
":skia",
"experimental/ffmpeg:video_encoder",
"modules/skottie",
"modules/skottie:utils",
]
}
}
test_app("skpbench") {
sources = [
"bench/BigPath.cpp",
"tools/skpbench/skpbench.cpp",
]
deps = [
":common_flags_config",
":common_flags_gpu",
":flags",
":gpu_tool_utils",
":skia",
":tool_utils",
]
}
test_app("sktexttopdf") {
sources = [ "tools/using_skia_and_harfbuzz.cpp" ]
deps = [
":skia",
"modules/skshaper",
]
}
test_app("create_test_font") {
sources = [ "tools/fonts/create_test_font.cpp" ]
deps = [ ":skia" ]
assert_no_deps = [
# tool_utils requires the output of this app.
":tool_utils",
]
}
if (skia_use_expat) {
test_app("create_test_font_color") {
sources = [ "tools/fonts/create_test_font_color.cpp" ]
deps = [
":flags",
":skia",
":tool_utils",
]
}
}
test_app("get_images_from_skps") {
sources = [ "tools/get_images_from_skps.cpp" ]
deps = [
":flags",
":skia",
]
}
if (!is_ios && target_cpu != "wasm" && !(is_win && target_cpu == "arm64")) {
test_app("skiaserve") {
sources = [
"tools/skiaserve/Request.cpp",
"tools/skiaserve/Response.cpp",
"tools/skiaserve/skiaserve.cpp",
"tools/skiaserve/urlhandlers/BreakHandler.cpp",
"tools/skiaserve/urlhandlers/ClipAlphaHandler.cpp",
"tools/skiaserve/urlhandlers/CmdHandler.cpp",
"tools/skiaserve/urlhandlers/ColorModeHandler.cpp",
"tools/skiaserve/urlhandlers/DataHandler.cpp",
"tools/skiaserve/urlhandlers/DownloadHandler.cpp",
"tools/skiaserve/urlhandlers/EnableGPUHandler.cpp",
"tools/skiaserve/urlhandlers/ImgHandler.cpp",
"tools/skiaserve/urlhandlers/InfoHandler.cpp",
"tools/skiaserve/urlhandlers/OpBoundsHandler.cpp",
"tools/skiaserve/urlhandlers/OpsHandler.cpp",
"tools/skiaserve/urlhandlers/OverdrawHandler.cpp",
"tools/skiaserve/urlhandlers/PostHandler.cpp",
"tools/skiaserve/urlhandlers/QuitHandler.cpp",
"tools/skiaserve/urlhandlers/RootHandler.cpp",
]
deps = [
":flags",
":gpu_tool_utils",
":skia",
":tool_utils",
"//third_party/libmicrohttpd",
]
}
}
test_app("fuzz") {
sources = [
"fuzz/Fuzz.cpp",
"fuzz/Fuzz.h",
"fuzz/FuzzCanvas.cpp",
"fuzz/FuzzCommon.cpp",
"fuzz/FuzzCommon.h",
"fuzz/FuzzCreateDDL.cpp",
"fuzz/FuzzDDLThreading.cpp",
"fuzz/FuzzDrawFunctions.cpp",
"fuzz/FuzzEncoders.cpp",
"fuzz/FuzzGradients.cpp",
"fuzz/FuzzMain.cpp",
"fuzz/FuzzParsePath.cpp",
"fuzz/FuzzPathMeasure.cpp",
"fuzz/FuzzPathop.cpp",
"fuzz/FuzzPolyUtils.cpp",
"fuzz/FuzzRegionOp.cpp",
"fuzz/FuzzSkParagraph.cpp",
"fuzz/FuzzTriangulation.cpp",
"fuzz/oss_fuzz/FuzzAndroidCodec.cpp",
"fuzz/oss_fuzz/FuzzAnimatedImage.cpp",
"fuzz/oss_fuzz/FuzzImage.cpp",
"fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
"fuzz/oss_fuzz/FuzzIncrementalImage.cpp",
"fuzz/oss_fuzz/FuzzJSON.cpp",
"fuzz/oss_fuzz/FuzzPathDeserialize.cpp",
"fuzz/oss_fuzz/FuzzRegionDeserialize.cpp",
"fuzz/oss_fuzz/FuzzRegionSetPath.cpp",
"fuzz/oss_fuzz/FuzzSKP.cpp",
"fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp",
"fuzz/oss_fuzz/FuzzSKSL2Metal.cpp",
"fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp",
"fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp",
"fuzz/oss_fuzz/FuzzSVG.cpp",
"fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp",
"fuzz/oss_fuzz/FuzzSkParagraph.cpp",
"fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp",
"fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
]
deps = [
":flags",
":gpu_tool_utils",
":skia",
"modules/skottie:fuzz",
"modules/skparagraph",
]
}
test_app("pathops_unittest") {
sources = pathops_tests_sources + [
rebase_path("tests/skia_test.cpp"),
rebase_path("tests/Test.cpp"),
]
deps = [
":flags",
":gpu_tool_utils",
":skia",
":tool_utils",
]
}
test_app("dump_record") {
sources = [ "tools/dump_record.cpp" ]
deps = [
":flags",
":skia",
]
}
test_app("skdiff") {
sources = [
"tools/skdiff/skdiff.cpp",
"tools/skdiff/skdiff_html.cpp",
"tools/skdiff/skdiff_main.cpp",
"tools/skdiff/skdiff_utils.cpp",
]
deps = [
":skia",
":tool_utils",
]
}
test_app("skp_parser") {
sources = [ "tools/skp_parser.cpp" ]
deps = [
":skia",
":tool_utils",
]
}
if (!is_win) {
source_set("skqp_lib") { # Not a skia_source_set
check_includes = false
testonly = true
public_configs = [ ":skia_private" ]
sources = [
"dm/DMGpuTestProcs.cpp",
"tools/skqp/src/skqp.cpp",
]
deps = [
":gm",
":skia",
":tests",
":tool_utils",
]
}
test_app("skqp") {
sources = [ "tools/skqp/src/skqp_main.cpp" ]
include_dirs = [ "//" ]
lib_dirs = []
deps = [ ":skqp_lib" ]
}
}
if (is_fuchsia) {
# Build a package repository for skqp on Fuchsia.
group("skqp_repo") {
testonly = true
deps = [ "//build/fuchsia/skqp:skqp_repo" ]
}
}
if (is_android) {
shared_library("libskqp_app") { # Not a skia_shared_library
configs += [ ":skia_private" ]
testonly = true
sources = [ "tools/skqp/src/jni_skqp.cpp" ]
deps = [
":skia",
":skqp_lib",
":tool_utils",
]
libs = [ "android" ]
}
}
if (is_android && skia_use_gl) {
test_app("skottie_android") {
is_shared_library = true
sources = [ "platform_tools/android/apps/skottie/skottielib/src/main/cpp/native-lib.cpp" ]
libs = []
deps = [
":skia",
"modules/skottie",
]
}
test_app("androidkit") {
is_shared_library = true
sources = [
"modules/androidkit/src/AndroidKit.cpp",
"modules/androidkit/src/Canvas.cpp",
"modules/androidkit/src/ColorFilters.cpp",
"modules/androidkit/src/Font.cpp",
"modules/androidkit/src/FontChainAdapter.cpp",
"modules/androidkit/src/Gradients.cpp",
"modules/androidkit/src/Image.cpp",
"modules/androidkit/src/ImageFilter.cpp",
"modules/androidkit/src/Matrix.cpp",
"modules/androidkit/src/Paint.cpp",
"modules/androidkit/src/Path.cpp",
"modules/androidkit/src/PathBuilder.cpp",
"modules/androidkit/src/RuntimeShaderBuilder.cpp",
"modules/androidkit/src/Shader.cpp",
"modules/androidkit/src/SkottieAnimation.cpp",
"modules/androidkit/src/Surface.cpp",
"modules/androidkit/src/Surface.h",
"modules/androidkit/src/SurfaceThread.cpp",
"modules/androidkit/src/SurfaceThread.h",
"modules/androidkit/src/Text.cpp",
"modules/androidkit/src/Utils.cpp",
]
libs = [
"android",
"jnigraphics",
]
deps = [
":sk_app",
":skia",
"experimental/sktext:sktext",
"modules/skottie:skottie",
]
}
}
test_app("list_gms") {
sources = [ "tools/list_gms.cpp" ]
deps = [
":gm",
":skia",
]
}
test_app("list_gpu_unit_tests") {
sources = [
"dm/DMGpuTestProcs.cpp",
"tools/list_gpu_unit_tests.cpp",
]
deps = [
":skia",
":tests",
]
}
test_lib("sk_app") {
public_deps = [
":gpu_tool_utils",
":skia",
]
sources = [
"tools/sk_app/Application.h",
"tools/sk_app/CommandSet.cpp",
"tools/sk_app/CommandSet.h",
"tools/sk_app/DisplayParams.h",
"tools/sk_app/RasterWindowContext.h",
"tools/sk_app/Window.cpp",
"tools/sk_app/Window.h",
"tools/sk_app/WindowContext.cpp",
"tools/sk_app/WindowContext.h",
]
libs = []
frameworks = []
if (is_android) {
sources += [
"tools/sk_app/android/RasterWindowContext_android.cpp",
"tools/sk_app/android/WindowContextFactory_android.h",
"tools/sk_app/android/Window_android.cpp",
"tools/sk_app/android/Window_android.h",
"tools/sk_app/android/main_android.cpp",
"tools/sk_app/android/surface_glue_android.cpp",
"tools/sk_app/android/surface_glue_android.h",
]
libs += [ "android" ]
} else if (is_linux) {
sources += [
"tools/sk_app/unix/RasterWindowContext_unix.cpp",
"tools/sk_app/unix/WindowContextFactory_unix.h",
"tools/sk_app/unix/Window_unix.cpp",
"tools/sk_app/unix/Window_unix.h",
"tools/sk_app/unix/keysym2ucs.c",
"tools/sk_app/unix/keysym2ucs.h",
"tools/sk_app/unix/main_unix.cpp",
]
libs += [
"GL", # Used by raster window context, so cannot be behind skia_use_gl.
"X11",
]
} else if (is_win) {
sources += [
"tools/sk_app/win/RasterWindowContext_win.cpp",
"tools/sk_app/win/WindowContextFactory_win.h",
"tools/sk_app/win/Window_win.cpp",
"tools/sk_app/win/Window_win.h",
"tools/sk_app/win/main_win.cpp",
]
} else if (is_mac) {
sources += [
"tools/sk_app/mac/WindowContextFactory_mac.h",
"tools/sk_app/mac/Window_mac.h",
"tools/sk_app/mac/Window_mac.mm",
"tools/sk_app/mac/main_mac.mm",
]
frameworks += [
"QuartzCore.framework",
"Cocoa.framework",
"Foundation.framework",
]
} else if (is_ios) {
sources += [
"tools/sk_app/ios/WindowContextFactory_ios.h",
"tools/sk_app/ios/Window_ios.h",
"tools/sk_app/ios/Window_ios.mm",
"tools/sk_app/ios/main_ios.mm",
]
frameworks += [ "QuartzCore.framework" ]
}
if (skia_use_gl) {
sources += [ "tools/sk_app/GLWindowContext.cpp" ]
sources += [ "tools/sk_app/GLWindowContext.h" ]
if (is_android) {
sources += [ "tools/sk_app/android/GLWindowContext_android.cpp" ]
} else if (is_linux) {
sources += [ "tools/sk_app/unix/GLWindowContext_unix.cpp" ]
} else if (is_win) {
sources += [ "tools/sk_app/win/GLWindowContext_win.cpp" ]
if (skia_use_angle) {
sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
}
} else if (is_mac) {
sources += [
"tools/sk_app/mac/GLWindowContext_mac.mm",
"tools/sk_app/mac/RasterWindowContext_mac.mm",
]
} else if (is_ios) {
sources += [
"tools/sk_app/ios/GLWindowContext_ios.mm",
"tools/sk_app/ios/RasterWindowContext_ios.mm",
]
}
}
if (skia_use_vulkan) {
sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
sources += [ "tools/sk_app/VulkanWindowContext.h" ]
if (is_android) {
sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
} else if (is_linux) {
sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
libs += [ "X11-xcb" ]
} else if (is_win) {
sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
}
}
if (skia_use_metal) {
sources += [ "tools/sk_app/MetalWindowContext.mm" ]
sources += [ "tools/sk_app/MetalWindowContext.h" ]
if (skia_enable_graphite) {
sources += [ "tools/sk_app/GraphiteMetalWindowContext.mm" ]
sources += [ "tools/sk_app/GraphiteMetalWindowContext.h" ]
}
if (is_mac) {
sources += [ "tools/sk_app/mac/MetalWindowContext_mac.mm" ]
if (skia_enable_graphite) {
sources += [ "tools/sk_app/mac/GraphiteMetalWindowContext_mac.mm" ]
}
} else if (is_ios) {
sources += [ "tools/sk_app/ios/MetalWindowContext_ios.mm" ]
}
}
if (skia_use_direct3d) {
sources += [ "tools/sk_app/win/D3D12WindowContext_win.cpp" ]
}
if (skia_use_dawn) {
sources += [ "tools/sk_app/DawnWindowContext.cpp" ]
sources += [ "tools/sk_app/DawnWindowContext.h" ]
if (is_linux) {
if (dawn_enable_vulkan) {
sources += [ "tools/sk_app/unix/DawnVulkanWindowContext_unix.cpp" ]
defines = [ "VK_USE_PLATFORM_XCB_KHR" ]
libs += [ "X11-xcb" ]
}
} else if (is_win) {
if (dawn_enable_d3d12) {
sources += [ "tools/sk_app/win/DawnD3D12WindowContext_win.cpp" ]
}
} else if (is_mac) {
if (dawn_enable_metal) {
sources += [ "tools/sk_app/mac/DawnMTLWindowContext_mac.mm" ]
}
}
}
deps = [ ":tool_utils" ]
if (is_android) {
deps += [ "//third_party/native_app_glue" ]
}
if (skia_use_gl && skia_use_angle) {
deps += [ "//third_party/angle2" ]
}
}
if (!skia_use_vulkan && (is_mac || is_linux || is_win)) {
test_app("fiddle_examples") {
sources = [
"tools/fiddle/all_examples.cpp",
"tools/fiddle/examples.cpp",
"tools/fiddle/examples.h",
]
if (is_win) {
cflags = [
"/wd4756", # Overflow in constant arithmetic
"/wd4305", # truncation from 'double' to 'float'
]
}
deps = [
":skia",
":skia.h",
"modules/particles",
"modules/skottie",
"modules/skparagraph",
"modules/skshaper",
"modules/svg",
]
}
}
# sk_app can work without GL but viewer always runs raster through a GL window context.
if (skia_use_gl) {
test_app("viewer") {
is_shared_library = is_android
sources = [
"tools/viewer/AnimTimer.h",
"tools/viewer/BisectSlide.cpp",
"tools/viewer/BisectSlide.h",
"tools/viewer/GMSlide.cpp",
"tools/viewer/GMSlide.h",
"tools/viewer/ImGuiLayer.cpp",
"tools/viewer/ImGuiLayer.h",
"tools/viewer/ImageSlide.cpp",
"tools/viewer/ImageSlide.h",
"tools/viewer/MSKPSlide.cpp",
"tools/viewer/MSKPSlide.h",
"tools/viewer/ParticlesSlide.cpp",
"tools/viewer/ParticlesSlide.h",
"tools/viewer/SKPSlide.cpp",
"tools/viewer/SKPSlide.h",
"tools/viewer/SampleSlide.cpp",
"tools/viewer/SampleSlide.h",
"tools/viewer/SkRiveSlide.cpp",
"tools/viewer/SkRiveSlide.h",
"tools/viewer/SkSLDebuggerSlide.cpp",
"tools/viewer/SkSLDebuggerSlide.h",
"tools/viewer/SkSLSlide.cpp",
"tools/viewer/SkSLSlide.h",
"tools/viewer/SkottieSlide.cpp",
"tools/viewer/SkottieSlide.h",
"tools/viewer/Slide.h",
"tools/viewer/SlideDir.cpp",
"tools/viewer/SlideDir.h",
"tools/viewer/StatsLayer.cpp",
"tools/viewer/StatsLayer.h",
"tools/viewer/SvgSlide.cpp",
"tools/viewer/SvgSlide.h",
"tools/viewer/TouchGesture.cpp",
"tools/viewer/TouchGesture.h",
"tools/viewer/Viewer.cpp",
"tools/viewer/Viewer.h",
]
libs = []
deps = [
":common_flags_fontmgr",
":common_flags_gpu",
":flags",
":gm",
":gpu_tool_utils",
":samples",
":sk_app",
":skia",
":tool_utils",
":trace",
"experimental/skrive",
"experimental/sktext",
"modules/audioplayer",
"modules/particles",
"modules/skottie",
"modules/skottie:utils",
"modules/sksg:samples",
"modules/svg",
"//third_party/imgui",
]
if (skia_use_experimental_xform) {
deps += [ ":experimental_xform" ]
sources += [ "gm/xform.cpp" ]
}
if (skia_use_vulkan) {
deps += [
"//third_party/externals/spirv-tools:spvtools",
#spvtools depends on this but doesn't deps it in.
"//third_party/externals/spirv-tools:spvtools_val",
]
}
}
}
if (skia_use_gl && !skia_use_angle && (is_linux || is_win || is_mac)) {
test_app("HelloWorld") {
sources = [ "example/HelloWorld.cpp" ]
libs = []
deps = [
":flags",
":gpu_tool_utils",
":sk_app",
":skia",
":tool_utils",
]
}
}
if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
action_foreach("generate_mocs") {
script = "gn/call.py"
sources = [ "tools/mdbviz/MainWindow.h" ]
outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp" ]
args = [
"$skia_qt_path" + "/bin/moc",
"{{source}}",
"-o",
"gen/mdbviz/{{source_name_part}}_moc.cpp",
]
}
action_foreach("generate_resources") {
script = "gn/call.py"
sources = [ "tools/mdbviz/resources.qrc" ]
outputs = [ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp" ]
args = [
"$skia_qt_path" + "/bin/rcc",
"{{source}}",
"-o",
"gen/mdbviz/{{source_name_part}}_res.cpp",
]
}
test_app("mdbviz") {
if (is_win) {
# on Windows we need to disable some exception handling warnings due to the Qt headers
cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
}
sources = [
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
"tools/mdbviz/MainWindow.cpp",
"tools/mdbviz/Model.cpp",
"tools/mdbviz/main.cpp",
# generated files
"$target_gen_dir/mdbviz/MainWindow_moc.cpp",
"$target_gen_dir/mdbviz/resources_res.cpp",
]
lib_dirs = [ "$skia_qt_path/lib" ]
libs = [
"Qt5Core.lib",
"Qt5Gui.lib",
"Qt5Widgets.lib",
]
include_dirs = [
"$skia_qt_path/include",
"$skia_qt_path/include/QtCore",
"$skia_qt_path/include/QtWidgets",
]
deps = [
":generate_mocs",
":generate_resources",
":skia",
]
}
}
if (is_android && defined(ndk) && ndk != "") {
copy("gdbserver") {
sources = [ "$ndk/$ndk_gdbserver" ]
outputs = [ "$root_out_dir/gdbserver" ]
}
}
skia_executable("cpu_modules") {
sources = [ "tools/cpu_modules.cpp" ]
deps = [
":skia",
"modules/particles",
]
}
if (skia_use_icu && skia_use_harfbuzz) {
test_app("editor") {
is_shared_library = is_android
deps = [ "modules/skplaintexteditor:editor_app" ]
}
test_app("text_editor") {
is_shared_library = is_android
deps = [ "experimental/sktext:text_editor" ]
}
}
skia_executable("image_diff_metric") {
sources = [ "tools/image_diff_metric.cpp" ]
deps = [ ":skia" ]
}
group("modules_testonly") {
testonly = true
deps = []
if (target_cpu == "wasm") {
deps += [ "modules/canvaskit:viewer_wasm" ]
}
}
if (skia_build_fuzzers) {
template("libfuzzer_app") {
skia_executable(target_name) {
output_dir = root_build_dir
check_includes = false
forward_variables_from(invoker, "*", [ "is_shared_library" ])
if (!defined(configs)) {
configs = []
}
configs += [ ":skia_private" ]
sources += [
"fuzz/Fuzz.cpp",
"fuzz/FuzzCommon.cpp",
]
deps += [
":flags",
":gpu_tool_utils",
":skia",
]
defines = [ "SK_BUILD_FOR_LIBFUZZER" ]
if (skia_use_libfuzzer_defaults) {
cflags = [ "-fsanitize=fuzzer" ]
ldflags = [ "-fsanitize=fuzzer" ]
}
testonly = true
}
}
libfuzzer_app("region_deserialize") {
sources = [ "fuzz/oss_fuzz/FuzzRegionDeserialize.cpp" ]
deps = []
}
libfuzzer_app("image_filter_deserialize") {
include_dirs = [
"tools",
"tools/fonts",
]
sources = [
"fuzz/oss_fuzz/FuzzImageFilterDeserialize.cpp",
"tools/Resources.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [ "modules/svg" ]
}
libfuzzer_app("region_set_path") {
sources = [ "fuzz/oss_fuzz/FuzzRegionSetPath.cpp" ]
deps = []
}
libfuzzer_app("textblob_deserialize") {
include_dirs = [
"tools",
"tools/fonts",
]
sources = [
"fuzz/oss_fuzz/FuzzTextBlobDeserialize.cpp",
"tools/Resources.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [ "modules/svg" ]
}
libfuzzer_app("path_deserialize") {
sources = [ "fuzz/oss_fuzz/FuzzPathDeserialize.cpp" ]
deps = []
}
libfuzzer_app("image_decode") {
sources = [ "fuzz/oss_fuzz/FuzzImage.cpp" ]
deps = []
}
libfuzzer_app("animated_image_decode") {
sources = [ "fuzz/oss_fuzz/FuzzAnimatedImage.cpp" ]
deps = []
}
libfuzzer_app("api_create_ddl") {
include_dirs = [
"include",
"include/gpu",
]
sources = [
"fuzz/FuzzCreateDDL.cpp",
"fuzz/oss_fuzz/FuzzAPICreateDDL.cpp",
"tools/Resources.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [
"modules/svg",
"//third_party/libpng",
]
}
libfuzzer_app("api_draw_functions") {
sources = [
"fuzz/FuzzDrawFunctions.cpp",
"fuzz/oss_fuzz/FuzzDrawFunctions.cpp",
]
deps = []
}
libfuzzer_app("api_ddl_threading") {
sources = [
"fuzz/FuzzDDLThreading.cpp",
"fuzz/oss_fuzz/FuzzDDLThreading.cpp",
]
deps = []
}
libfuzzer_app("api_gradients") {
sources = [
"fuzz/FuzzGradients.cpp",
"fuzz/oss_fuzz/FuzzGradients.cpp",
]
deps = []
}
libfuzzer_app("api_image_filter") {
include_dirs = [
"tools",
"tools/debugger",
]
sources = [
"fuzz/FuzzCanvas.cpp",
"fuzz/oss_fuzz/FuzzAPIImageFilter.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
]
deps = [ "//third_party/libpng" ]
}
libfuzzer_app("api_path_measure") {
sources = [
"fuzz/FuzzPathMeasure.cpp",
"fuzz/oss_fuzz/FuzzPathMeasure.cpp",
]
deps = []
}
libfuzzer_app("api_pathop") {
sources = [
"fuzz/FuzzPathop.cpp",
"fuzz/oss_fuzz/FuzzPathop.cpp",
]
deps = []
}
libfuzzer_app("api_triangulation") {
sources = [
"fuzz/FuzzTriangulation.cpp",
"fuzz/oss_fuzz/FuzzTriangulation.cpp",
]
deps = []
}
libfuzzer_app("api_raster_n32_canvas") {
include_dirs = [
"tools",
"tools/debugger",
"tools/fonts",
]
sources = [
"fuzz/FuzzCanvas.cpp",
"fuzz/oss_fuzz/FuzzRasterN32Canvas.cpp",
"tools/Resources.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [
"modules/svg",
"//third_party/libpng",
]
}
libfuzzer_app("api_regionop") {
sources = [
"fuzz/FuzzRegionOp.cpp",
"fuzz/oss_fuzz/FuzzRegionOp.cpp",
]
deps = []
}
if (skia_use_gl) {
libfuzzer_app("api_mock_gpu_canvas") {
include_dirs = [
"tools",
"tools/debugger",
"tools/fonts",
]
sources = [
"fuzz/FuzzCanvas.cpp",
"fuzz/oss_fuzz/FuzzMockGPUCanvas.cpp",
"tools/LsanSuppressions.cpp",
"tools/Resources.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [
"modules/svg",
"//third_party/libpng",
]
}
}
libfuzzer_app("api_null_canvas") {
include_dirs = [
"tools",
"tools/debugger",
"tools/fonts",
]
sources = [
"fuzz/FuzzCanvas.cpp",
"fuzz/oss_fuzz/FuzzNullCanvas.cpp",
"tools/Resources.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [
"modules/svg",
"//third_party/libpng",
]
}
libfuzzer_app("api_skparagraph") {
sources = [
"fuzz/FuzzSkParagraph.cpp",
"fuzz/oss_fuzz/FuzzSkParagraph.cpp",
"tools/Resources.cpp",
]
deps = [ "modules/skparagraph" ]
}
libfuzzer_app("api_svg_canvas") {
include_dirs = [
"include",
"include/svg",
]
sources = [
"fuzz/FuzzCanvas.cpp",
"fuzz/oss_fuzz/FuzzAPISVGCanvas.cpp",
"tools/Resources.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/DebugCanvas.cpp",
"tools/debugger/DebugLayerManager.cpp",
"tools/debugger/DrawCommand.cpp",
"tools/debugger/JsonWriteBuffer.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [
"modules/svg",
"//third_party/libpng",
]
}
libfuzzer_app("png_encoder") {
sources = [
"fuzz/FuzzEncoders.cpp",
"fuzz/oss_fuzz/FuzzPNGEncoder.cpp",
]
deps = []
}
libfuzzer_app("jpeg_encoder") {
sources = [
"fuzz/FuzzEncoders.cpp",
"fuzz/oss_fuzz/FuzzJPEGEncoder.cpp",
]
deps = []
}
libfuzzer_app("webp_encoder") {
sources = [
"fuzz/FuzzEncoders.cpp",
"fuzz/oss_fuzz/FuzzWEBPEncoder.cpp",
]
deps = []
}
libfuzzer_app("skottie_json") {
sources = [
"modules/skottie/fuzz/FuzzSkottieJSON.cpp",
"tools/Resources.cpp",
"tools/fonts/TestFontMgr.cpp",
"tools/fonts/TestSVGTypeface.cpp",
"tools/fonts/TestTypeface.cpp",
]
deps = [
"modules/skottie:skottie",
"modules/svg",
]
}
libfuzzer_app("skjson") {
sources = [ "fuzz/oss_fuzz/FuzzJSON.cpp" ]
deps = []
}
libfuzzer_app("api_polyutils") {
sources = [
"fuzz/FuzzPolyUtils.cpp",
"fuzz/oss_fuzz/FuzzPolyUtils.cpp",
]
deps = [ ":skia" ]
}
libfuzzer_app("android_codec") {
sources = [ "fuzz/oss_fuzz/FuzzAndroidCodec.cpp" ]
deps = []
}
libfuzzer_app("image_decode_incremental") {
sources = [ "fuzz/oss_fuzz/FuzzIncrementalImage.cpp" ]
deps = []
}
libfuzzer_app("sksl2glsl") {
sources = [ "fuzz/oss_fuzz/FuzzSKSL2GLSL.cpp" ]
deps = []
}
libfuzzer_app("sksl2spirv") {
sources = [ "fuzz/oss_fuzz/FuzzSKSL2SPIRV.cpp" ]
deps = []
}
libfuzzer_app("sksl2metal") {
sources = [ "fuzz/oss_fuzz/FuzzSKSL2Metal.cpp" ]
deps = []
}
libfuzzer_app("sksl2pipeline") {
sources = [ "fuzz/oss_fuzz/FuzzSKSL2Pipeline.cpp" ]
deps = []
}
libfuzzer_app("skdescriptor_deserialize") {
sources = [ "fuzz/oss_fuzz/FuzzSkDescriptorDeserialize.cpp" ]
deps = []
}
libfuzzer_app("svg_dom") {
sources = [ "fuzz/oss_fuzz/FuzzSVG.cpp" ]
deps = [ "modules/svg" ]
}
libfuzzer_app("skruntimeeffect") {
sources = [ "fuzz/oss_fuzz/FuzzSkRuntimeEffect.cpp" ]
deps = []
}
libfuzzer_app("skp") {
sources = [ "fuzz/oss_fuzz/FuzzSKP.cpp" ]
deps = []
}
}
}
if (is_ios && skia_use_metal && skia_enable_gpu &&
!skia_enable_flutter_defines) {
group("minimal_ios_mtl_skia_app") {
deps = [ "experimental/minimal_ios_mtl_skia_app" ]
}
}
if (is_ios && skia_enable_skottie && !skia_enable_flutter_defines) {
group("skottie_ios") {
deps = [ "tools/skottie_ios_app" ]
}
}
skia_executable("skia_c_api_example") {
sources = [ "experimental/c-api-example/skia-c-example.c" ]
include_dirs = [ "." ]
deps = [ ":skia" ]
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/HB-J/chromium_third_party_skia_1.git
git@gitee.com:HB-J/chromium_third_party_skia_1.git
HB-J
chromium_third_party_skia_1
chromium_third_party_skia_1
master

搜索帮助