Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified kokoro/android/build.sh
100644 → 100755
Empty file.
Empty file modified kokoro/check-format/build.sh
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion kokoro/linux-clang-debug/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ set -e # fail on error
set -x # display commands

SCRIPT_DIR=`dirname "$BASH_SOURCE"`
source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG clang -DAMBER_ENABLE_SWIFTSHADER=TRUE
source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG "clang-10.0.0" \
-DAMBER_ENABLE_SWIFTSHADER=TRUE
6 changes: 3 additions & 3 deletions kokoro/linux-clang-release/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ set -e # fail on error
set -x # display commands

SCRIPT_DIR=`dirname "$BASH_SOURCE"`
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE clang \
-DAMBER_ENABLE_SWIFTSHADER=TRUE \
-DAMBER_USE_DXC=TRUE
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE "clang-10.0.0" \
-DAMBER_ENABLE_SWIFTSHADER=TRUE \
-DAMBER_USE_DXC=TRUE
2 changes: 1 addition & 1 deletion kokoro/linux-gcc-debug-dawn/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ set -e # fail on error
set -x # display commands

SCRIPT_DIR=`dirname "$BASH_SOURCE"`
source $SCRIPT_DIR/../scripts/linux/build_dawn.sh DEBUG gcc
source $SCRIPT_DIR/../scripts/linux/build_dawn.sh DEBUG "gcc-9"
3 changes: 2 additions & 1 deletion kokoro/linux-gcc-debug/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ set -e # fail on error
set -x # display commands

SCRIPT_DIR=`dirname "$BASH_SOURCE"`
source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG gcc -DAMBER_ENABLE_SWIFTSHADER=TRUE
source $SCRIPT_DIR/../scripts/linux/build.sh DEBUG "gcc-9" \
-DAMBER_ENABLE_SWIFTSHADER=TRUE
4 changes: 3 additions & 1 deletion kokoro/linux-gcc-release-clspv/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ set -e # fail on error
set -x # display commands

SCRIPT_DIR=`dirname "$BASH_SOURCE"`
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE gcc -DAMBER_USE_CLSPV=TRUE -DAMBER_ENABLE_SWIFTSHADER=TRUE
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE "gcc-9" \
-DAMBER_USE_CLSPV=TRUE \
-DAMBER_ENABLE_SWIFTSHADER=TRUE
2 changes: 1 addition & 1 deletion kokoro/linux-gcc-release/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ set -e # fail on error
set -x # display commands

SCRIPT_DIR=`dirname "$BASH_SOURCE"`
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE gcc \
source $SCRIPT_DIR/../scripts/linux/build.sh RELEASE "gcc-9" \
-DAMBER_ENABLE_SWIFTSHADER=TRUE \
-DAMBER_USE_DXC=TRUE
Empty file modified kokoro/macos-clang-debug/build.sh
100644 → 100755
Empty file.
Empty file modified kokoro/macos-clang-release/build.sh
100644 → 100755
Empty file.
Empty file modified kokoro/ndk-build/build.sh
100644 → 100755
Empty file.
89 changes: 89 additions & 0 deletions kokoro/scripts/linux/build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

# Copyright 2020 The Amber Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e # fail on error

. /bin/using.sh # Declare the bash `using` function for configuring toolchains.

set -x # show commands

BUILD_TYPE="Debug"

using cmake-3.17.2
using ninja-1.10.0

if [ ! -z "$COMPILER" ]; then
using "$COMPILER"
fi

# Possible configurations are:
# DEBUG, RELEASE

if [ $CONFIG = "RELEASE" ]
then
BUILD_TYPE="RelWithDebInfo"
fi

DEPS_ARGS=""
if [[ "$EXTRA_CONFIG" =~ "USE_CLSPV=TRUE" ]]; then
DEPS_ARGS+=" --with-clspv"
fi
if [[ "$EXTRA_CONFIG" =~ "USE_DXC=TRUE" ]]; then
DEPS_ARGS+=" --with-dxc"
fi
if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then
DEPS_ARGS+=" --with-swiftshader"
fi

