nostalgia/scripts/setup_build

40 lines
1013 B
Plaintext
Raw Normal View History

2016-03-26 15:49:05 -05:00
#! /usr/bin/env bash
2016-12-23 17:29:19 -06:00
set -e
project=$(pwd)/
TARGET=$1
BUILD_TYPE=$2
if [[ $TARGET == windows ]]; then
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/Mingw.cmake"
elif [[ $TARGET == gba ]]; then
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/Modules/GBA.cmake -DNOSTALGIA_BUILD_TYPE=GBA -DOX_USE_STDLIB=OFF"
2016-12-23 17:29:19 -06:00
fi
if [[ $BUILD_TYPE == debug ]]; then
buildTypeArgs="-DUSE_ASAN=ON -DCMAKE_BUILD_TYPE=Debug"
elif [[ $BUILD_TYPE == release ]]; then
2016-12-23 17:29:19 -06:00
buildTypeArgs="-DCMAKE_BUILD_TYPE=Release"
fi
2016-03-26 15:49:05 -05:00
buildDir="build/${TARGET}-${BUILD_TYPE}"
distDir="../../dist/${TARGET}-${BUILD_TYPE}"
2016-03-26 15:49:05 -05:00
mkdir -p $buildDir
pushd $buildDir
2016-12-23 17:29:19 -06:00
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_INSTALL_PREFIX="$distDir" \
2017-05-21 00:15:47 -05:00
-DCMAKE_INSTALL_RPATH="$project/dist/${TARGET}-${BUILD_TYPE}/lib/nostalgia" \
-DNOSTALGIA_IDE_BUILD=OFF \
2016-12-23 17:29:19 -06:00
$buildTypeArgs \
$toolchain \
$project
2016-03-26 15:49:05 -05:00
popd
2017-05-16 01:35:32 -05:00
rm -f build/current dist/current
mkdir -p dist
ln -s ${TARGET}-${BUILD_TYPE} build/current
ln -s ${TARGET}-${BUILD_TYPE} dist/current