Skip to content

CMake

CMake #336

Workflow file for this run

name: CMake
on:
push:
pull_request:
schedule:
- cron: "0 0 * * 1"
env:
BUILD_TYPE: Release
VULKAN_SDK_VERSION: 1.3.236
EMBREE_VERSION: 4.0.1
ISPC_VERSION: 1.19.0
TBB_VERSION: 2021.2.0
OPTIX_VERSION: 7.7.0
jobs:
ubuntu:
env:
PACKAGE_NAME: chameleonrt-ubuntu2204-x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{github.workspace}}/build/deps
sudo apt update
- name: Setup SDL2
run: sudo apt install libsdl2-dev
- name: Setup VulkanSDK
run: |
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-${VULKAN_SDK_VERSION}-jammy.list https://packages.lunarg.com/vulkan/${VULKAN_SDK_VERSION}/lunarg-vulkan-${VULKAN_SDK_VERSION}-jammy.list
sudo apt update
sudo apt install vulkan-sdk
- name: Setup CUDA
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda
# Provides VulkanSDK for Windows and OptiX for Windows/Linux
- name: Fetch RT CI Dependencies
uses: actions/checkout@v4
with:
ssh-key: ${{secrets.RT_CI_DEPS_KEY}}
repository: Twinklebear/rt-ci-deps
path: ${{github.workspace}}/build/deps/rt-ci-deps/
- name: Setup Embree
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/embree/embree/releases/download/v${EMBREE_VERSION}/embree-${EMBREE_VERSION}.x86_64.linux.tar.gz
tar -xf embree-${EMBREE_VERSION}.x86_64.linux.tar.gz
- name: Setup TBB
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-lin.tgz
tar -xf oneapi-tbb-${TBB_VERSION}-lin.tgz
- name: Setup ISPC
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/ispc/ispc/releases/download/v${ISPC_VERSION}/ispc-v${ISPC_VERSION}-linux.tar.gz
tar -xf ispc-v${ISPC_VERSION}-linux.tar.gz
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DENABLE_EMBREE=ON
-DENABLE_VULKAN=ON
-DENABLE_OPTIX=ON
-Dembree_DIR=${{github.workspace}}/build/deps/embree-${EMBREE_VERSION}.x86_64.linux/lib/cmake/embree-${EMBREE_VERSION}
-DTBB_DIR=${{github.workspace}}/build/deps/oneapi-tbb-${TBB_VERSION}/lib/cmake/tbb/
-DISPC_DIR=${{github.workspace}}/build/deps/ispc-v${ISPC_VERSION}-linux/bin/
-DOptiX_INSTALL_DIR=${{github.workspace}}/build/deps/rt-ci-deps/NVIDIA-OptiX-SDK-${OPTIX_VERSION}-x86_64
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE --target install
- name: Package
working-directory: ${{github.workspace}}/install
run: |
mv bin ${PACKAGE_NAME}
tar -czvf ${PACKAGE_NAME}.tar.gz ${PACKAGE_NAME}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.PACKAGE_NAME}}
path: ${{github.workspace}}/install/${{env.PACKAGE_NAME}}.tar.gz
windows:
env:
PACKAGE_NAME: chameleonrt-windows-x86_64
CUDA_VERSION: 12.5
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{github.workspace}}/build/deps
choco install wget
# Note: SDL2 Vulkan support is needed when installing through vcpkg
- name: Setup SDL2
run: vcpkg install sdl2[vulkan]:x64-windows
# Provides VulkanSDK for Windows and OptiX for Windows/Linux
- name: Fetch RT CI Dependencies
uses: actions/checkout@v4
with:
ssh-key: ${{secrets.RT_CI_DEPS_KEY}}
repository: Twinklebear/rt-ci-deps
path: ${{github.workspace}}/build/deps/rt-ci-deps/
- name: Unzip VulkanSDK
working-directory: ${{github.workspace}}/build/deps/rt-ci-deps/
run: 7z x vulkansdk-${env:VULKAN_SDK_VERSION}-windows-x64.7z -y
- name: Setup CUDA
run: |
$CUDA_REPO_PKG_REMOTE = "https://developer.download.nvidia.com/compute/cuda/${env:CUDA_VERSION}.0/network_installers/cuda_${env:CUDA_VERSION}.0_windows_network.exe"
$CUDA_REPO_PKG_LOCAL = "cuda_${env:CUDA_VERSION}.0_windows_network.exe"
$CUDA_PACKAGES = "nvcc_${env:CUDA_VERSION} cudart_${env:CUDA_VERSION}"
# Download the cuda network installer
Invoke-WebRequest $CUDA_REPO_PKG_REMOTE -OutFile $CUDA_REPO_PKG_LOCAL | Out-Null
# Invoke silent install of CUDA (via network installer)
Start-Process -Wait -FilePath .\"$($CUDA_REPO_PKG_LOCAL)" -ArgumentList "-s $($CUDA_PACKAGES)"
- name: Setup Embree
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/embree/embree/releases/download/v${env:EMBREE_VERSION}/embree-${env:EMBREE_VERSION}.x64.windows.zip
7z x embree-${env:EMBREE_VERSION}.x64.windows.zip -y
- name: Setup TBB
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/oneapi-src/oneTBB/releases/download/v${env:TBB_VERSION}/oneapi-tbb-${env:TBB_VERSION}-win.zip
7z x oneapi-tbb-${env:TBB_VERSION}-win.zip -y
- name: Setup ISPC
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/ispc/ispc/releases/download/v${env:ISPC_VERSION}/ispc-v${env:ISPC_VERSION}-windows.zip
7z x ispc-v${env:ISPC_VERSION}-windows.zip -y
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: >
cmake -A x64 ${env:GITHUB_WORKSPACE}
-G "Visual Studio 17 2022"
-DCMAKE_INSTALL_PREFIX:PATH=${env:GITHUB_WORKSPACE}/install
-DCMAKE_TOOLCHAIN_FILE="${env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake"
-DENABLE_EMBREE=ON
-DENABLE_DXR=ON
-DENABLE_VULKAN=ON
-DENABLE_OPTIX=ON
-Dembree_DIR="${env:GITHUB_WORKSPACE}/build/deps/embree-${env:EMBREE_VERSION}.x64.windows/lib/cmake/embree-${env:EMBREE_VERSION}"
-DTBB_DIR="${env:GITHUB_WORKSPACE}/build/deps/oneapi-tbb-${env:TBB_VERSION}/lib/cmake/tbb/"
-DISPC_DIR="${env:GITHUB_WORKSPACE}/build/deps/ispc-v${env:ISPC_VERSION}-windows/bin/"
-DVULKAN_SDK="${env:GITHUB_WORKSPACE}/build/deps/rt-ci-deps/vulkansdk-${env:VULKAN_SDK_VERSION}-windows-x64"
-DOptiX_INSTALL_DIR="${env:GITHUB_WORKSPACE}/build/deps/rt-ci-deps/NVIDIA-OptiX-SDK-${env:OPTIX_VERSION}-x86_64"
-DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${env:CUDA_VERSION}"
-DCMAKE_SYSTEM_VERSION="10.0.19042"
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${env:BUILD_TYPE} --target install
- name: Package
working-directory: ${{github.workspace}}/install
run: |
mv bin ${env:PACKAGE_NAME}
7z a -tzip ${env:PACKAGE_NAME}.zip ${env:PACKAGE_NAME}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.PACKAGE_NAME}}
path: ${{github.workspace}}/install/${{env.PACKAGE_NAME}}.zip
macos:
env:
PACKAGE_NAME: chameleonrt-macOS-x86_64
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
cmake -E make_directory ${{github.workspace}}/build
cmake -E make_directory ${{github.workspace}}/build/deps
- name: Setup SDL2
run: brew install sdl2
- name: Setup Embree
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/embree/embree/releases/download/v${EMBREE_VERSION}/embree-${EMBREE_VERSION}.x86_64.macosx.zip
unzip embree-${EMBREE_VERSION}.x86_64.macosx.zip
- name: Setup TBB
working-directory: ${{github.workspace}}/build/deps
run: |
wget https://github.com/oneapi-src/oneTBB/releases/download/v${TBB_VERSION}/oneapi-tbb-${TBB_VERSION}-mac.tgz
tar -xf oneapi-tbb-${TBB_VERSION}-mac.tgz
# Clean up python and other stuff we don't need so the right python can be installed with brew
- name: Cleanup Python
run: |
brew uninstall azure-cli
brew uninstall --ignore-dependencies python
brew install --force --overwrite python@3.12
- name: Setup ISPC
run: brew install ispc
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: >
cmake $GITHUB_WORKSPACE
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DENABLE_EMBREE=ON
-Dembree_DIR=${{github.workspace}}/build/deps/embree-${EMBREE_VERSION}.x86_64.macosx/lib/cmake/embree-${EMBREE_VERSION}
-DTBB_DIR=${{github.workspace}}/build/deps/oneapi-tbb-${TBB_VERSION}/lib/cmake/tbb/
-DENABLE_METAL=ON
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config $BUILD_TYPE --target install
- name: Package
working-directory: ${{github.workspace}}/install
run: |
mv bin ${PACKAGE_NAME}
tar -czvf ${PACKAGE_NAME}.tar.gz ${PACKAGE_NAME}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.PACKAGE_NAME}}
path: ${{github.workspace}}/install/${{env.PACKAGE_NAME}}.tar.gz