diff --git a/docker/Dockerfile.ci_hexagon b/docker/Dockerfile.ci_hexagon new file mode 100644 index 000000000000..f1293019bbba --- /dev/null +++ b/docker/Dockerfile.ci_hexagon @@ -0,0 +1,54 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +# CI docker Hexagon env +# tag: v0.01 +FROM tvmcihexagon/ci-hexagon-base:v0.01_SDK4.2.0.2 + +RUN apt-get update --fix-missing +RUN apt-get install -y ca-certificates gnupg2 libxml2-dev + +COPY install/ubuntu_install_core.sh /install/ubuntu_install_core.sh +RUN bash /install/ubuntu_install_core.sh + +COPY install/ubuntu1804_install_python.sh /install/ubuntu1804_install_python.sh +RUN bash /install/ubuntu1804_install_python.sh + +# Globally disable pip cache +RUN pip config set global.cache-dir false + +COPY install/ubuntu_install_python_package.sh /install/ubuntu_install_python_package.sh +RUN bash /install/ubuntu_install_python_package.sh + +# ANTLR deps +COPY install/ubuntu_install_java.sh /install/ubuntu_install_java.sh +RUN bash /install/ubuntu_install_java.sh + +# Android SDK +COPY install/ubuntu_install_androidsdk.sh /install/ubuntu_install_androidsdk.sh +RUN bash /install/ubuntu_install_androidsdk.sh +ENV ANDROID_HOME=/opt/android-sdk-linux +ENV ANDROID_NDK_HOME=/opt/android-sdk-linux/ndk/21.3.6528147 +ENV PATH /opt/android-sdk-linux/platform-tools:$PATH + +# Hexagon +# HEXAGON_SDK_PATH is and env variable in tvmcihexagon/ci-hexagon-base +COPY install/ubuntu_install_hexagon.sh /install/ubuntu_install_hexagon.sh +RUN bash /install/ubuntu_install_hexagon.sh +ENV CLANG_LLVM_HOME /opt/clang-llvm +ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/opt/clang-llvm/lib +ENV HEXAGON_TOOLCHAIN "${HEXAGON_SDK_PATH}/tools/HEXAGON_Tools/8.4.09/Tools" diff --git a/docker/install/ubuntu_install_hexagon.sh b/docker/install/ubuntu_install_hexagon.sh new file mode 100644 index 000000000000..46d2a44cfaa5 --- /dev/null +++ b/docker/install/ubuntu_install_hexagon.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 -o errexit -o nounset +set -o pipefail + +# Install LLVM/clang +CLANG_LLVM_HOME=/opt/clang-llvm +CLANG_LLVM_VERSION=13.0.0 +CLANG_LLVM_FILENAME=clang_llvm.tar.xz +wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_LLVM_VERSION}/clang+llvm-${CLANG_LLVM_VERSION}-x86_64-linux-gnu-ubuntu-16.04.tar.xz -O ${CLANG_LLVM_FILENAME} +mkdir ${CLANG_LLVM_HOME} +tar -xvf ${CLANG_LLVM_FILENAME} -C ${CLANG_LLVM_HOME} --strip-components=1 +rm ${CLANG_LLVM_FILENAME} diff --git a/tests/scripts/task_build_hexagon_api.sh b/tests/scripts/task_build_hexagon_api.sh new file mode 100755 index 000000000000..89b7545f4d89 --- /dev/null +++ b/tests/scripts/task_build_hexagon_api.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +set -u + +cd apps/hexagon_api +rm -rf build +mkdir -p build +cd build + +output_binary_directory=$(realpath ${PWD}/../../../build/hexagon_api_output) +rm -rf ${output_binary_directory} + +cmake -DANDROID_ABI=arm64-v8a \ + -DANDROID_PLATFORM=android-28 \ + -DUSE_ANDROID_TOOLCHAIN="${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" \ + -DUSE_HEXAGON_ARCH=v68 \ + -DUSE_HEXAGON_SDK="${HEXAGON_SDK_PATH}" \ + -DUSE_HEXAGON_TOOLCHAIN="${HEXAGON_TOOLCHAIN}" \ + -DUSE_OUTPUT_BINARY_DIR="${output_binary_directory}" .. + +make -j$(nproc) diff --git a/tests/scripts/task_config_build_hexagon.sh b/tests/scripts/task_config_build_hexagon.sh new file mode 100755 index 000000000000..2c8cabb1e33d --- /dev/null +++ b/tests/scripts/task_config_build_hexagon.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +set -u + +mkdir -p build +cd build +cp ../cmake/config.cmake . + +echo set\(USE_LLVM "${CLANG_LLVM_HOME}/bin/llvm-config"\) >> config.cmake +echo set\(USE_CPP_RPC ON\) >> config.cmake +echo set\(CMAKE_CXX_COMPILER "${CLANG_LLVM_HOME}/bin/clang++"\) >> config.cmake +echo set\(USE_HEXAGON_SDK "${HEXAGON_SDK_PATH}"\) >> config.cmake +echo set\(USE_HEXAGON_ARCH "v68"\) >> config.cmake +echo set\(USE_HEXAGON_DEVICE "sim"\) >> config.cmake