Skip to content

Added dependency on glslang-tools for Ubuntu 24.04 and onwards. #355

Added dependency on glslang-tools for Ubuntu 24.04 and onwards.

Added dependency on glslang-tools for Ubuntu 24.04 and onwards. #355

Workflow file for this run

name: Build on Ubuntu
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
BUILD_TYPE: Release
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, ubuntu-24.04 ]
runs-on: ${{ matrix.os }}
name: "Build on ${{ matrix.os }}"
env:
sgl_REPO_DIR: ${{ github.workspace }}/sgl-repo
sgl_DIR: ${{ github.workspace }}/sgl
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/checkout@v2
with:
repository: chrismile/sgl
path: sgl-repo
submodules: true
- name: Install system packages
shell: bash
run: |
sudo apt-get update
distro_code_name=$(lsb_release -c | grep -oP "\:\s+\K\S+")
# Removed fix below to fix "dpkg: error processing package grub-efi-amd64-signed" (2023-02-28).
#if [ "$distro_code_name" = "jammy" ]; then
# # Fix for https://askubuntu.com/questions/1417403/can-not-install-libudev-dev-on-ubuntu-22-04/1417416#1417416
# sudo apt-get install aptitude
# sudo apt-get upgrade
# sudo apt-get --with-new-pkgs upgrade
# sudo aptitude full-upgrade -y
# sudo apt-get update
# sudo apt-get upgrade
#fi
sudo apt-get install git cmake libglm-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
libpng-dev libboost-filesystem-dev libtinyxml2-dev libarchive-dev libglew-dev opencl-c-headers ocl-icd-opencl-dev \
libjsoncpp-dev libopenexr-dev
- name: Install Vulkan SDK
shell: bash
run: |
distro_code_name=$(lsb_release -cs)
distro_release=$(lsb_release -rs)
os_arch="$(uname -m)"
if ! curl -s -I "https://packages.lunarg.com/vulkan/dists/${distro_code_name}/" | grep "2 404" > /dev/null; then
echo "Installing Vulkan SDK from a PPA..."
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-${distro_code_name}.list \
https://packages.lunarg.com/vulkan/lunarg-vulkan-${distro_code_name}.list
sudo apt update
sudo apt install -y vulkan-sdk shaderc glslang-dev
elif dpkg --compare-versions "$distro_release" "ge" "24.04"; then
sudo apt install -y libvulkan-dev libshaderc-dev glslang-dev
else
echo "Unpacking Vulkan SDK from an archive file..."
curl --silent --show-error --fail -O https://sdk.lunarg.com/sdk/download/latest/linux/vulkan-sdk.tar.gz
mkdir -p VulkanSDK
tar -xf vulkan-sdk.tar.gz -C VulkanSDK
# Fix pkgconfig file.
shaderc_pkgconfig_file="VulkanSDK/$(ls VulkanSDK)/$os_arch/lib/pkgconfig/shaderc.pc"
if [ -f $shaderc_pkgconfig_file ]; then
prefix_path=$(realpath "VulkanSDK/$(ls VulkanSDK)/$os_arch")
sed -i '3s;.*;prefix=\"'$prefix_path'\";' "$shaderc_pkgconfig_file"
sed -i '5s;.*;libdir=${prefix}/lib;' "$shaderc_pkgconfig_file"
echo "PKG_CONFIG_PATH=\"$(realpath "VulkanSDK/$(ls VulkanSDK)/$os_arch/lib/pkgconfig")\"" >> $GITHUB_ENV
fi
fi
- name: Configure CMake (sgl)
shell: bash
run: |
if [ "${{env.PKG_CONFIG_PATH}}" != "" ]; then
VK_LAYER_PATH=""
source "VulkanSDK/$(ls VulkanSDK)/setup-env.sh"
export PKG_CONFIG_PATH="${{env.PKG_CONFIG_PATH}}"
else
export VULKAN_SDK="/usr"
fi
cmake ${{env.sgl_REPO_DIR}} -B ${{env.sgl_REPO_DIR}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.sgl_DIR}}
- name: Build (sgl)
run: cmake --build ${{env.sgl_REPO_DIR}}/build --config ${{env.BUILD_TYPE}} --parallel 4
- name: Install (sgl)
run: cmake --build ${{env.sgl_REPO_DIR}}/build --config ${{env.BUILD_TYPE}} --target install
- name: Configure CMake (CloudRendering)
run: |
if [ "${{env.PKG_CONFIG_PATH}}" != "" ]; then
VK_LAYER_PATH=""
source "VulkanSDK/$(ls VulkanSDK)/setup-env.sh"
export PKG_CONFIG_PATH="${{env.PKG_CONFIG_PATH}}"
else
export VULKAN_SDK="/usr"
fi
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dsgl_DIR=${{env.sgl_DIR}}/lib/cmake/sgl
- name: Build (CloudRendering)
run: |
if [ "${{env.PKG_CONFIG_PATH}}" != "" ]; then
VK_LAYER_PATH=""
source "VulkanSDK/$(ls VulkanSDK)/setup-env.sh"
export PKG_CONFIG_PATH="${{env.PKG_CONFIG_PATH}}"
else
export VULKAN_SDK="/usr"
fi
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 4