build.sh: allow to replace build directory by a symlink

Use case: redirect the build into a ramdisk (less write on sdd and potentially faster io)
This commit is contained in:
Gregory Hainaut 2014-08-05 21:55:14 +02:00
parent 82ee28fa39
commit bf52a4c737
2 changed files with 20 additions and 11 deletions

View File

@ -59,26 +59,35 @@ for ARG in "$@"; do
esac
done
cd "$(dirname "$0")" # Navigate to script's directory
root=$PWD/$(dirname "$0")
log=$root/install_log.txt
build=$root/build
if [[ "$cleanBuild" -eq 1 ]]; then
echo "Doing a clean build."
rm -fr build
# allow to keep build as a symlink (for example to a ramdisk)
rm -fr $build/*
fi
echo "Building pcsx2 with ${flags[*]}" | tee install_log.txt
echo "Building pcsx2 with ${flags[*]}" | tee $log
mkdir -p build
cd build
# 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
if [[ "$useClang" -eq 1 ]]; then
CC=clang CXX=clang++ cmake "${flags[@]}" .. 2>&1 | tee -a ../install_log.txt
CC=clang CXX=clang++ cmake "${flags[@]}" $root 2>&1 | tee -a $log
else
cmake "${flags[@]}" .. 2>&1 | tee -a ../install_log.txt
cmake "${flags[@]}" $root 2>&1 | tee -a $log
fi
make -j "$(grep -w -c processor /proc/cpuinfo)" 2>&1 | tee -a ../install_log.txt
make install 2>&1 | tee -a ../install_log.txt
make -j "$(grep -w -c processor /proc/cpuinfo)" 2>&1 | tee -a $log
make install 2>&1 | tee -a $log
cd ..
exit 0

View File

@ -51,7 +51,7 @@ MACRO(GETTEXT_CREATE_TRANSLATIONS_PCSX2 _potFile _firstPoFileArg)
GET_FILENAME_COMPONENT(_abs_PATH ${_absFile} PATH)
GET_FILENAME_COMPONENT(_gmoBase ${_absFile} NAME_WE)
GET_FILENAME_COMPONENT(_lang ${_abs_PATH} NAME_WE)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}__${_gmoBase}.gmo)
SET(_gmoFile ${CMAKE_BINARY_DIR}/${_lang}__${_gmoBase}.gmo)
IF (CMAKE_BUILD_PO)
ADD_CUSTOM_COMMAND( OUTPUT ${_gmoFile}