xref: /aosp_15_r20/external/skia/infra/cmake/build_skia.sh (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#!/bin/bash
2# Copyright 2019 Google LLC
3#
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# This assumes it is being run inside a docker container of cmake-release
8# and a Skia checkout has been mounted at /SRC and the output directory
9# has been mounted at /OUT
10
11# For example:
12# docker run -v $SKIA_ROOT:/SRC -v /tmp/cmake_out:/OUT gcr.io/skia-public/cmake-release:3.13.1_v1 /SRC/infra/cmake/build_skia.sh
13
14
15set -xe
16
17#BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/cmake)
18BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
19SKIA_DIR=`cd ${BASE_DIR}/../.. && pwd`
20
21OUT="$(mktemp -d)/CMAKE"
22
23cd ${SKIA_DIR}
24./bin/fetch-gn
25./bin/fetch-ninja
26./bin/gn gen ${OUT} --args='is_debug=false' --ide=json --json-ide-script=$SKIA_DIR/gn/gn_to_cmake.py --json-ide-script-args="--ninja-executable=$SKIA_DIR/third_party/ninja/ninja"
27
28cd ${OUT}
29export CC=/usr/local/bin/clang
30export CXX=/usr/local/bin/clang++
31cmake -G"CodeBlocks - Unix Makefiles" .
32cmake --build . --parallel 8
33
34# Copy build products, ignoring the warning
35# for not copying directories.
36cp ${OUT}/* /OUT || true
37chmod +rw /OUT/*
38