From 38652fd2159be6cd13861627671d8802ecaeb2f6 Mon Sep 17 00:00:00 2001 From: Cindy Liu Date: Fri, 9 Sep 2022 14:43:33 -0700 Subject: [PATCH 1/2] Remove old kokoro crosscompile scripts RIP --- build_tools/cmake/build_host_and_android.sh | 88 ------------------ build_tools/cmake/build_host_and_riscv.sh | 99 --------------------- 2 files changed, 187 deletions(-) delete mode 100755 build_tools/cmake/build_host_and_android.sh delete mode 100755 build_tools/cmake/build_host_and_riscv.sh diff --git a/build_tools/cmake/build_host_and_android.sh b/build_tools/cmake/build_host_and_android.sh deleted file mode 100755 index 96463cf1863a..000000000000 --- a/build_tools/cmake/build_host_and_android.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# Copyright 2020 The IREE Authors -# -# Licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -# Cross-compile the IREE project towards Android with CMake. Designed for CI, -# but can be run manually. This uses previously cached build results and does -# not clear build directories. -# -# Host binaries (e.g. compiler tools) will be built and installed in build-host/ -# Android binaries (e.g. tests) will be built in build-android/. - -set -xeuo pipefail - -if [ "$#" -ne 1 ]; then - echo "usage: $0 " - exit 1 -fi - -ANDROID_ABI=$1 - -ROOT_DIR=$(git rev-parse --show-toplevel) - -CMAKE_BIN="${CMAKE_BIN:-$(which cmake)}" -"${CMAKE_BIN}" --version -"${CC}" --version -"${CXX}" --version -ninja --version - -cd "${ROOT_DIR}" - -# --------------------------------------------------------------------------- # -# Build for the host. - -if [ -d "build-host" ] -then - echo "build-host directory already exists. Will use cached results there." -else - echo "build-host directory does not already exist. Creating a new one." - mkdir build-host -fi -cd build-host - -# Configure, build, install. -"${CMAKE_BIN}" -G Ninja .. \ - -DCMAKE_INSTALL_PREFIX=./install \ - -DIREE_ENABLE_ASSERTIONS=ON \ - -DIREE_BUILD_COMPILER=ON \ - -DIREE_BUILD_TESTS=OFF \ - -DIREE_BUILD_BENCHMARKS=OFF \ - -DIREE_BUILD_SAMPLES=OFF -"${CMAKE_BIN}" --build . --target install -- -k 0 -# --------------------------------------------------------------------------- # - -cd "${ROOT_DIR}" - -# --------------------------------------------------------------------------- # -# Build for the target (Android). - -if [ -d "build-android" ] -then - echo "build-android directory already exists. Will use cached results there." -else - echo "build-android directory does not already exist. Creating a new one." - mkdir build-android -fi -cd build-android - -# Configure towards 64-bit Android 10, then build. -"${CMAKE_BIN}" -G Ninja .. \ - -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ - -DANDROID_ABI="${ANDROID_ABI}" \ - -DANDROID_PLATFORM=android-29 \ - -DIREE_HOST_BINARY_ROOT="${PWD}/../build-host/install" \ - -DIREE_ENABLE_ASSERTIONS=ON \ - -DIREE_BUILD_COMPILER=OFF \ - -DIREE_BUILD_TESTS=ON \ - -DIREE_BUILD_SAMPLES=OFF - -echo "Building all for device" -echo "------------" -"${CMAKE_BIN}" --build . -- -k 0 - -echo "Building test deps for device" -echo "------------------" -"$CMAKE_BIN" --build . --target iree-test-deps -- -k 0 diff --git a/build_tools/cmake/build_host_and_riscv.sh b/build_tools/cmake/build_host_and_riscv.sh deleted file mode 100755 index 0795b3b9764b..000000000000 --- a/build_tools/cmake/build_host_and_riscv.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -# Copyright 2021 The IREE Authors -# -# Licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -# Cross-compile the IREE project towards RISCV with CMake. Designed for CI, -# but can be run manually. This uses previously cached build results and does -# not clear build directories. -# -# Host binaries (e.g. compiler tools) will be built and installed in build-host/ -# RISCV binaries (e.g. tests) will be built in build-riscv/. - -set -x -set -e - -ROOT_DIR="${ROOT_DIR:-$(git rev-parse --show-toplevel)}" -CMAKE_BIN="${CMAKE_BIN:-$(which cmake)}" -RISCV_CONFIG="${RISCV_CONFIG:-rv64}" -RISCV_COMPILER_FLAGS="${RISCV_COMPILER_FLAGS:--O3}" - -"${CMAKE_BIN?}" --version -ninja --version - -cd "${ROOT_DIR?}" - -# --------------------------------------------------------------------------- # -# Build for the host. -BUILD_HOST_DIR="${BUILD_HOST_DIR:-$ROOT_DIR/build-host}" -if [[ -d "${BUILD_HOST_DIR?}" ]]; then - echo "build-host directory already exists. Will use cached results there." -else - echo "build-host directory does not already exist. Creating a new one." - mkdir -p "${BUILD_HOST_DIR?}" -fi - -# Configure, build, install. -"${CMAKE_BIN?}" -G Ninja -B "${BUILD_HOST_DIR?}" \ - -DCMAKE_INSTALL_PREFIX="${BUILD_HOST_DIR?}/install" \ - -DCMAKE_C_COMPILER="${CC:-clang}" \ - -DCMAKE_CXX_COMPILER="${CXX:-clang++}" \ - -DIREE_ENABLE_ASSERTIONS=ON \ - -DIREE_BUILD_COMPILER=ON \ - -DIREE_BUILD_TESTS=OFF \ - -DIREE_BUILD_SAMPLES=OFF \ - "${ROOT_DIR?}" -"${CMAKE_BIN?}" --build "${BUILD_HOST_DIR?}" --target install -- -k 0 -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# Build for the target (riscv). -BUILD_RISCV_DIR="${BUILD_RISCV_DIR:-$ROOT_DIR/build-riscv}" -if [[ -d "${BUILD_RISCV_DIR?}" ]]; then - echo "build-riscv directory already exists. Will use cached results there." -else - echo "build-riscv directory does not already exist. Creating a new one." - mkdir -p "${BUILD_RISCV_DIR?}" -fi - -echo "Build riscv target with the config of ${RISCV_CONFIG?}" -declare -a args -args=( - "-G" "Ninja" - "-B" "${BUILD_RISCV_DIR?}" - -DCMAKE_TOOLCHAIN_FILE="$(realpath ${ROOT_DIR?}/build_tools/cmake/riscv.toolchain.cmake)" - -DIREE_HOST_BINARY_ROOT="$(realpath ${BUILD_HOST_DIR?}/install)" - -DRISCV_CPU="${RISCV_CONFIG?}" - -DRISCV_COMPILER_FLAGS="${RISCV_COMPILER_FLAGS?}" - -DIREE_ENABLE_ASSERTIONS=ON - -DIREE_BUILD_COMPILER=OFF - -DIREE_BUILD_SAMPLES=ON - -DIREE_ENABLE_CPUINFO=OFF -) - -if [[ "${RISCV_CONFIG?}" == "rv64" ]]; then - args+=( - -DRISCV_TOOLCHAIN_ROOT="${RISCV_RV64_LINUX_TOOLCHAIN_ROOT?}" - ) -elif [[ "${RISCV_CONFIG?}" == "rv32-baremetal" ]]; then - args+=( - # TODO(#6353): Off until tools/ are refactored to support threadless config. - -DIREE_BUILD_TESTS=OFF - -DRISCV_TOOLCHAIN_ROOT="${RISCV_RV32_NEWLIB_TOOLCHAIN_ROOT?}" - ) -else - echo "riscv config not supported yet" - return -1 -fi - -args_str=$(IFS=' ' ; echo "${args[*]}") -"${CMAKE_BIN?}" ${args_str} "${ROOT_DIR?}" -"${CMAKE_BIN?}" --build "${BUILD_RISCV_DIR?}" -- -k 0 - -if [[ "${RISCV_CONFIG?}" == "rv64" ]]; then - "${CMAKE_BIN?}" --build "${BUILD_RISCV_DIR?}" --target iree-test-deps -- -k 0 -fi From ac2ac7ba4f0643af855a4bb61ba7647ca367ba67 Mon Sep 17 00:00:00 2001 From: Cindy Liu Date: Mon, 12 Sep 2022 09:55:29 -0700 Subject: [PATCH 2/2] Revert android script removal --- build_tools/cmake/build_host_and_android.sh | 88 +++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100755 build_tools/cmake/build_host_and_android.sh diff --git a/build_tools/cmake/build_host_and_android.sh b/build_tools/cmake/build_host_and_android.sh new file mode 100755 index 000000000000..96463cf1863a --- /dev/null +++ b/build_tools/cmake/build_host_and_android.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# Copyright 2020 The IREE Authors +# +# Licensed under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# Cross-compile the IREE project towards Android with CMake. Designed for CI, +# but can be run manually. This uses previously cached build results and does +# not clear build directories. +# +# Host binaries (e.g. compiler tools) will be built and installed in build-host/ +# Android binaries (e.g. tests) will be built in build-android/. + +set -xeuo pipefail + +if [ "$#" -ne 1 ]; then + echo "usage: $0 " + exit 1 +fi + +ANDROID_ABI=$1 + +ROOT_DIR=$(git rev-parse --show-toplevel) + +CMAKE_BIN="${CMAKE_BIN:-$(which cmake)}" +"${CMAKE_BIN}" --version +"${CC}" --version +"${CXX}" --version +ninja --version + +cd "${ROOT_DIR}" + +# --------------------------------------------------------------------------- # +# Build for the host. + +if [ -d "build-host" ] +then + echo "build-host directory already exists. Will use cached results there." +else + echo "build-host directory does not already exist. Creating a new one." + mkdir build-host +fi +cd build-host + +# Configure, build, install. +"${CMAKE_BIN}" -G Ninja .. \ + -DCMAKE_INSTALL_PREFIX=./install \ + -DIREE_ENABLE_ASSERTIONS=ON \ + -DIREE_BUILD_COMPILER=ON \ + -DIREE_BUILD_TESTS=OFF \ + -DIREE_BUILD_BENCHMARKS=OFF \ + -DIREE_BUILD_SAMPLES=OFF +"${CMAKE_BIN}" --build . --target install -- -k 0 +# --------------------------------------------------------------------------- # + +cd "${ROOT_DIR}" + +# --------------------------------------------------------------------------- # +# Build for the target (Android). + +if [ -d "build-android" ] +then + echo "build-android directory already exists. Will use cached results there." +else + echo "build-android directory does not already exist. Creating a new one." + mkdir build-android +fi +cd build-android + +# Configure towards 64-bit Android 10, then build. +"${CMAKE_BIN}" -G Ninja .. \ + -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \ + -DANDROID_ABI="${ANDROID_ABI}" \ + -DANDROID_PLATFORM=android-29 \ + -DIREE_HOST_BINARY_ROOT="${PWD}/../build-host/install" \ + -DIREE_ENABLE_ASSERTIONS=ON \ + -DIREE_BUILD_COMPILER=OFF \ + -DIREE_BUILD_TESTS=ON \ + -DIREE_BUILD_SAMPLES=OFF + +echo "Building all for device" +echo "------------" +"${CMAKE_BIN}" --build . -- -k 0 + +echo "Building test deps for device" +echo "------------------" +"$CMAKE_BIN" --build . --target iree-test-deps -- -k 0