1#!/bin/bash
2# Copyright (C) 2024 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.
14
15set -e
16
17COMPILER_PATH=$1
18TEST_COMPILER_PATH=${COMPILER_PATH}/../LumeBinaryCompile/lumeassetcompiler
19CPU_TYPE=$2
20ASSETS_PATH=$3
21ROOT_PATH=$4
22BIN_NAME=$5
23SIZE_NAME=$6
24BASE_NAME=$7
25COPY_PATH=$8
26OUTPUT_OBJ=$9
27
28compile_asset()
29{
30	echo "Lume5 Compile asset $1 $2 $3 $4 $5 $6 $7 $8 $9"
31    $TEST_COMPILER_PATH/LumeAssetCompiler -linux $CPU_TYPE -extensions ".spv;.json;.lsb;.shader;.shadergs;.shadervid;.shaderpl;.rng;.gl;.gles" $ASSETS_PATH $ROOT_PATH $BIN_NAME $SIZE_NAME $BASE_NAME
32    mv $OUTPUT_OBJ $COPY_PATH
33}
34
35compile_asset $COMPILER_PATH $CPU_TYPE $ASSETS_PATH $ROOT_PATH $BIN_NAME $SIZE_NAME $BASE_NAME $COPY_PATH $OUTPUT_OBJ
36