blob: 97c30e939114a54a614bb2a3752a07f088f9d81f [file] [log] [blame]
#!/bin/bash
# Copyright 2016 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
root_out_dir=${1}
target_cpu=${2}
host_cpu=${3}
host_os=${4}
fuchsia_root=$root_out_dir/../..
tools_path=$fuchsia_root/prebuilt/third_party
cmake=$tools_path/cmake/$host_os-$host_cpu/bin/cmake
ninja_path=$tools_path/ninja/$host_os-$host_cpu/ninja
build_dir=$root_out_dir/build-vulkancts
caselist_build_dir=$root_out_dir/build-vulkancts/cases-build
caselist_out_dir=$root_out_dir/build-vulkancts/cases
# This matches what Fuchsia's binaries are compiled with.
c_cxx_flags="-fexperimental-relative-c++-abi-vtables"
if [[ $target_cpu == "arm64" ]]; then
# Disable ShadowCallStack, since there seem to be some issues with the call
# stack after exceptions are caught.
# TODO(fxb/41627): Re-enable.
extra_args="-DFUCHSIA_SYSTEM_PROCESSOR=aarch64 -DFUCHSIA_COMPILER_TARGET=aarch64-fuchsia -DDE_CPU=DE_CPU_ARM_64 -DDE_PTR_SIZE=8"
c_cxx_flags="$c_cxx_flags -fno-sanitize=shadow-call-stack"
else
extra_args="-DFUCHSIA_SYSTEM_PROCESSOR=x86_64 -DFUCHSIA_COMPILER_TARGET=x86_64-fuchsia"
fi
fuchsia_lib_path=$root_out_dir/$target_cpu-shared
fuchsia_libfdio=$fuchsia_lib_path/libfdio.so
sysroot=$root_out_dir/sdk/exported/zircon_sysroot/arch/$target_cpu/sysroot
if [ ! -d "$sysroot" ]; then
echo "Can't find sysroot: $sysroot"
exit 1
fi
# Export buildtools' cmake to the scripts below.
export PATH="$PATH:$(dirname $cmake)"
pushd $fuchsia_root/third_party/vulkan-cts
python external/fetch_sources.py
popd
mkdir -p $build_dir
$fuchsia_root/third_party/vulkan-cts/fuchsia/gendepsfile.py $build_dir/vulkan-cts.d $fuchsia_root/third_party/vulkan-cts
pushd $build_dir
$cmake $fuchsia_root/third_party/vulkan-cts -GNinja -DCMAKE_BUILD_TYPE=RelWithAsserts -DCMAKE_MAKE_PROGRAM=$ninja_path -DFUCHSIA_SYSROOT=$sysroot -DCMAKE_TOOLCHAIN_FILE=$fuchsia_root/third_party/vulkan-cts/fuchsia/Fuchsia.cmake -DDE_OS=DE_OS_FUCHSIA -DDEQP_TARGET=fuchsia -DFUCHSIA_ROOT=$fuchsia_root -DFUCHSIA_LIB_DIR=$fuchsia_lib_path -DFUCHSIA_LIBFDIO=$fuchsia_libfdio $extra_args -DCMAKE_C_FLAGS="$c_cxx_flags" -DCMAKE_CXX_FLAGS="$c_cxx_flags"
$ninja_path -v deqp-vk executor execserver
# Ensure outputs are up to date so no-op build check doesn't complain.
touch external/vulkancts/modules/vulkan/deqp-vk executor/executor execserver/execserver
popd