2021-09-11 02:44:38 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-09-30 00:03:40 +08:00
|
|
|
# Part of the LLVM Project, 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
|
|
|
|
# Also available under a BSD-style license. See LICENSE.
|
2021-09-11 02:44:38 +08:00
|
|
|
|
|
|
|
# Simple script that does a CMake configure of this project as an external
|
|
|
|
# LLVM project so it can be tested in isolation to larger assemblies.
|
|
|
|
# This is meant for CI's and project maintainers.
|
|
|
|
|
|
|
|
set -eu -o errtrace
|
|
|
|
|
|
|
|
project_dir="$(cd $(dirname $0)/.. && pwd)"
|
2021-09-28 05:04:54 +08:00
|
|
|
llvm_project_dir="$project_dir/external/llvm-project"
|
2021-09-11 02:44:38 +08:00
|
|
|
build_dir="$project_dir/build"
|
|
|
|
|
|
|
|
cmake -GNinja -B"$build_dir" "$llvm_project_dir/llvm" \
|
2021-09-29 07:32:09 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2021-09-23 00:55:09 +08:00
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
2021-09-11 02:44:38 +08:00
|
|
|
-DLLVM_ENABLE_PROJECTS=mlir \
|
|
|
|
-DLLVM_EXTERNAL_PROJECTS=torch-mlir \
|
|
|
|
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$project_dir" \
|
2021-09-21 04:55:36 +08:00
|
|
|
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
|
2021-09-29 07:32:09 +08:00
|
|
|
-DLLVM_ENABLE_ASSERTIONS=ON \
|
2021-09-24 11:59:12 +08:00
|
|
|
-DLLVM_TARGETS_TO_BUILD=host
|
2021-09-11 02:44:38 +08:00
|
|
|
|
|
|
|
cd "$build_dir"
|
2021-09-28 02:36:44 +08:00
|
|
|
ninja tools/torch-mlir/all check-torch-mlir-all
|