Fixed NEE with isosurfaces. #124
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build using Homebrew | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ macos-latest ] | |
runs-on: ${{ matrix.os }} | |
name: "${{ github.workflow }}: ${{ 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 Dependencies via Homebrew | |
shell: bash | |
run: | | |
# Normally, we would first install Homebrew here: apt install curl, | |
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
# https://stackoverflow.com/questions/25128546/how-to-automate-homebrew-installation | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
if ! command -v brew &> /dev/null; then | |
sudo apt install curl build-essential gcc | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> ~/.bash_profile | |
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bash_profile | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
fi | |
brew install gcc | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 | |
brew update | |
#rm /usr/local/bin/2to3 || true | |
#rm /usr/local/bin/idle3 || true | |
#rm /usr/local/bin/pydoc3 || true | |
#rm /usr/local/bin/python3 || true | |
#rm /usr/local/bin/python3-config || true | |
brew install --force --overwrite llvm libomp pkg-config | |
else | |
echo "$RUNNER_OS is not supported." | |
exit 1 | |
fi | |
brew install cmake zlib libpng glm sdl2 sdl2_image libarchive opencl-headers boost tinyxml2 jsoncpp openexr | |
- name: Install Vulkan SDK | |
shell: bash | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
distro_code_name="$(lsb_release -c | grep -oP "\:\s+\K\S+")" | |
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 vulkan-sdk shaderc | |
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 | |
VK_LAYER_PATH="" | |
source "VulkanSDK/$(ls VulkanSDK)/setup-env.sh" | |
# 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" | |
sed -i '' 's;^prefix=.*;prefix=\"'$prefix_path'\";' "$shaderc_pkgconfig_file" | |
sed -i '' 's;^libdir=.*;libdir=${prefix}/lib;' "$shaderc_pkgconfig_file" | |
echo "PKG_CONFIG_PATH=\"$(realpath "VulkanSDK/$(ls VulkanSDK)/$os_arch/lib/pkgconfig")\"" >> $GITHUB_ENV | |
fi | |
fi | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
vulkansdk_filename=$(curl -sIkL https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg | sed -r '/filename=/!d;s/.*filename=(.*)$/\1/') | |
VULKAN_SDK_VERSION=$(echo $vulkansdk_filename | sed -r 's/^.*vulkansdk-macos-(.*)\.dmg.*$/\1/') | |
curl -O https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.dmg | |
sudo hdiutil attach vulkan-sdk.dmg | |
# The directory was changed from '/Volumes/VulkanSDK' to, e.g., 'vulkansdk-macos-1.3.261.0'. | |
vulkan_dir=$(find /Volumes -maxdepth 1 -name '[Vv]ulkan*' -not -path "/Volumes/VMware*" || true) | |
sudo "${vulkan_dir}/InstallVulkan.app/Contents/MacOS/InstallVulkan" \ | |
--root ~/VulkanSDK/$VULKAN_SDK_VERSION --accept-licenses --default-answer --confirm-command install | |
cd ~/VulkanSDK/$VULKAN_SDK_VERSION | |
sudo ./install_vulkan.py || true | |
sudo hdiutil unmount "${vulkan_dir}" | |
# Fix pkgconfig file. | |
shaderc_pkgconfig_file="$HOME/VulkanSDK/$(ls $HOME/VulkanSDK)/macOS/lib/pkgconfig/shaderc.pc" | |
prefix_path="$HOME/VulkanSDK/$(ls $HOME/VulkanSDK)/macOS" | |
sudo sed -i '' 's;^prefix=.*;prefix=\"'$prefix_path'\";' "$shaderc_pkgconfig_file" | |
sudo sed -i '' 's;^libdir=.*;libdir=${prefix}/lib;' "$shaderc_pkgconfig_file" | |
else | |
echo "$RUNNER_OS is not supported." | |
exit 1 | |
fi | |
- name: Configure CMake (sgl) | |
shell: bash | |
run: | | |
params=() | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
os_arch="$(uname -m)" | |
export VULKAN_SDK="/usr" | |
export PKG_CONFIG_PATH="/usr/lib/${os_arch}-linux-gnu/pkgconfig" | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
source "$HOME/VulkanSDK/$(ls $HOME/VulkanSDK)/setup-env.sh" | |
params+=(-DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=False -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=False -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_FIND_APPBUNDLE=NEVER -DZLIB_ROOT="$(brew --prefix)/opt/zlib") | |
export PKG_CONFIG_PATH="$HOME/VulkanSDK/$(ls $HOME/VulkanSDK)/macOS/lib/pkgconfig" | |
fi | |
cmake "${{env.sgl_REPO_DIR}}" -B "${{env.sgl_REPO_DIR}}/build" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX="${{env.sgl_DIR}}" -DCMAKE_PREFIX_PATH="$(brew --prefix)" "${params[@]}" | |
- 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) | |
shell: bash | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" | |
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 | |
os_arch="$(uname -m)" | |
export VULKAN_SDK="/usr" | |
export PKG_CONFIG_PATH="/usr/lib/${os_arch}-linux-gnu/pkgconfig" | |
fi | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
source "$HOME/VulkanSDK/$(ls $HOME/VulkanSDK)/setup-env.sh" | |
params+=(-DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=False -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=False -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_FIND_APPBUNDLE=NEVER -DZLIB_ROOT="$(brew --prefix)/opt/zlib") | |
fi | |
cmake -B "${{github.workspace}}/build" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -Dsgl_DIR=${{env.sgl_DIR}}/lib/cmake/sgl -DCMAKE_PREFIX_PATH="$(brew --prefix)" "${params[@]}" | |
- name: Build (CloudRendering) | |
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --parallel 4 |