cd $ROOT_DIR
./tools/git-sync-deps $DEPS_ARGS

mkdir -p build
cd $ROOT_DIR/build

# Invoke the build.
BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
echo $(date): Starting build...
cmake -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DAMBER_USE_LOCAL_VULKAN=1 \
$EXTRA_CONFIG ..

echo $(date): Build everything...
ninja
echo $(date): Build completed.

echo $(date): Starting amber_unittests...
./amber_unittests
echo $(date): amber_unittests completed.

# Swiftshader is only built with gcc, so only run the integration tests with gcc
if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then
OPTS=
if [[ $EXTRA_CONFIG =~ "USE_CLSPV=ON" ]]; then
OPTS="--use-opencl"
fi
if [[ "$EXTRA_CONFIG" =~ "USE_DXC=TRUE" ]]; then
OPTS+=" --use-dxc"
fi

echo $(date): Starting integration tests..
export LD_LIBRARY_PATH=$ROOT_DIR/build/third_party/vulkan-loader/loader
export VK_LAYER_PATH=$ROOT_DIR/build/third_party/vulkan-validationlayers/layers
export VK_ICD_FILENAMES=$ROOT_DIR/build/Linux/vk_swiftshader_icd.json
cd $ROOT_DIR
python3 ./tests/run_tests.py --build-dir $ROOT_DIR/build --use-swiftshader $OPTS
echo $(date): integration tests completed.
fi
126 changes: 25 additions & 101 deletions kokoro/scripts/linux/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# Copyright 2018 The Amber Authors.

# Copyright (C) 2020 The Amber Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,106 +13,29 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Linux Build Script.

set -e # fail on error
set -x # show commands

BUILD_ROOT=$PWD
SRC=$PWD/github/amber
CONFIG=$1
shift
COMPILER=$1
shift
EXTRA_CONFIG=$@

BUILD_TYPE="Debug"

# Always update gcc so we get a newer standard library.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get -qq update
sudo aptitude install -y gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --set gcc "/usr/bin/gcc-7"

CMAKE_C_CXX_COMPILER=""
if [ $COMPILER = "clang" ]
then
CMAKE_C_CXX_COMPILER="-DCMAKE_C_COMPILER=/usr/bin/clang-5.0 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-5.0"
else
CMAKE_C_CXX_COMPILER="-DCMAKE_C_COMPILER=/usr/bin/gcc-7 -DCMAKE_CXX_COMPILER=/usr/bin/g++-7"
fi

# Possible configurations are:
# DEBUG, RELEASE

if [ $CONFIG = "RELEASE" ]
then
BUILD_TYPE="RelWithDebInfo"
fi

# removing the old version
echo y | sudo apt-get purge --auto-remove cmake

# Update CMake
sudo apt purge -y --auto-remove cmake
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
sudo apt-get -qq update
sudo apt-get -qq install -y cmake

echo $(date): $(cmake --version)

# Get ninja
wget -q https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
unzip -q ninja-linux.zip
export PATH="$PWD:$PATH"

DEPS_ARGS=""
if [[ "$EXTRA_CONFIG" =~ "USE_CLSPV=TRUE" ]]; then
DEPS_ARGS+=" --with-clspv"
fi
if [[ "$EXTRA_CONFIG" =~ "USE_DXC=TRUE" ]]; then
DEPS_ARGS+=" --with-dxc"
fi
if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then
DEPS_ARGS+=" --with-swiftshader"
fi

cd $SRC
./tools/git-sync-deps $DEPS_ARGS

mkdir build && cd $SRC/build

# Invoke the build.
BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
echo $(date): Starting build...
cmake -GNinja -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_C_CXX_COMPILER \
-DAMBER_USE_LOCAL_VULKAN=1 \
$EXTRA_CONFIG ..

echo $(date): Build everything...
ninja
echo $(date): Build completed.

echo $(date): Starting amber_unittests...
./amber_unittests
echo $(date): amber_unittests completed.
set -e # Fail on any error.

