| 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 --volume $SKIA_ROOT:/SRC --volume /tmp/cmake_out:/OUT gcr.io/skia-public/cmake-release:latest /SRC/infra/cmake/build_skia.sh |
| 13 |
|
| 14 |
|
| 15 |
set -xe |
| 16 |
|
| 17 |
#BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/cmake) |
| 18 |
BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd` |
| 19 |
SKIA_DIR=`cd ${BASE_DIR}/../.. && pwd` |
| 20 |
|
| 21 |
OUT="$(mktemp -d)/CMAKE" |
| 22 |
|
| 23 |
cd ${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 |
|
| 28 |
cd ${OUT} |
| 29 |
export CC=/usr/local/bin/clang |
| 30 |
export CXX=/usr/local/bin/clang++ |
| 31 |
cmake -G"CodeBlocks - Unix Makefiles" . |
| 32 |
cmake --build . --parallel 8 |
| 33 |
|
| 34 |
# Copy build products, ignoring the warning |
| 35 |
# for not copying directories. |
| 36 |
cp ${OUT}/* /OUT || true |
| 37 |
chmod +rw /OUT/* |