Skip to content

Instantly share code, notes, and snippets.

@velyan
Last active July 10, 2024 01:14
Show Gist options
  • Save velyan/7f474a09c51d2c7b658036913edfe003 to your computer and use it in GitHub Desktop.
Save velyan/7f474a09c51d2c7b658036913edfe003 to your computer and use it in GitHub Desktop.
Steps to build Skia on MacOS
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone https://github.com/google/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
python tools/git-sync-deps
//static
bin/gn gen out/release --args="is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_libwebp=false extra_cflags_cc=[\"-frtti\"]"
//dynamic
bin/gn gen out/release --args="is_official_build=true is_component_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false extra_cflags_cc=[\"-frtti\"]"
ninja -C out/release skia
@x3ro
Copy link

x3ro commented Sep 23, 2020

Thanks for this, as it led my on the right path :) I ended up needing to disable a little less stuff, so here's my version:

bin/gn gen out/release \
    --args="is_official_build=false \
            skia_use_libjpeg_turbo_decode=false \
            skia_use_libjpeg_turbo_encode=false \
            extra_cflags_cc=[\"-frtti\"] \
        "

Note that I set is_official_build to false, as I wanted to try out the viewer and HelloWorld targets:

ninja -C out/release HelloWorld
ninja -C out/release viewer

@velyan
Copy link
Author

velyan commented Sep 23, 2020

Thanks for this, as it led my on the right path :) I ended up needing to disable a little less stuff, so here's my version:

bin/gn gen out/release \
    --args="is_official_build=false \
            skia_use_libjpeg_turbo_decode=false \
            skia_use_libjpeg_turbo_encode=false \
            extra_cflags_cc=[\"-frtti\"] \
        "

Note that I set is_official_build to false, as I wanted to try out the viewer and HelloWorld targets:

ninja -C out/release HelloWorld
ninja -C out/release viewer

Thanks for sharing this! 🙌

@LukasBombach
Copy link

@x3ro works for me! btw I am doing this on an Apple Silicon M1 MacMini!

@LukasBombach
Copy link

Thanks

@VitoVan
Copy link

VitoVan commented Aug 29, 2021

Thanks for this, as it led my on the right path :) I ended up needing to disable a little less stuff, so here's my version:

bin/gn gen out/release \
    --args="is_official_build=false \
            skia_use_libjpeg_turbo_decode=false \
            skia_use_libjpeg_turbo_encode=false \
            extra_cflags_cc=[\"-frtti\"] \
        "

Note that I set is_official_build to false, as I wanted to try out the viewer and HelloWorld targets:

ninja -C out/release HelloWorld
ninja -C out/release viewer

Thanks, this works for me.

@velyan
Copy link
Author

velyan commented Sep 3, 2021

Thanks for sharing @VitoVan

@imperativelyfunctional
Copy link

Thank you! I had to use rosetta mode to compile on m1 chip.

@Solido
Copy link

Solido commented Jul 20, 2023

target_cpu="arm64"

@AnyaReese
Copy link

ninja -C out/release viewer

Thank you! This works for my m2 chip >3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment