mirror of https://github.com/PCSX2/pcsx2.git
build.sh and cmake plugin code cleanup (#2953)
* Refactor build.sh. Restructure finding plugins. Remove legacy code. Add --clean-plugins option. Document --no-trans option. Don't do setcap if dev9ghzdrk isn't being built. List dependencies if they are missing. Remove code related to zerospu2, and misc plugins we aren't building. Minor message changes.
This commit is contained in:
parent
7054450348
commit
fc35de02f2
397
build.sh
397
build.sh
|
@ -16,195 +16,97 @@
|
||||||
|
|
||||||
#set -e # This terminates the script in case of any error
|
#set -e # This terminates the script in case of any error
|
||||||
|
|
||||||
flags="-DCMAKE_BUILD_PO=FALSE"
|
# Function declarations
|
||||||
|
set_ncpu_toolfile()
|
||||||
|
{
|
||||||
|
if [ "$(uname -s)" = 'Darwin' ]; then
|
||||||
|
ncpu="$(sysctl -n hw.ncpu)"
|
||||||
|
|
||||||
cleanBuild=0
|
# Get the major Darwin/OSX version.
|
||||||
useClang=0
|
if [ "$(sysctl -n kern.osrelease | cut -d . -f 1)" -lt 13 ]; then
|
||||||
useIcc=0
|
|
||||||
# 0 => no, 1 => yes, 2 => force yes
|
|
||||||
useCross=2
|
|
||||||
CoverityBuild=0
|
|
||||||
cppcheck=0
|
|
||||||
clangTidy=0
|
|
||||||
|
|
||||||
root=$PWD/$(dirname "$0")
|
|
||||||
log="$root/install_log.txt"
|
|
||||||
build="$root/build"
|
|
||||||
coverity_dir="cov-int"
|
|
||||||
coverity_result=pcsx2-coverity.xz
|
|
||||||
|
|
||||||
if [ "$(uname -s)" = 'Darwin' ]; then
|
|
||||||
ncpu="$(sysctl -n hw.ncpu)"
|
|
||||||
|
|
||||||
# Get the major Darwin/OSX version.
|
|
||||||
if [ "$(sysctl -n kern.osrelease | cut -d . -f 1)" -lt 13 ]; then
|
|
||||||
echo "This old OSX version is not supported! Build will fail."
|
echo "This old OSX version is not supported! Build will fail."
|
||||||
toolfile=cmake/darwin-compiler-i386-clang.cmake
|
toolfile=cmake/darwin-compiler-i386-clang.cmake
|
||||||
else
|
else
|
||||||
echo "Using Mavericks build with C++11 support."
|
echo "Using Mavericks build with C++11 support."
|
||||||
toolfile=cmake/darwin13-compiler-i386-clang.cmake
|
toolfile=cmake/darwin13-compiler-i386-clang.cmake
|
||||||
fi
|
fi
|
||||||
elif [ "$(uname -s)" = 'FreeBSD' ]; then
|
elif [ "$(uname -s)" = 'FreeBSD' ]; then
|
||||||
ncpu="$(sysctl -n hw.ncpu)"
|
ncpu="$(sysctl -n hw.ncpu)"
|
||||||
else
|
|
||||||
ncpu=$(grep -w -c processor /proc/cpuinfo)
|
|
||||||
toolfile=cmake/linux-compiler-i386-multilib.cmake
|
|
||||||
fi
|
|
||||||
|
|
||||||
if command -v ninja >/dev/null ; then
|
|
||||||
flags="$flags -GNinja"
|
|
||||||
make=ninja
|
|
||||||
else
|
|
||||||
make="make -j$ncpu"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for ARG in "$@"; do
|
|
||||||
case "$ARG" in
|
|
||||||
--clean ) cleanBuild=1 ;;
|
|
||||||
--clang-tidy ) flags="$flags -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"; clangTidy=1 ; useClang=1;;
|
|
||||||
--clang ) useClang=1 ;;
|
|
||||||
--intel ) useIcc=1 ;;
|
|
||||||
--cppcheck ) cppcheck=1 ;;
|
|
||||||
--dev|--devel ) flags="$flags -DCMAKE_BUILD_TYPE=Devel" ; build="$root/build_dev";;
|
|
||||||
--dbg|--debug ) flags="$flags -DCMAKE_BUILD_TYPE=Debug" ; build="$root/build_dbg";;
|
|
||||||
--rel|--release ) flags="$flags -DCMAKE_BUILD_TYPE=Release" ; build="$root/build_rel";;
|
|
||||||
--prof ) flags="$flags -DCMAKE_BUILD_TYPE=Prof" ; build="$root/build_prof";;
|
|
||||||
--strip ) flags="$flags -DCMAKE_BUILD_STRIP=TRUE" ;;
|
|
||||||
--glsl ) flags="$flags -DGLSL_API=TRUE" ;;
|
|
||||||
--egl ) flags="$flags -DEGL_API=TRUE" ;;
|
|
||||||
--sdl12 ) flags="$flags -DSDL2_API=FALSE" ;;
|
|
||||||
--extra ) flags="$flags -DEXTRA_PLUGINS=TRUE" ;;
|
|
||||||
--asan ) flags="$flags -DUSE_ASAN=TRUE" ;;
|
|
||||||
--gtk3 ) flags="$flags -DGTK3_API=TRUE" ;;
|
|
||||||
--lto ) flags="$flags -DUSE_LTO=TRUE" ;;
|
|
||||||
--pgo-optimize ) flags="$flags -DUSE_PGO_OPTIMIZE=TRUE" ;;
|
|
||||||
--pgo-generate ) flags="$flags -DUSE_PGO_GENERATE=TRUE" ;;
|
|
||||||
--no-simd ) flags="$flags -DDISABLE_ADVANCE_SIMD=TRUE" ;;
|
|
||||||
--no-trans ) flags="$flags -DNO_TRANSLATION=TRUE" ;;
|
|
||||||
--cross-multilib ) flags="$flags -DCMAKE_TOOLCHAIN_FILE=$toolfile"; useCross=1; ;;
|
|
||||||
--no-cross-multilib ) useCross=0; ;;
|
|
||||||
--coverity ) CoverityBuild=1; cleanBuild=1; ;;
|
|
||||||
--vtune ) flags="$flags -DUSE_VTUNE=TRUE" ;;
|
|
||||||
-D* ) flags="$flags $ARG" ;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo $ARG
|
|
||||||
# Unknown option
|
|
||||||
echo "** User options **"
|
|
||||||
echo "--dev / --devel : Build PCSX2 as a Development build."
|
|
||||||
echo "--debug : Build PCSX2 as a Debug build."
|
|
||||||
echo "--prof : Build PCSX2 as a Profiler build (release + debug symbol)."
|
|
||||||
echo "--release : Build PCSX2 as a Release build."
|
|
||||||
echo
|
|
||||||
echo "--clean : Do a clean build."
|
|
||||||
echo "--extra : Build all plugins"
|
|
||||||
echo "--no-simd : Only allow sse2"
|
|
||||||
echo
|
|
||||||
echo "** Developer option **"
|
|
||||||
echo "--glsl : Replace CG backend of ZZogl by GLSL"
|
|
||||||
echo "--egl : Replace GLX by EGL (ZZogl/GSdx plugins)"
|
|
||||||
echo "--cross-multilib: Build a 32bit PCSX2 on a 64bit machine using multilib."
|
|
||||||
echo
|
|
||||||
echo "** Distribution Compatibilities **"
|
|
||||||
echo "--sdl12 : Build with SDL1.2 (requires if wx is linked against SDL1.2)"
|
|
||||||
echo
|
|
||||||
echo "** Expert Developer option **"
|
|
||||||
echo "--gtk3 : replace GTK2 by GTK3"
|
|
||||||
echo "--no-cross-multilib: Build a native PCSX2"
|
|
||||||
echo "--clang : Build with Clang/llvm"
|
|
||||||
echo "--intel : Build with ICC (Intel compiler)"
|
|
||||||
echo "--lto : Use Link Time Optimization"
|
|
||||||
echo "--pgo-generate : Executable will generate profiling information when run"
|
|
||||||
echo "--pgo-optimize : Use previously generated profiling information"
|
|
||||||
echo
|
|
||||||
echo "** Quality & Assurance (Please install the external tool) **"
|
|
||||||
echo "--asan : Enable Address sanitizer"
|
|
||||||
echo "--clang-tidy : Do a clang-tidy analysis. Results can be found in build directory"
|
|
||||||
echo "--cppcheck : Do a cppcheck analysis. Results can be found in build directory"
|
|
||||||
echo "--coverity : Do a build for coverity"
|
|
||||||
echo "--vtune : Plug GSdx with VTUNE"
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$cleanBuild" -eq 1 ]; then
|
|
||||||
echo "Doing a clean build."
|
|
||||||
# allow to keep build as a symlink (for example to a ramdisk)
|
|
||||||
rm -fr "$build"/*
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$useCross" -eq 2 ] && [ "$(getconf LONG_BIT 2> /dev/null)" != 32 ]; then
|
|
||||||
echo "Forcing cross compilation."
|
|
||||||
flags="$flags -DCMAKE_TOOLCHAIN_FILE=$toolfile"
|
|
||||||
elif [ "$useCross" -ne 1 ]; then
|
|
||||||
useCross=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Helper to easily switch wx-config on my system
|
|
||||||
if [ "$useCross" -eq 0 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/lib/i386-linux-gnu/wx/config/gtk2-unicode-3.0" ]; then
|
|
||||||
sudo update-alternatives --set wx-config /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0
|
|
||||||
fi
|
|
||||||
if [ "$useCross" -eq 2 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0" ]; then
|
|
||||||
sudo update-alternatives --set wx-config /usr/lib/i386-linux-gnu/wx/config/gtk2-unicode-3.0
|
|
||||||
fi
|
|
||||||
# Workaround for Debian. Cmake failed to find freetype include path
|
|
||||||
if [ "$useCross" -eq 0 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/include/x86_64-linux-gnu/freetype2/ft2build.h" ]; then
|
|
||||||
export GTKMM_BASEPATH=/usr/include/x86_64-linux-gnu/freetype2
|
|
||||||
fi
|
|
||||||
if [ "$useCross" -eq 2 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/include/i386-linux-gnu/freetype2/ft2build.h" ]; then
|
|
||||||
export GTKMM_BASEPATH=/usr/include/i386-linux-gnu/freetype2
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Building pcsx2 with $flags" | tee "$log"
|
|
||||||
|
|
||||||
# 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
|
|
||||||
if [ "$useCross" -eq 0 ]; then
|
|
||||||
CC=clang CXX=clang++ cmake $flags "$root" 2>&1 | tee -a "$log"
|
|
||||||
else
|
else
|
||||||
CC="clang -m32" CXX="clang++ -m32" cmake $flags "$root" 2>&1 | tee -a "$log"
|
ncpu=$(grep -w -c processor /proc/cpuinfo)
|
||||||
|
toolfile=cmake/linux-compiler-i386-multilib.cmake
|
||||||
fi
|
fi
|
||||||
else
|
}
|
||||||
if [ "$useIcc" -eq 1 ]; then
|
|
||||||
|
switch_wxconfig()
|
||||||
|
{
|
||||||
|
# Helper to easily switch wx-config on my system
|
||||||
|
if [ "$useCross" -eq 0 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/lib/i386-linux-gnu/wx/config/gtk2-unicode-3.0" ]; then
|
||||||
|
sudo update-alternatives --set wx-config /usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0
|
||||||
|
fi
|
||||||
|
if [ "$useCross" -eq 2 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/lib/x86_64-linux-gnu/wx/config/gtk2-unicode-3.0" ]; then
|
||||||
|
sudo update-alternatives --set wx-config /usr/lib/i386-linux-gnu/wx/config/gtk2-unicode-3.0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
find_freetype()
|
||||||
|
{
|
||||||
|
if [ "$useCross" -eq 0 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/include/x86_64-linux-gnu/freetype2/ft2build.h" ]; then
|
||||||
|
export GTKMM_BASEPATH=/usr/include/x86_64-linux-gnu/freetype2
|
||||||
|
fi
|
||||||
|
if [ "$useCross" -eq 2 ] && [ "$(uname -m)" = "x86_64" ] && [ -e "/usr/include/i386-linux-gnu/freetype2/ft2build.h" ]; then
|
||||||
|
export GTKMM_BASEPATH=/usr/include/i386-linux-gnu/freetype2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_make()
|
||||||
|
{
|
||||||
|
if command -v ninja >/dev/null ; then
|
||||||
|
flags="$flags -GNinja"
|
||||||
|
make=ninja
|
||||||
|
else
|
||||||
|
make="make -j$ncpu"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_compiler()
|
||||||
|
{
|
||||||
|
if [ "$useClang" -eq 1 ]; then
|
||||||
|
if [ "$useCross" -eq 0 ]; then
|
||||||
|
CC=clang CXX=clang++ cmake $flags "$root" 2>&1 | tee -a "$log"
|
||||||
|
else
|
||||||
|
CC="clang -m32" CXX="clang++ -m32" cmake $flags "$root" 2>&1 | tee -a "$log"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$useIcc" -eq 1 ]; then
|
||||||
if [ "$useCross" -eq 0 ]; then
|
if [ "$useCross" -eq 0 ]; then
|
||||||
CC="icc" CXX="icpc" cmake $flags "$root" 2>&1 | tee -a "$log"
|
CC="icc" CXX="icpc" cmake $flags "$root" 2>&1 | tee -a "$log"
|
||||||
else
|
else
|
||||||
CC="icc -m32" CXX="icpc -m32" cmake $flags "$root" 2>&1 | tee -a "$log"
|
CC="icc -m32" CXX="icpc -m32" cmake $flags "$root" 2>&1 | tee -a "$log"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Default compiler AKA GCC
|
# Default compiler AKA GCC
|
||||||
cmake $flags "$root" 2>&1 | tee -a "$log"
|
cmake $flags "$root" 2>&1 | tee -a "$log"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
run_cppcheck()
|
||||||
|
{
|
||||||
############################################################
|
|
||||||
# CPP check build
|
|
||||||
############################################################
|
|
||||||
if [ "$cppcheck" -eq 1 ] && command -v cppcheck >/dev/null ; then
|
|
||||||
summary=cpp_check_summary.log
|
summary=cpp_check_summary.log
|
||||||
rm -f $summary
|
rm -f $summary
|
||||||
touch $summary
|
touch $summary
|
||||||
|
|
||||||
define=""
|
define=""
|
||||||
for undef in _WINDOWS _M_AMD64 _MSC_VER WIN32 __INTEL_COMPILER __x86_64__ \
|
for undef in _WINDOWS _M_AMD64 _MSC_VER WIN32 __INTEL_COMPILER __x86_64__ \
|
||||||
__SSE4_1__ __SSSE3__ __SSE__ __AVX2__ __USE_ISOC11 ASAN_WORKAROUND ENABLE_OPENCL ENABLE_OGL_DEBUG \
|
__SSE4_1__ __SSSE3__ __SSE__ __AVX2__ __USE_ISOC11 ASAN_WORKAROUND ENABLE_OPENCL ENABLE_OGL_DEBUG \
|
||||||
XBYAK_USE_MMAP_ALLOCATOR MAP_ANONYMOUS MAP_ANON XBYAK_DISABLE_AVX512
|
XBYAK_USE_MMAP_ALLOCATOR MAP_ANONYMOUS MAP_ANON XBYAK_DISABLE_AVX512
|
||||||
do
|
do
|
||||||
define="$define -U$undef"
|
define="$define -U$undef"
|
||||||
done
|
done
|
||||||
|
|
||||||
check="--enable=warning,style,missingInclude"
|
check="--enable=warning,style,missingInclude"
|
||||||
|
|
||||||
for d in pcsx2 common plugins/GSdx plugins/spu2\-x plugins/onepad plugins/cdvdGigaherz
|
for d in pcsx2 common plugins/GSdx plugins/spu2\-x plugins/onepad plugins/cdvdGigaherz
|
||||||
do
|
do
|
||||||
flat_d=$(echo $d | sed -e 's@/@_@')
|
flat_d=$(echo $d | sed -e 's@/@_@')
|
||||||
|
@ -215,13 +117,12 @@ if [ "$cppcheck" -eq 1 ] && command -v cppcheck >/dev/null ; then
|
||||||
# Create a small summary (warning it might miss some issues)
|
# Create a small summary (warning it might miss some issues)
|
||||||
fgrep -e "(warning)" -e "(error)" -e "(style)" -e "(performance)" -e "(portability)" "$log" >> $summary
|
fgrep -e "(warning)" -e "(error)" -e "(style)" -e "(performance)" -e "(portability)" "$log" >> $summary
|
||||||
done
|
done
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
############################################################
|
exit 0
|
||||||
# Clang tidy build
|
}
|
||||||
############################################################
|
|
||||||
if [ "$clangTidy" -eq 1 ] && command -v clang-tidy >/dev/null ; then
|
run_clangtidy()
|
||||||
|
{
|
||||||
compile_json=compile_commands.json
|
compile_json=compile_commands.json
|
||||||
cpp_list=cpp_file.txt
|
cpp_list=cpp_file.txt
|
||||||
summary=clang_tidy_summary.txt
|
summary=clang_tidy_summary.txt
|
||||||
|
@ -256,16 +157,166 @@ if [ "$clangTidy" -eq 1 ] && command -v clang-tidy >/dev/null ; then
|
||||||
fi < $cpp_list > $summary
|
fi < $cpp_list > $summary
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
run_coverity()
|
||||||
|
{
|
||||||
|
cov-build --dir "$coverity_dir" $make 2>&1 | tee -a "$log"
|
||||||
|
# Warning: $coverity_dir must be the root directory
|
||||||
|
(cd "$build"; tar caf $coverity_result "$coverity_dir")
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Main script
|
||||||
|
flags="-DCMAKE_BUILD_PO=FALSE"
|
||||||
|
|
||||||
|
cleanBuild=0
|
||||||
|
useClang=0
|
||||||
|
useIcc=0
|
||||||
|
|
||||||
|
# 0 => no, 1 => yes, 2 => force yes
|
||||||
|
useCross=2
|
||||||
|
|
||||||
|
CoverityBuild=0
|
||||||
|
cppcheck=0
|
||||||
|
clangTidy=0
|
||||||
|
|
||||||
|
root=$PWD/$(dirname "$0")
|
||||||
|
log="$root/install_log.txt"
|
||||||
|
build="$root/build"
|
||||||
|
coverity_dir="cov-int"
|
||||||
|
coverity_result=pcsx2-coverity.xz
|
||||||
|
|
||||||
|
set_ncpu_toolfile
|
||||||
|
set_make
|
||||||
|
|
||||||
|
for ARG in "$@"; do
|
||||||
|
case "$ARG" in
|
||||||
|
--clean ) cleanBuild=1 ;;
|
||||||
|
--clean-plugins ) cleanBuild=2 ;;
|
||||||
|
--clang-tidy ) flags="$flags -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"; clangTidy=1 ; useClang=1;;
|
||||||
|
--clang ) useClang=1 ;;
|
||||||
|
--intel ) useIcc=1 ;;
|
||||||
|
--cppcheck ) cppcheck=1 ;;
|
||||||
|
--dev|--devel ) flags="$flags -DCMAKE_BUILD_TYPE=Devel" ; build="$root/build_dev";;
|
||||||
|
--dbg|--debug ) flags="$flags -DCMAKE_BUILD_TYPE=Debug" ; build="$root/build_dbg";;
|
||||||
|
--rel|--release ) flags="$flags -DCMAKE_BUILD_TYPE=Release" ; build="$root/build_rel";;
|
||||||
|
--prof ) flags="$flags -DCMAKE_BUILD_TYPE=Prof" ; build="$root/build_prof";;
|
||||||
|
--strip ) flags="$flags -DCMAKE_BUILD_STRIP=TRUE" ;;
|
||||||
|
--glsl ) flags="$flags -DGLSL_API=TRUE" ;;
|
||||||
|
--egl ) flags="$flags -DEGL_API=TRUE" ;;
|
||||||
|
--sdl12 ) flags="$flags -DSDL2_API=FALSE" ;;
|
||||||
|
--extra ) flags="$flags -DEXTRA_PLUGINS=TRUE" ;;
|
||||||
|
--asan ) flags="$flags -DUSE_ASAN=TRUE" ;;
|
||||||
|
--gtk3 ) flags="$flags -DGTK3_API=TRUE" ;;
|
||||||
|
--lto ) flags="$flags -DUSE_LTO=TRUE" ;;
|
||||||
|
--pgo-optimize ) flags="$flags -DUSE_PGO_OPTIMIZE=TRUE" ;;
|
||||||
|
--pgo-generate ) flags="$flags -DUSE_PGO_GENERATE=TRUE" ;;
|
||||||
|
--no-simd ) flags="$flags -DDISABLE_ADVANCE_SIMD=TRUE" ;;
|
||||||
|
--no-trans ) flags="$flags -DNO_TRANSLATION=TRUE" ;;
|
||||||
|
--cross-multilib ) flags="$flags -DCMAKE_TOOLCHAIN_FILE=$toolfile"; useCross=1; ;;
|
||||||
|
--no-cross-multilib ) useCross=0; ;;
|
||||||
|
--coverity ) CoverityBuild=1; cleanBuild=1; ;;
|
||||||
|
--vtune ) flags="$flags -DUSE_VTUNE=TRUE" ;;
|
||||||
|
-D* ) flags="$flags $ARG" ;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo $ARG
|
||||||
|
# Unknown option
|
||||||
|
echo "** User options **"
|
||||||
|
echo "--dev / --devel : Build PCSX2 as a Development build."
|
||||||
|
echo "--debug : Build PCSX2 as a Debug build."
|
||||||
|
echo "--prof : Build PCSX2 as a Profiler build (release + debug symbol)."
|
||||||
|
echo "--release : Build PCSX2 as a Release build."
|
||||||
|
echo
|
||||||
|
echo "--clean : Do a clean build."
|
||||||
|
echo "--clean-plugins : Do a clean build of plugins, but not of pcsx2."
|
||||||
|
echo "--extra : Build all plugins"
|
||||||
|
echo "--no-simd : Only allow sse2"
|
||||||
|
echo
|
||||||
|
echo "** Developer option **"
|
||||||
|
echo "--glsl : Replace CG backend of ZZogl by GLSL"
|
||||||
|
echo "--egl : Replace GLX by EGL (ZZogl/GSdx plugins)"
|
||||||
|
echo "--cross-multilib: Build a 32bit PCSX2 on a 64bit machine using multilib."
|
||||||
|
echo
|
||||||
|
echo "** Distribution Compatibilities **"
|
||||||
|
echo "--sdl12 : Build with SDL1.2 (requires if wx is linked against SDL1.2)"
|
||||||
|
echo
|
||||||
|
echo "** Expert Developer option **"
|
||||||
|
echo "--gtk3 : replace GTK2 by GTK3"
|
||||||
|
echo "--no-cross-multilib: Build a native PCSX2 (nonfunctional recompiler)"
|
||||||
|
echo "--no-trans : Don't regenerate mo files when building."
|
||||||
|
echo "--clang : Build with Clang/llvm"
|
||||||
|
echo "--intel : Build with ICC (Intel compiler)"
|
||||||
|
echo "--lto : Use Link Time Optimization"
|
||||||
|
echo "--pgo-generate : Executable will generate profiling information when run"
|
||||||
|
echo "--pgo-optimize : Use previously generated profiling information"
|
||||||
|
echo
|
||||||
|
echo "** Quality & Assurance (Please install the external tool) **"
|
||||||
|
echo "--asan : Enable Address sanitizer"
|
||||||
|
echo "--clang-tidy : Do a clang-tidy analysis. Results can be found in build directory"
|
||||||
|
echo "--cppcheck : Do a cppcheck analysis. Results can be found in build directory"
|
||||||
|
echo "--coverity : Do a build for coverity"
|
||||||
|
echo "--vtune : Plug GSdx with VTUNE"
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$cleanBuild" -eq 1 ]; then
|
||||||
|
echo "Doing a clean build."
|
||||||
|
# allow to keep build as a symlink (for example to a ramdisk)
|
||||||
|
rm -fr "$build"/*
|
||||||
|
elif [ "$cleanBuild" -eq 2 ]; then
|
||||||
|
echo "Doing a clean build on the plugins, but not pcsx2."
|
||||||
|
rm -fr "$build"/plugins/*
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$useCross" -eq 2 ] && [ "$(getconf LONG_BIT 2> /dev/null)" != 32 ]; then
|
||||||
|
echo "Forcing cross compilation."
|
||||||
|
flags="$flags -DCMAKE_TOOLCHAIN_FILE=$toolfile"
|
||||||
|
elif [ "$useCross" -ne 1 ]; then
|
||||||
|
useCross=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
switch_wxconfig
|
||||||
|
|
||||||
|
# Workaround for Debian. Cmake failed to find freetype include path
|
||||||
|
find_freetype
|
||||||
|
|
||||||
|
echo "Building pcsx2 with $flags" | tee "$log"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
set_compiler
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
# CPP check build
|
||||||
|
############################################################
|
||||||
|
if [ "$cppcheck" -eq 1 ] && command -v cppcheck >/dev/null ; then
|
||||||
|
run_cppcheck
|
||||||
|
fi
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
# Clang tidy build
|
||||||
|
############################################################
|
||||||
|
if [ "$clangTidy" -eq 1 ] && command -v clang-tidy >/dev/null ; then
|
||||||
|
run_clangtidy
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# Coverity build
|
# Coverity build
|
||||||
############################################################
|
############################################################
|
||||||
if [ "$CoverityBuild" -eq 1 ] && command -v cov-build >/dev/null ; then
|
if [ "$CoverityBuild" -eq 1 ] && command -v cov-build >/dev/null ; then
|
||||||
cov-build --dir "$coverity_dir" $make 2>&1 | tee -a "$log"
|
run_coverity
|
||||||
# Warning: $coverity_dir must be the root directory
|
|
||||||
(cd "$build"; tar caf $coverity_result "$coverity_dir")
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|
|
@ -9,6 +9,7 @@ set(msg_dep_gsdx "check these libraries -> opengl, png (>=1.2), zlib (>=1
|
||||||
set(msg_dep_onepad "check these libraries -> sdl2, X11, gtk2")
|
set(msg_dep_onepad "check these libraries -> sdl2, X11, gtk2")
|
||||||
set(msg_dep_spu2x "check these libraries -> soundtouch (>=1.5), alsa, portaudio (>=1.9), sdl (>=1.2) pcsx2 common libs")
|
set(msg_dep_spu2x "check these libraries -> soundtouch (>=1.5), alsa, portaudio (>=1.9), sdl (>=1.2) pcsx2 common libs")
|
||||||
set(msg_dep_zerospu2 "check these libraries -> soundtouch (>=1.5), alsa")
|
set(msg_dep_zerospu2 "check these libraries -> soundtouch (>=1.5), alsa")
|
||||||
|
set(msg_dep_dev "check these libraries -> gtk2, pcap, libxml2")
|
||||||
if(GLSL_API)
|
if(GLSL_API)
|
||||||
set(msg_dep_zzogl "check these libraries -> glew, jpeg (>=6.2), opengl, X11, pcsx2 common libs")
|
set(msg_dep_zzogl "check these libraries -> glew, jpeg (>=6.2), opengl, X11, pcsx2 common libs")
|
||||||
else(GLSL_API)
|
else(GLSL_API)
|
||||||
|
@ -53,7 +54,7 @@ elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/common/src")
|
||||||
set(common_libs FALSE)
|
set(common_libs FALSE)
|
||||||
else()
|
else()
|
||||||
set(common_libs FALSE)
|
set(common_libs FALSE)
|
||||||
print_dep("Skip build of common libraries: miss some dependencies" "${msg_dep_common_libs}")
|
print_dep("Skip build of common libraries: missing dependencies" "${msg_dep_common_libs}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
@ -71,12 +72,12 @@ elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/pcsx2")
|
||||||
set(pcsx2_core FALSE)
|
set(pcsx2_core FALSE)
|
||||||
else()
|
else()
|
||||||
set(pcsx2_core FALSE)
|
set(pcsx2_core FALSE)
|
||||||
print_dep("Skip build of pcsx2 core: miss some dependencies" "${msg_dep_pcsx2}")
|
print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}")
|
||||||
endif()
|
endif()
|
||||||
# Linux, BSD, use gtk2, but not OSX
|
# Linux, BSD, use gtk2, but not OSX
|
||||||
if(UNIX AND pcsx2_core AND NOT GTKn_FOUND AND NOT APPLE)
|
if(UNIX AND pcsx2_core AND NOT GTKn_FOUND AND NOT APPLE)
|
||||||
set(pcsx2_core FALSE)
|
set(pcsx2_core FALSE)
|
||||||
print_dep("Skip build of pcsx2 core: miss some dependencies" "${msg_dep_pcsx2}")
|
print_dep("Skip build of pcsx2 core: missing dependencies" "${msg_dep_pcsx2}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ elseif(Linux AND GTKn_FOUND AND LIBUDEV_FOUND)
|
||||||
set(cdvdGigaherz TRUE)
|
set(cdvdGigaherz TRUE)
|
||||||
else()
|
else()
|
||||||
set(cdvdGigaherz FALSE)
|
set(cdvdGigaherz FALSE)
|
||||||
print_dep("Skip build of cdvdGigaherz: miss some dependencies" "${msg_dep_cdvdgiga}")
|
print_dep("Skip build of cdvdGigaherz: missing dependencies" "${msg_dep_cdvdgiga}")
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
|
||||||
|
@ -115,6 +116,7 @@ endif()
|
||||||
if(GTKn_FOUND)
|
if(GTKn_FOUND)
|
||||||
set(dev9null TRUE)
|
set(dev9null TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# dev9ghzdrk
|
# dev9ghzdrk
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
@ -123,6 +125,9 @@ if(GTKn_FOUND AND PCAP_FOUND AND LIBXML2_FOUND)
|
||||||
list(APPEND CMAKE_MODULE_PATH
|
list(APPEND CMAKE_MODULE_PATH
|
||||||
${CMAKE_MODULE_PATH}/macros)
|
${CMAKE_MODULE_PATH}/macros)
|
||||||
include(GlibCompileResourcesSupport)
|
include(GlibCompileResourcesSupport)
|
||||||
|
else()
|
||||||
|
set(dev9ghzdrk FALSE)
|
||||||
|
print_dep("Skip build of dev9ghzdrk: missing dependencies" "${msg_dep_dev}")
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
|
||||||
|
@ -156,7 +161,7 @@ elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/GSdx")
|
||||||
set(GSdx FALSE)
|
set(GSdx FALSE)
|
||||||
else()
|
else()
|
||||||
set(GSdx FALSE)
|
set(GSdx FALSE)
|
||||||
print_dep("Skip build of GSdx: miss some dependencies" "${msg_dep_gsdx}")
|
print_dep("Skip build of GSdx: missing dependencies" "${msg_dep_gsdx}")
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
|
||||||
|
@ -175,7 +180,7 @@ if(EXTRA_PLUGINS)
|
||||||
set(zerogs FALSE)
|
set(zerogs FALSE)
|
||||||
else()
|
else()
|
||||||
set(zerogs FALSE)
|
set(zerogs FALSE)
|
||||||
print_dep("Skip build of zerogs: miss some dependencies" "${msg_dep_zerogs}")
|
print_dep("Skip build of zerogs: missing dependencies" "${msg_dep_zerogs}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
@ -197,7 +202,7 @@ if(EXTRA_PLUGINS)
|
||||||
set(zzogl FALSE)
|
set(zzogl FALSE)
|
||||||
else()
|
else()
|
||||||
set(zzogl FALSE)
|
set(zzogl FALSE)
|
||||||
print_dep("Skip build of zzogl: miss some dependencies" "${msg_dep_zzogl}")
|
print_dep("Skip build of zzogl: missing dependencies" "${msg_dep_zzogl}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
@ -234,17 +239,17 @@ elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad")
|
||||||
set(onepad FALSE)
|
set(onepad FALSE)
|
||||||
else()
|
else()
|
||||||
set(onepad FALSE)
|
set(onepad FALSE)
|
||||||
print_dep("Skip build of onepad: miss some dependencies" "${msg_dep_onepad}")
|
print_dep("Skip build of onepad: missing dependencies" "${msg_dep_onepad}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# old version of the plugin that still support SDL1
|
# old version of the plugin that still supports SDL1
|
||||||
if(wxWidgets_FOUND AND GTKn_FOUND AND SDLn_FOUND AND X11_FOUND)
|
if(wxWidgets_FOUND AND GTKn_FOUND AND SDLn_FOUND AND X11_FOUND)
|
||||||
set(onepad_legacy TRUE)
|
set(onepad_legacy TRUE)
|
||||||
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad_legacy")
|
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad_legacy")
|
||||||
set(onepad_legacy FALSE)
|
set(onepad_legacy FALSE)
|
||||||
else()
|
else()
|
||||||
set(onepad_legacy FALSE)
|
set(onepad_legacy FALSE)
|
||||||
print_dep("Skip build of onepad_legacy: miss some dependencies" "${msg_dep_onepad}")
|
print_dep("Skip build of onepad_legacy: missing dependencies" "${msg_dep_onepad}")
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
|
||||||
|
@ -272,7 +277,7 @@ elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/spu2-x")
|
||||||
set(spu2-x FALSE)
|
set(spu2-x FALSE)
|
||||||
else()
|
else()
|
||||||
set(spu2-x FALSE)
|
set(spu2-x FALSE)
|
||||||
print_dep("Skip build of spu2-x: miss some dependencies" "${msg_dep_spu2x}")
|
print_dep("Skip build of spu2-x: missing dependencies" "${msg_dep_spu2x}")
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
|
||||||
|
@ -288,12 +293,12 @@ if(EXTRA_PLUGINS)
|
||||||
set(zerospu2 TRUE)
|
set(zerospu2 TRUE)
|
||||||
# Comment the next line, if you want to compile zerospu2
|
# Comment the next line, if you want to compile zerospu2
|
||||||
set(zerospu2 FALSE)
|
set(zerospu2 FALSE)
|
||||||
message(STATUS "Don't build zerospu2. It is super-seeded by spu2x")
|
message(STATUS "Don't build zerospu2. It is superceded by spu2x")
|
||||||
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerospu2")
|
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerospu2")
|
||||||
set(zerospu2 FALSE)
|
set(zerospu2 FALSE)
|
||||||
else()
|
else()
|
||||||
set(zerospu2 FALSE)
|
set(zerospu2 FALSE)
|
||||||
print_dep("Skip build of zerospu2: miss some dependencies" "${msg_dep_zerospu2}")
|
print_dep("Skip build of zerospu2: missing dependencies" "${msg_dep_zerospu2}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
|
|
@ -740,8 +740,10 @@ endif()
|
||||||
|
|
||||||
add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}")
|
add_pcsx2_executable(${Output} "${pcsx2FinalSources}" "${pcsx2FinalLibs}" "${pcsx2FinalFlags}")
|
||||||
|
|
||||||
if(PACKAGE_MODE)
|
if(dev9ghzdrk)
|
||||||
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f ${BIN_DIR}/${Output} ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' ${BIN_DIR}/${Output}; set +x\")")
|
if(PACKAGE_MODE)
|
||||||
else()
|
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f ${BIN_DIR}/${Output} ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' ${BIN_DIR}/${Output}; set +x\")")
|
||||||
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f ${CMAKE_SOURCE_DIR}/bin/${Output} ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' ${CMAKE_SOURCE_DIR}/bin/${Output}; set +x\")")
|
else()
|
||||||
|
install(CODE "execute_process(COMMAND /bin/bash -c \"echo 'Enabling networking capability on Linux...';set -x; [ -f ${CMAKE_SOURCE_DIR}/bin/${Output} ] && sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' ${CMAKE_SOURCE_DIR}/bin/${Output}; set +x\")")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -66,15 +66,6 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/USBnull" AND USBnull)
|
||||||
add_subdirectory(USBnull)
|
add_subdirectory(USBnull)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerogs" AND zerogs)
|
|
||||||
# add_subdirectory(zerogs)
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/zzogl-pg" AND zzogl)
|
if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/zzogl-pg" AND zzogl)
|
||||||
add_subdirectory(zzogl-pg/opengl)
|
add_subdirectory(zzogl-pg/opengl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerospu2" AND zerospu2)
|
|
||||||
add_subdirectory(zerospu2)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue