18bf80f4bSopenharmony_ci#!/bin/bash
28bf80f4bSopenharmony_ci#Copyright (c) 2023 Huawei Device Co., Ltd.
38bf80f4bSopenharmony_ci#Licensed under the Apache License, Version 2.0 (the "License");
48bf80f4bSopenharmony_ci#you may not use this file except in compliance with the License.
58bf80f4bSopenharmony_ci#You may obtain a copy of the License at
68bf80f4bSopenharmony_ci#
78bf80f4bSopenharmony_ci#    http://www.apache.org/licenses/LICENSE-2.0
88bf80f4bSopenharmony_ci#
98bf80f4bSopenharmony_ci#Unless required by applicable law or agreed to in writing, software
108bf80f4bSopenharmony_ci#distributed under the License is distributed on an "AS IS" BASIS,
118bf80f4bSopenharmony_ci#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128bf80f4bSopenharmony_ci#See the License for the specific language governing permissions and
138bf80f4bSopenharmony_ci#limitations under the License.
148bf80f4bSopenharmony_ciset -e
158bf80f4bSopenharmony_ciWORKING_DIR=$(cd "$(dirname "$0")"; pwd)
168bf80f4bSopenharmony_ciPROJECT_ROOT=${WORKING_DIR%/foundation*}
178bf80f4bSopenharmony_ci 
188bf80f4bSopenharmony_ciCMAKE_ROOT=$PROJECT_ROOT/prebuilts/cmake/linux-x86/bin
198bf80f4bSopenharmony_ciecho $CMAKE_ROOT
208bf80f4bSopenharmony_ci 
218bf80f4bSopenharmony_ciOHOS_NDK=$PROJECT_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm
228bf80f4bSopenharmony_ciLLVM_DIR=$PROJECT_ROOT/prebuilts/clang/ohos/linux-x86_64/llvm
238bf80f4bSopenharmony_ciecho $LLVM_DIR
248bf80f4bSopenharmony_ci 
258bf80f4bSopenharmony_ciNINJA_HOME=$PROJECT_ROOT/prebuilts/build-tools/linux-x86/bin
268bf80f4bSopenharmony_ciecho $NINJA_HOME
278bf80f4bSopenharmony_ci 
288bf80f4bSopenharmony_ciexport PATH="$NINJA_HOME:$PATH"
298bf80f4bSopenharmony_ciDEST_GEN_PATH=$1
308bf80f4bSopenharmony_ci 
318bf80f4bSopenharmony_cicompile()
328bf80f4bSopenharmony_ci{
338bf80f4bSopenharmony_ci    PROJECT_DIR=$DEST_GEN_PATH
348bf80f4bSopenharmony_ci    if [ -d "$PROJECT_DIR" ]; then
358bf80f4bSopenharmony_ci        rm -rf $PROJECT_DIR
368bf80f4bSopenharmony_ci        echo "Clean Output"
378bf80f4bSopenharmony_ci    fi
388bf80f4bSopenharmony_ci	mkdir -p $PROJECT_DIR
398bf80f4bSopenharmony_ci    chmod -R 775 $PROJECT_DIR
408bf80f4bSopenharmony_ci 
418bf80f4bSopenharmony_ci    mkdir -p $PROJECT_DIR/Strip
428bf80f4bSopenharmony_ci
438bf80f4bSopenharmony_ci    NINJA_TOOL=ninja
448bf80f4bSopenharmony_ci    if [ $HW_NINJA_NAME ]; then
458bf80f4bSopenharmony_ci        echo "Lume assert Compile use ninja_back"
468bf80f4bSopenharmony_ci        NINJA_TOOL=$NINJA_HOME/$HW_NINJA_NAME
478bf80f4bSopenharmony_ci    else
488bf80f4bSopenharmony_ci        echo "Lume assert Compile use ninja"
498bf80f4bSopenharmony_ci        NINJA_TOOL=$NINJA_HOME/ninja
508bf80f4bSopenharmony_ci    fi
518bf80f4bSopenharmony_ci    $CMAKE_ROOT/cmake -H$WORKING_DIR -B$PROJECT_DIR -G Ninja -DCMAKE_MAKE_PROGRAM=$NINJA_TOOL
528bf80f4bSopenharmony_ci    $NINJA_TOOL -C $PROJECT_DIR  -f build.ninja
538bf80f4bSopenharmony_ci    chmod 775 $PROJECT_DIR/LumeAssetCompiler
548bf80f4bSopenharmony_ci    cp -r $PROJECT_DIR/LumeAssetCompiler $PROJECT_DIR/Strip
558bf80f4bSopenharmony_ci    #$LLVM_DIR/bin/llvm-strip -s $PROJECT_DIR/Strip/LumeAssetCompiler
568bf80f4bSopenharmony_ci    rm -rf $WORKING_DIR/../test/RofsBuild/LumeAssetCompiler
578bf80f4bSopenharmony_ci    #cp $PROJECT_DIR/Strip/LumeAssetCompiler $WORKING_DIR/../test/RofsBuild/LumeAssetCompiler
588bf80f4bSopenharmony_ci    cd $WORKING_DIR/../test/RofsBuild/
598bf80f4bSopenharmony_ci    #./compile_rofs.sh rofs
608bf80f4bSopenharmony_ci    cd -
618bf80f4bSopenharmony_ci}
628bf80f4bSopenharmony_ci 
638bf80f4bSopenharmony_ciecho "compile start asset x86_64"
648bf80f4bSopenharmony_ci 
658bf80f4bSopenharmony_cicompile
66