Add clang linux build

This commit is contained in:
Tyler Wilding 2020-10-16 20:09:15 -04:00 committed by refractionpcsx2
parent ab0fc39520
commit 75606fd1a9
7 changed files with 179 additions and 151 deletions

View File

@ -36,9 +36,10 @@ jobs:
matrix:
os: [ubuntu-20.04]
platform: [x86, x64]
compiler: [gcc, clang]
experimental: [false]
name: ${{ matrix.os }}-${{ matrix.platform }}
name: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
@ -82,23 +83,22 @@ jobs:
uses: actions/cache@v2
with:
path: .ccache
key: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: |
${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-ccache-
${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}-ccache-
- name: Install Packages
env:
PLATFORM: ${{ matrix.platform }}
# TODO - give the file executable permissions and commit it
run: |
chmod +x .github/workflows/scripts/build-linux.sh
./.github/workflows/scripts/build-linux.sh install_packages
COMPILER: ${{ matrix.compiler }}
run: ./.github/workflows/scripts/linux/install-packages.sh
- name: Build PCSX2
- name: Generate CMake
env:
PLATFORM: ${{ matrix.platform }}
# TODO - give the file executable permissions and commit it
run: |
chmod +x .github/workflows/scripts/build-linux.sh
./.github/workflows/scripts/build-linux.sh generate_cmake
./.github/workflows/scripts/build-linux.sh compile
COMPILER: ${{ matrix.compiler }}
run: ./.github/workflows/scripts/linux/generate-cmake.sh
- name: Build PCSX2
working-directory: ./build
run: ../.github/workflows/scripts/linux/compile.sh

View File

@ -1,136 +0,0 @@
#!/bin/bash
set -e
# Packages - Build Environment
declare -a BUILD_PACKAGES=(
"ccache"
"cmake"
"g++-10-multilib"
)
# Packages - PCSX2
declare -a PCSX2_PACKAGES=(
"libaio-dev"
"libasound2-dev"
"libcairo2-dev"
"libegl-dev"
"libegl1-mesa-dev"
"libgdk-pixbuf2.0-dev"
"libgirepository-1.0-1"
"libgl-dev"
"libgl1-mesa-dev"
"libgl1-mesa-dri"
"libgl1"
"libgles-dev"
"libgles-dev"
"libgles2-mesa-dev"
"libglib2.0-dev"
"libglu1-mesa-dev"
"libglu1-mesa"
"libglvnd-dev"
"libglx-dev"
"libglx-mesa0"
"libglx0"
"libgtk-3-dev"
"libgtk2.0-dev"
"libharfbuzz-dev"
"libllvm10"
"liblzma-dev"
"libpango1.0-dev"
"libpcap0.8-dev"
"libsdl2-dev"
"libsoundtouch-dev"
"libwxgtk3.0-gtk3-0v5"
"libwxgtk3.0-gtk3-dev"
"libx11-xcb-dev"
"libxext-dev"
"libxft-dev"
"libxml2-dev"
"portaudio19-dev"
"zlib1g-dev"
)
# - https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
install_packages() {
ARCH=""
echo "${PLATFORM}"
if [ "${PLATFORM}" == "x86" ]; then
ARCH=":i386"
sudo dpkg --add-architecture i386
fi
sudo apt-get -qq update
# TODO - needed? sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
# Install packages needed for building
BUILD_PACKAGE_STR=""
for i in "${BUILD_PACKAGES[@]}"; do
BUILD_PACKAGE_STR="${BUILD_PACKAGE_STR} ${i}"
done
echo "Will install the following packages for building - ${BUILD_PACKAGE_STR}"
sudo apt remove gcc-9 g++-9
sudo apt-get -y install ${BUILD_PACKAGE_STR}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
# Install packages needed by pcsx2
PCSX2_PACKAGES_STR=""
for i in "${PCSX2_PACKAGES[@]}"; do
PCSX2_PACKAGES_STR="${PCSX2_PACKAGES_STR} ${i}${ARCH}"
done
echo "Will install the following packages for pcsx2 - ${PCSX2_PACKAGES_STR}"
sudo apt-get -y install ${PCSX2_PACKAGES_STR}
}
generate_cmake() {
export CC=gcc
export CXX=g++
ADDITIONAL_CMAKE_ARGS=""
if [ "${PLATFORM}" = "x86" ]; then
ADDITIONAL_CMAKE_ARGS="-D CMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake"
fi
echo "Additional CMake Args - ${ADDITIONAL_CMAKE_ARGS}"
# Generate CMake into ./build
cmake \
-D CMAKE_C_COMPILER_LAUNCHER=ccache \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_REPLAY_LOADERS=TRUE \
-D CMAKE_BUILD_PO=FALSE \
-D GTK3_API=TRUE ${ADDITIONAL_CMAKE_ARGS} \
-B build
}
compile() {
export CCACHE_BASEDIR=${GITHUB_WORKSPACE}
export CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache
export CCACHE_COMPRESS="true"
export CCACHE_COMPRESSLEVEL="6"
export CCACHE_MAXSIZE="400M"
cd build
# Prepare the Cache
ccache -p
ccache -z
# Build
make -j10 install
# Save the Cache
ccache -s
}
case $1 in
install_packages)
"$@"
;;
generate_cmake)
"$@"
;;
compile)
"$@"
;;
esac

