2014-08-04 01:58:37 +00:00
|
|
|
#!/bin/bash
|
2011-12-24 11:15:42 +00:00
|
|
|
|
2012-04-18 14:09:18 +00:00
|
|
|
# PCSX2 - PS2 Emulator for PCs
|
2014-08-04 01:58:37 +00:00
|
|
|
# Copyright (C) 2002-2014 PCSX2 Dev Team
|
2012-04-18 14:09:18 +00:00
|
|
|
#
|
|
|
|
# PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
# of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
# ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
# PURPOSE. See the GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
# If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2014-08-04 01:58:37 +00:00
|
|
|
#set -e # This terminates the script in case of any error
|
2011-12-24 11:15:42 +00:00
|
|
|
|
2014-08-04 01:58:37 +00:00
|
|
|
flags=(-DCMAKE_BUILD_PO=FALSE)
|
|
|
|
cleanBuild=0
|
|
|
|
useClang=0
|
|
|
|
|
|
|
|
for ARG in "$@"; do
|
|
|
|
case "$ARG" in
|
|
|
|
--clean ) cleanBuild=1 ;;
|
|
|
|
--clang ) flags+=(-DUSE_CLANG=TRUE); useClang=1; ;;
|
|
|
|
--dev|--devel ) flags+=(-DCMAKE_BUILD_TYPE=Devel) ;;
|
|
|
|
--dbg|--debug ) flags+=(-DCMAKE_BUILD_TYPE=Debug) ;;
|
|
|
|
--strip ) flags+=(-DCMAKE_BUILD_STRIP=TRUE) ;;
|
|
|
|
--release ) flags+=(-DCMAKE_BUILD_TYPE=Release) ;;
|
|
|
|
--glsl ) flags+=(-DGLSL_API=TRUE) ;;
|
|
|
|
--egl ) flags+=(-DEGL_API=TRUE) ;;
|
|
|
|
--gles ) flags+=(-DGLES_API=TRUE) ;;
|
|
|
|
--sdl2 ) flags+=(-DSDL2_API=TRUE) ;;
|
|
|
|
--extra ) flags+=(-DEXTRA_PLUGINS=TRUE) ;;
|
|
|
|
--asan ) flags+=(-DUSE_ASAN=TRUE) ;;
|
|
|
|
--wx28 ) flags+=(-DWX28_API=TRUE) ;;
|
|
|
|
--wx30 ) flags+=(-DWX28_API=FALSE) ;;
|
2014-04-10 07:20:42 +00:00
|
|
|
|
|
|
|
*)
|
2014-08-04 01:58:37 +00:00
|
|
|
# Unknown option
|
2014-04-10 07:20:42 +00:00
|
|
|
echo "** User options **"
|
|
|
|
echo "--dev / --devel : Build PCSX2 as a Development build."
|
|
|
|
echo "--debug : Build PCSX2 as a Debug build."
|
|
|
|
echo "--release : Build PCSX2 as a Release build."
|
|
|
|
echo "--clean : Do a clean build."
|
2014-03-29 10:24:39 +00:00
|
|
|
echo "** Developper option **"
|
2014-07-12 17:57:26 +00:00
|
|
|
echo "--clang : Build with Clang/llvm"
|
|
|
|
echo "--extra : Build all plugins"
|
|
|
|
echo "--asan : Enable with Address sanitizer"
|
2014-08-04 01:58:37 +00:00
|
|
|
echo
|
2014-06-29 06:51:21 +00:00
|
|
|
echo "--wx28 : Force wxWidget 2.8"
|
|
|
|
echo "--wx30 : Allow to use wxWidget 3.0"
|
2014-03-29 10:24:39 +00:00
|
|
|
echo "--glsl : Replace CG backend of ZZogl by GLSL"
|
|
|
|
echo "--egl : Replace GLX by EGL (ZZogl plugins only)"
|
|
|
|
echo "--sdl2 : Build with SDL2 (crash if wx is linked to SDL1)"
|
|
|
|
echo "--gles : Replace openGL backend of GSdx by openGLES3"
|
2014-08-04 01:58:37 +00:00
|
|
|
exit 1
|
2014-04-10 07:20:42 +00:00
|
|
|
esac
|
2012-01-07 22:20:50 +00:00
|
|
|
done
|
2011-12-24 11:15:42 +00:00
|
|
|
|
2014-08-05 19:55:14 +00:00
|
|
|
root=$PWD/$(dirname "$0")
|
|
|
|
log=$root/install_log.txt
|
|
|
|
build=$root/build
|
2014-08-04 01:58:37 +00:00
|
|
|
|
|
|
|
if [[ "$cleanBuild" -eq 1 ]]; then
|
|
|
|
echo "Doing a clean build."
|
2014-08-05 19:55:14 +00:00
|
|
|
# allow to keep build as a symlink (for example to a ramdisk)
|
|
|
|
rm -fr $build/*
|
2014-08-04 01:58:37 +00:00
|
|
|
fi
|
2012-10-21 18:10:13 +00:00
|
|
|
|
2014-08-05 19:55:14 +00:00
|
|
|
echo "Building pcsx2 with ${flags[*]}" | tee $log
|
2012-10-21 18:10:13 +00:00
|
|
|
|
2014-08-05 19:55:14 +00:00
|
|
|
# Resolve the symlink otherwise cmake is lost
|
|
|
|
# Besides, it allows 'mkdir' to create the real destination directory
|
|
|
|
if [[ -L $build ]]; then
|
|
|
|
build=`readlink $build`
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $build
|
|
|
|
# Cmake will generate file inside $CWD. It would be nicer if an option to cmake can be provided.
|
|
|
|
cd $build
|
2011-12-24 11:15:42 +00:00
|
|
|
|
2014-08-04 01:58:37 +00:00
|
|
|
if [[ "$useClang" -eq 1 ]]; then
|
2014-08-05 19:55:14 +00:00
|
|
|
CC=clang CXX=clang++ cmake "${flags[@]}" $root 2>&1 | tee -a $log
|
2014-07-04 21:50:51 +00:00
|
|
|
else
|
2014-08-05 19:55:14 +00:00
|
|
|
cmake "${flags[@]}" $root 2>&1 | tee -a $log
|
2014-07-04 21:50:51 +00:00
|
|
|
fi
|
2012-10-21 18:10:13 +00:00
|
|
|
|
2014-09-10 17:49:17 +00:00
|
|
|
if [[ $(uname -s) == 'Darwin' ]]; then
|
|
|
|
ncpu=$(sysctl -n hw.ncpu)
|
|
|
|
else
|
|
|
|
ncpu=$(grep -w -c processor /proc/cpuinfo)
|
|
|
|
fi
|
|
|
|
|
|
|
|
make -j"$ncpu" 2>&1 | tee -a $log
|
2014-08-05 19:55:14 +00:00
|
|
|
make install 2>&1 | tee -a $log
|
2011-12-24 11:15:42 +00:00
|
|
|
|
2014-08-04 01:58:37 +00:00
|
|
|
exit 0
|