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
25gn gen ${OUT} --args='is_debug=false' --ide=json --json-ide-script=$SKIA_DIR/gn/gn_to_cmake.py
26
27cd ${OUT}
28export CC=/usr/local/bin/clang
29export CXX=/usr/local/bin/clang++
30cmake -G"CodeBlocks - Unix Makefiles" .
31cmake --build . --parallel 8
32
33# Copy build products, ignoring the warning
34# for not copying directories.
35cp ${OUT}/* /OUT || true
36chmod +rw /OUT/*
37