1#!/bin/bash 2#Copyright (c) 2023 Huawei Device Co., Ltd. 3#Licensed under the Apache License, Version 2.0 (the "License"); 4#you may not use this file except in compliance with the License. 5#You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9#Unless required by applicable law or agreed to in writing, software 10#distributed under the License is distributed on an "AS IS" BASIS, 11#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12#See the License for the specific language governing permissions and 13#limitations under the License. 14set -e 15WORKING_DIR=$(cd "$(dirname "$0")"; pwd) 16PROJECT_ROOT=${WORKING_DIR%/foundation*} 17 18CMAKE_ROOT=$PROJECT_ROOT/prebuilts/cmake/linux-x86/bin 19echo $CMAKE_ROOT 20 21OHOS_NDK=$PROJECT_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm 22LLVM_DIR=$PROJECT_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm 23echo $LLVM_DIR 24 25NINJA_HOME=$PROJECT_ROOT/prebuilts/build-tools/linux-x86/bin 26echo $NINJA_HOME 27 28export PATH="$NINJA_HOME:$PATH" 29DEST_GEN_PATH=$1 30 31compile() 32{ 33 PROJECT_DIR=$DEST_GEN_PATH 34 if [ ! -d "$PROJECT_DIR" ]; then 35 mkdir -p $PROJECT_DIR 36 if [ $? -eq 0 ]; then 37 echo "lume assert compiler mkdir successfully" 38 else 39 echo "lume assert compiler mkdir failed" 40 fi 41 chmod -R 775 $PROJECT_DIR 42 mkdir -p $PROJECT_DIR/Strip 43 if [ $? -eq 0 ]; then 44 echo "lume assert compiler mkdir strip successfully" 45 else 46 echo "lume assert compiler mkdir strip failed" 47 fi 48 fi 49 50 $CMAKE_ROOT/cmake -H$WORKING_DIR -B$PROJECT_DIR -G Ninja 51 ninja -C $PROJECT_DIR -f build.ninja 52 chmod 775 $PROJECT_DIR/LumeAssetCompiler 53 54 cp -r $PROJECT_DIR/LumeAssetCompiler $PROJECT_DIR/Strip 55 #$LLVM_DIR/bin/llvm-strip -s $PROJECT_DIR/Strip/LumeAssetCompiler 56} 57 58echo "compile start asset x86_64" 59 60compile 61