# Swiftshader is only built with gcc, so only run the integration tests with gcc
if [[ "$EXTRA_CONFIG" =~ "ENABLE_SWIFTSHADER=TRUE" ]]; then
OPTS=
if [[ $EXTRA_CONFIG =~ "USE_CLSPV=ON" ]]; then
OPTS="--use-opencl"
fi
if [[ "$EXTRA_CONFIG" =~ "USE_DXC=TRUE" ]]; then
OPTS+=" --use-dxc"
fi
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
ROOT_DIR="$( cd "${SCRIPT_DIR}/../../.." >/dev/null 2>&1 && pwd )"

echo $(date): Starting integration tests..
export LD_LIBRARY_PATH=build/third_party/vulkan-loader/loader
export VK_LAYER_PATH=build/third_party/vulkan-validationlayers/layers
export VK_ICD_FILENAMES=build/Linux/vk_swiftshader_icd.json
cd $SRC
./tests/run_tests.py --build-dir $SRC/build --use-swiftshader $OPTS
echo $(date): integration tests completed.
fi
CONFIG=$1
COMPILER=$2
EXTRA_CONFIG=${@:3}

docker run --rm -i \
--volume "${ROOT_DIR}:${ROOT_DIR}" \
--volume "${KOKORO_ARTIFACTS_DIR}:${KOKORO_ARTIFACTS_DIR}" \
--workdir "${ROOT_DIR}" \
--env ROOT_DIR="${ROOT_DIR}" \
--env SCRIPT_DIR="${SCRIPT_DIR}" \
--env CONFIG="${CONFIG}" \
--env COMPILER="${COMPILER}" \
--env EXTRA_CONFIG="${EXTRA_CONFIG}" \
--env KOKORO_ARTIFACTS_DIR="${KOKORO_ARTIFACTS_DIR}" \
--entrypoint "${SCRIPT_DIR}/build-docker.sh" \
"gcr.io/shaderc-build/radial-build:latest"

sudo chown -R "$(id -u):$(id -g)" "${ROOT_DIR}/build"
86 changes: 86 additions & 0 deletions kokoro/scripts/linux/build_dawn-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash

# Copyright 2020 The Amber Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e # fail on error

. /bin/using.sh # Declare the bash `using` function for configuring toolchains.

set -x # show commands

BUILD_TYPE="Debug"

using cmake-3.17.2
using ninja-1.10.0

if [ ! -z "$COMPILER" ]; then
using "$COMPILER"
fi

# Possible configurations are:
# DEBUG, RELEASE

if [ $CONFIG = "RELEASE" ]
then
BUILD_TYPE="RelWithDebInfo"
fi

# Make a directory for Dawn dependencies
mkdir -p $ROOT_DIR/build/out/dawn-deps && cd $ROOT_DIR/build/out/dawn-deps

# Get depot tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH="$PWD/depot_tools:$PATH"

# Clone the repo as "dawn"
git clone https://dawn.googlesource.com/dawn dawn && cd dawn
DAWN=$PWD

# Bootstrap the gclient configuration
cp scripts/standalone.gclient .gclient

# Fetch external dependencies and toolchains with gclient
gclient sync
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This could be gclient sync --jobs=16 if we have multiple cores. Doesn't really matter though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what it was before. I'd like to keep optimisations separate if that's okay.


# Generate build files
mkdir -p out/Release
touch out/Release/args.gn
gn gen out/Release

# build dawn
ninja -C out/Release

cd $ROOT_DIR
./tools/git-sync-deps

cd $ROOT_DIR/build

# Invoke the build.
BUILD_SHA=${KOKORO_GITHUB_COMMIT:-$KOKORO_GITHUB_PULL_REQUEST_COMMIT}
echo $(date): Starting build...

cmake -GNinja ..\
-DCMAKE_BUILD_TYPE=$BUILD_TYPE\
-DDawn_INCLUDE_DIR=$DAWN/src/include\
-DDawn_GEN_INCLUDE_DIR=$DAWN/out/Release/gen/src/include\
-DDawn_LIBRARY_DIR=$DAWN/out/Release

echo $(date): Build everything...
ninja
echo $(date): Build completed.

echo $(date): Starting amber_unittests...
./amber_unittests
echo $(date): amber_unittests completed.
Loading