2013-12-08 13:17:45 +00:00
|
|
|
#!/bin/bash
|
2014-07-24 06:34:46 +00:00
|
|
|
CMAKE=1
|
|
|
|
|
2013-12-08 13:17:45 +00:00
|
|
|
# Check arguments
|
|
|
|
while test $# -gt 0
|
|
|
|
do
|
|
|
|
case "$1" in
|
2014-07-24 06:34:46 +00:00
|
|
|
--qt) echo "Qt enabled"
|
2016-10-13 01:26:18 +00:00
|
|
|
QT=1
|
|
|
|
CMAKE_ARGS="-DUSING_QT_UI=ON ${CMAKE_ARGS}"
|
2013-12-08 13:17:45 +00:00
|
|
|
;;
|
2018-03-01 07:37:13 +00:00
|
|
|
--qtbrew) echo "Qt enabled (homebrew)"
|
|
|
|
QT=1
|
|
|
|
CMAKE_ARGS="-DUSING_QT_UI=ON -DCMAKE_PREFIX_PATH=$(brew --prefix qt5) ${CMAKE_ARGS}"
|
|
|
|
;;
|
2016-10-14 21:15:16 +00:00
|
|
|
--ios) CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/ios.cmake ${CMAKE_ARGS}"
|
2014-07-24 06:34:46 +00:00
|
|
|
TARGET_OS=iOS
|
2013-12-08 13:17:45 +00:00
|
|
|
;;
|
2019-03-23 14:27:29 +00:00
|
|
|
--rpi-armv6)
|
|
|
|
CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/raspberry.armv6.cmake ${CMAKE_ARGS}"
|
|
|
|
;;
|
|
|
|
--rpi)
|
|
|
|
CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/raspberry.armv7.cmake ${CMAKE_ARGS}"
|
|
|
|
;;
|
2020-05-29 13:35:01 +00:00
|
|
|
--rpi64)
|
|
|
|
CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/raspberry.armv8.cmake ${CMAKE_ARGS}"
|
|
|
|
;;
|
2013-12-08 13:17:45 +00:00
|
|
|
--android) CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=android/android.toolchain.cmake ${CMAKE_ARGS}"
|
2014-07-24 13:20:09 +00:00
|
|
|
TARGET_OS=Android
|
|
|
|
PACKAGE=1
|
2013-12-08 13:17:45 +00:00
|
|
|
;;
|
2014-07-24 06:34:46 +00:00
|
|
|
--simulator) echo "Simulator mode enabled"
|
|
|
|
CMAKE_ARGS="-DSIMULATOR=ON ${CMAKE_ARGS}"
|
|
|
|
;;
|
|
|
|
--release)
|
2014-08-05 06:59:57 +00:00
|
|
|
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS}"
|
2014-07-24 06:34:46 +00:00
|
|
|
;;
|
|
|
|
--debug)
|
2014-08-05 06:59:57 +00:00
|
|
|
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug ${CMAKE_ARGS}"
|
2014-07-24 06:34:46 +00:00
|
|
|
;;
|
|
|
|
--headless) echo "Headless mode enabled"
|
|
|
|
CMAKE_ARGS="-DHEADLESS=ON ${CMAKE_ARGS}"
|
|
|
|
;;
|
2018-03-24 11:44:53 +00:00
|
|
|
--libretro) echo "Build Libretro core"
|
|
|
|
CMAKE_ARGS="-DLIBRETRO=ON ${CMAKE_ARGS}"
|
|
|
|
;;
|
2020-03-15 22:17:27 +00:00
|
|
|
--libretro_android) echo "Build Libretro Android core"
|
|
|
|
CMAKE_ARGS="-DLIBRETRO=ON -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake -DANDROID_ABI=${APP_ABI} ${CMAKE_ARGS}"
|
|
|
|
;;
|
2015-04-03 21:50:51 +00:00
|
|
|
--unittest) echo "Build unittest"
|
|
|
|
CMAKE_ARGS="-DUNITTEST=ON ${CMAKE_ARGS}"
|
|
|
|
;;
|
2014-07-24 06:34:46 +00:00
|
|
|
--no-package) echo "Packaging disabled"
|
|
|
|
PACKAGE=0
|
2013-12-08 13:17:45 +00:00
|
|
|
;;
|
2018-01-13 20:44:58 +00:00
|
|
|
--clang) echo "Clang enabled"
|
2017-03-16 09:16:29 +00:00
|
|
|
export CC=/usr/bin/clang
|
|
|
|
export CXX=/usr/bin/clang++
|
|
|
|
;;
|
2018-01-31 13:22:38 +00:00
|
|
|
--sanitize) echo "Enabling address-sanitizer if available"
|
|
|
|
CMAKE_ARGS="-DUSE_ADDRESS_SANITIZER=ON ${CMAKE_ARGS}"
|
|
|
|
;;
|
2013-12-08 13:17:45 +00:00
|
|
|
*) MAKE_OPT="$1 ${MAKE_OPT}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2014-07-24 06:34:46 +00:00
|
|
|
if [ ! -z "$TARGET_OS" ]; then
|
|
|
|
echo "Building for $TARGET_OS"
|
|
|
|
BUILD_DIR="$(tr [A-Z] [a-z] <<< build-"$TARGET_OS")"
|
2013-11-28 14:23:47 +00:00
|
|
|
else
|
2013-12-08 13:17:45 +00:00
|
|
|
echo "Building for native host."
|
2016-10-13 01:26:18 +00:00
|
|
|
BUILD_DIR="build"
|
2013-11-28 14:23:47 +00:00
|
|
|
fi
|
2013-12-08 13:17:45 +00:00
|
|
|
|
|
|
|
# Strict errors. Any non-zero return exits this script
|
|
|
|
set -e
|
|
|
|
|
2014-07-24 06:34:46 +00:00
|
|
|
mkdir -p ${BUILD_DIR}
|
|
|
|
pushd ${BUILD_DIR}
|
|
|
|
|
2016-10-29 18:04:51 +00:00
|
|
|
cmake $CMAKE_ARGS ..
|
2014-07-24 06:34:46 +00:00
|
|
|
|
2014-08-17 16:00:22 +00:00
|
|
|
make -j4 $MAKE_OPT
|
2013-11-28 15:34:56 +00:00
|
|
|
popd
|