-
Notifications
You must be signed in to change notification settings - Fork 14
/
prepare_solution_linux.sh
executable file
·57 lines (45 loc) · 1.44 KB
/
prepare_solution_linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# Build
CMAKE='cmake'
BUILD='build'
mkdir ${BUILD}
mkdir bin
LINUX_BIN_DIR='bin/linux'
mkdir ${LINUX_BIN_DIR}
CONFIGURATIONS=("Release" "Debug")
MY_CC="/usr/bin/gcc"
MY_CXX="/usr/bin/g++"
EXTRA_CXX_OPTION=""
NUM_ARGS=$#
if [ $NUM_ARGS -eq 1 ]; then
if [ $1 = "clang" ]; then
MY_CC="clang-12"
MY_CXX="clang++-12"
EXTRA_CXX_OPTION="-DWITH_LIBCXX=Off" #Required by ANTLR to avoid failure to find std c++ include files like <algorithm>, etc.
fi
fi
for CONFIG in ${CONFIGURATIONS[@]}; do
echo ""
echo "Configuring for $CONFIG build..."
echo ""
BUILD_DIR=$BUILD/$CONFIG
$CMAKE -G "Unix Makefiles" -S "src/" -B $BUILD_DIR $EXTRA_CXX_OPTION -DCMAKE_BUILD_TYPE=$CONFIG -DCMAKE_C_COMPILER=$MY_CC -DCMAKE_CXX_COMPILER=$MY_CXX
echo "Will proceed to build in $CONFIG configuration..."
$CMAKE --build $BUILD_DIR --target azslc --config $CONFIG -j 16
pushd $BUILD_DIR
echo "Executing azslc in $CONFIG version:"
./azslc --version
popd
echo "Deploying azslc $CONFIG binary..."
CONFIG_LCASE="$(tr [A-Z] [a-z] <<< "$CONFIG")"
DEPLOY_DIR=$LINUX_BIN_DIR/$CONFIG_LCASE
mkdir $DEPLOY_DIR
cp $BUILD_DIR/azslc $DEPLOY_DIR/
echo "azslc was deployed to $DEPLOY_DIR"
done