1# Copyright (c) 2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14set -e 15BIN_PATH=$(dirname $0) 16COMPLIER_PATH_USE="" 17#read config. 18while read line;do 19 eval "$line" 20done < config.cfg 21 22#clean 23if [ -d "build" ]; then 24 rm -rf build 25fi 26if [ -d "output" ]; then 27 rm -rf output 28fi 29 30#build 31if [ "$1" == "clean" ]; then 32 echo "clean finished" 33else 34 echo "build start" 35 mkdir build 36 mkdir output 37 cd build 38 if [ -f "$COMPLIER_PATH_LOCAL"/bin/clang ]; then 39 COMPLIER_PATH_USE=$(dirname $(readlink -f "$COMPLIER_PATH_LOCAL"/clang-mingw)) 40 fi 41 if [ -f "$COMPLIER_PATH"/bin/clang ]; then 42 COMPLIER_PATH_USE=$COMPLIER_PATH 43 fi 44 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../output .. -DCMAKE_TOOLCHAIN_FILE=$BIN_PATH/cmake/mingw_clang_noerror.cmake -DTOOLCHAIN_PATH="$COMPLIER_PATH_USE" -DENGINE_TYPE="$1" 45 cpu_processor_num=$(grep processor /proc/cpuinfo | wc -l) 46 job_num=$(expr "$cpu_processor_num" \* 2) 47 echo Parallel job num is "$job_num" 48 make -j"$job_num" 49 if [ "$1" == "THIN" ] 50 then 51 mv Simulator.exe ../output 52 elif [ "$1" == "RICH" ] 53 then 54 mv Previewer.exe ../output 55 fi 56 echo "build finished" 57fi 58