17
.github/workflows/scripts/linux/compile.sh vendored Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -e
export CCACHE_BASEDIR=${GITHUB_WORKSPACE}
export CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache
export CCACHE_COMPRESS="true"
export CCACHE_COMPRESSLEVEL="6"
export CCACHE_MAXSIZE="400M"
# Prepare the Cache
ccache -p
ccache -z
# Build
make -j4 install
# Save the Cache
ccache -s

View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
if [ "${COMPILER}" = "gcc" ]; then
export CC=gcc
export CXX=g++
else
export CC=clang
export CXX=clang++
fi
ADDITIONAL_CMAKE_ARGS=""
if [ "${PLATFORM}" = "x86" ]; then
ADDITIONAL_CMAKE_ARGS="-D CMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake"
fi
echo "Additional CMake Args - ${ADDITIONAL_CMAKE_ARGS}"
# Generate CMake into ./build
cmake \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_REPLAY_LOADERS=TRUE \
-D CMAKE_BUILD_PO=FALSE \
-D GTK3_API=TRUE ${ADDITIONAL_CMAKE_ARGS} \
-B build

View File

@ -0,0 +1,123 @@
#!/bin/bash
set -e
# Packages - Build Environment
declare -a BUILD_PACKAGES=(
"ccache"
"cmake"
"g++-10-multilib"
)
declare -a GCC_PACKAGES=(
# Nothing Unique Needed
)
declare -a CLANG_PACKAGES=(
"clang-format"
"clang-tidy"
"clang-tools"
"clang"
"clangd"
"libc++-dev"
"libc++1"
"libc++abi-dev"
"libc++abi1"
"libclang-dev"
"libclang1"
"liblldb-dev"
"libllvm-ocaml-dev"
"libomp-dev"
"libomp5"
"lld"
"lldb"
"llvm-dev"
"llvm-runtime"
"llvm"
"python-clang"
)
# Packages - PCSX2
declare -a PCSX2_PACKAGES=(
"libaio-dev"
"libasound2-dev"
"libcairo2-dev"
"libegl-dev"
"libegl1-mesa-dev"
"libgdk-pixbuf2.0-dev"
"libgirepository-1.0-1"
"libgl-dev"
"libgl1-mesa-dev"
"libgl1-mesa-dri"
"libgl1"
"libgles-dev"
"libgles-dev"
"libgles2-mesa-dev"
"libglib2.0-dev"
"libglu1-mesa-dev"
"libglu1-mesa"
"libglvnd-dev"
"libglx-dev"
"libglx-mesa0"
"libglx0"
"libgtk-3-dev"
"libgtk2.0-dev"
"libharfbuzz-dev"
"libllvm10"
"liblzma-dev"
"libpango1.0-dev"
"libpcap0.8-dev"
"libsdl2-dev"
"libsoundtouch-dev"
"libwxgtk3.0-gtk3-0v5"
"libwxgtk3.0-gtk3-dev"
"libx11-xcb-dev"
"libxext-dev"
"libxft-dev"
"libxml2-dev"
"portaudio19-dev"
"zlib1g-dev"
)
# - https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
ARCH=""
echo "${PLATFORM}"
if [ "${PLATFORM}" == "x86" ]; then
ARCH=":i386"
sudo dpkg --add-architecture i386
fi
sudo apt-get -qq update
# Install packages needed for building
BUILD_PACKAGE_STR=""
for i in "${BUILD_PACKAGES[@]}"; do
BUILD_PACKAGE_STR="${BUILD_PACKAGE_STR} ${i}"
done
if [ "${COMPILER}" = "gcc" ]; then
for i in "${GCC_PACKAGES[@]}"; do
BUILD_PACKAGE_STR="${BUILD_PACKAGE_STR} ${i}"
done
else
for i in "${CLANG_PACKAGES[@]}"; do
BUILD_PACKAGE_STR="${BUILD_PACKAGE_STR} ${i}"
done
fi
echo "Will install the following packages for building - ${BUILD_PACKAGE_STR}"
sudo apt remove gcc-9 g++-9
sudo apt-get -y install ${BUILD_PACKAGE_STR}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
# Install packages needed by pcsx2
PCSX2_PACKAGES_STR=""
for i in "${PCSX2_PACKAGES[@]}"; do
PCSX2_PACKAGES_STR="${PCSX2_PACKAGES_STR} ${i}${ARCH}"
done
echo "Will install the following packages for pcsx2 - ${PCSX2_PACKAGES_STR}"
sudo apt-get -y install ${PCSX2_PACKAGES_STR}

View File

@ -89,10 +89,10 @@ jobs:
- name: Verify VS Project Files
shell: powershell
run: .\.github\workflows\scripts\validate-vs-filters.ps1
run: .\.github\workflows\scripts\windows\validate-vs-filters.ps1
- name: Setup msbuild
uses: microsoft/setup-msbuild@v1.0.1
uses: microsoft/setup-msbuild@v1.0.2
with:
vs-version: 16.7