2023-07-08 12:17:14 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# $1 Source path of the project.
|
|
|
|
# $2 Target architecture list.
|
|
|
|
|
2023-07-09 15:33:09 +02:00
|
|
|
SRC=$1
|
|
|
|
NAME=$(dirname $SRC)
|
|
|
|
ARCHS=$2
|
|
|
|
|
2023-07-09 15:44:49 +02:00
|
|
|
if [ -z "$SRC" ]
|
|
|
|
then
|
|
|
|
echo You need to provide a source path.
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$ARCHS" ]
|
|
|
|
then
|
|
|
|
ARCHS="linux-arm linux-arm64 linux-x64 win-x64 win-x86"
|
|
|
|
fi
|
|
|
|
|
2023-07-09 15:33:09 +02:00
|
|
|
cd $SRC
|
|
|
|
|
|
|
|
for ARCH in $ARCHS; do
|
|
|
|
# Output directory.
|
|
|
|
PREFIX=runtimes/$ARCH/native
|
|
|
|
# Build directory.
|
|
|
|
BUILD=out/$ARCH
|
|
|
|
# Cmake toolchain file.
|
|
|
|
TOOLCHAIN=../cmake/$ARCH.cmake
|
|
|
|
|
|
|
|
# Create directories.
|
|
|
|
mkdir -p $PREFIX $BUILD
|
|
|
|
# Configure CMAKE.
|
|
|
|
cmake -B $BUILD -S . \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN
|
|
|
|
|
|
|
|
# Build and install.
|
|
|
|
make -C $BUILD all
|
|
|
|
make -C $BUILD install
|
|
|
|
done
|