Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Remove conan package manager and use only CMake instead #528

Merged
merged 9 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 105 additions & 92 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
name: Build
on: [push, pull_request]
name: Build Code

on:
push:
pull_request:
types: [opened]

env:
INEXOR_VULKAN_VERSION: "1.3.216.0"
INEXOR_VULKAN_SDK_PATH: "$GITHUB_WORKSPACE/../vulkan_sdk/"

jobs:
linux:
name: ${{ matrix.config.name }}
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !github.event.pull_request.merged || github.event_name == 'push' }}
container: ubuntu:rolling
env:
DEBIAN_FRONTEND: "noninteractive"
CONAN_USER_HOME: "${{ github.workspace }}/conan/"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan/s"
inexor_conan_path: "$HOME/.local/bin"
strategy:
fail-fast: false
matrix:
config:
- {
IAmNotHanni marked this conversation as resolved.
Show resolved Hide resolved
name: "Ubuntu Clang",
cc: "clang", cxx: "clang++",
cmake_configure_options: '-DCMAKE_EXE_LINKER_FLAGS="-v -fuse-ld=lld"',
build_type: "Release",
name: "Ubuntu Clang (Debug)",
compiler: "clang",
cc: "clang-14", cxx: "clang++-14",
build_type: "Debug"
}
- {
name: "Ubuntu GCC",
cc: "gcc", cxx: "g++",
build_type: "Release",
name: "Ubuntu Clang (Release)",
compiler: "clang",
cc: "clang-14", cxx: "clang++-14",
build_type: "Release"
}
- {
name: "Ubuntu GCC (Debug)",
compiler: "gcc",
cc: "gcc-12", cxx: "g++-12",
build_type: "Debug"
}
- {
name: "Ubuntu GCC (Release)",
compiler: "gcc",
cc: "gcc-12", cxx: "g++-12",
build_type: "Release"
}

steps:
Expand All @@ -34,8 +53,9 @@ jobs:
# Update package lists
apt update -qq
# Install build tools
apt install -y \
clang \
apt-get install -y \
gcc-12 \
clang-14 \
cmake \
curl \
git \
Expand Down Expand Up @@ -63,34 +83,34 @@ jobs:
xkb-data \
xorg-dev

pip3 install wheel setuptools
pip3 install conan mako
pip3 install --break-system-packages wheel setuptools

- name: Install Vulkan SDK
shell: bash
run: |
# Download Vulkan SDK
curl -LS -o vulkansdk.tar.gz \
https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_VERSION }}/linux/vulkansdk-linux-x86_64-${{ env.INEXOR_VULKAN_VERSION }}.tar.gz
# Create Vulkan SDK directory and extract
mkdir "${{ env.INEXOR_VULKAN_SDK_PATH }}"
tar xfz vulkansdk.tar.gz -C "${{ env.INEXOR_VULKAN_SDK_PATH }}"

- name: Checkout
uses: actions/checkout@v3

- name: Cache Conan Dependencies
uses: actions/cache@v3
with:
path: ${{ env.CONAN_USER_HOME }}
key: conan-${{ runner.os }}-${{ matrix.config.name }}-${{ matrix.config.build_type }}-${{ hashFiles('conanfile.py') }}

- name: Configure CMake
shell: bash
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
export PATH="${{ env.inexor_conan_path }}":$PATH

# Setup conan
# Note: libstdc++11 is needed to use new libc++ ABI
conan profile new default --detect --force
conan profile update settings.compiler.libcxx=libstdc++11 default

# Configure cmake
export VULKAN_SDK="${{ env.INEXOR_VULKAN_SDK_PATH }}/${{ env.INEXOR_VULKAN_VERSION }}/x86_64"
export PATH=$VULKAN_SDK/bin:$PATH
cmake . \
-Bbuild \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-DINEXOR_BUILD_BENCHMARKS=ON \
-DINEXOR_BUILD_TESTS=ON \
-DCMAKE_CXX_FLAGS="-Wall -Wextra" \
-GNinja \
${{ matrix.config.cmake_configure_options }}

Expand All @@ -103,110 +123,110 @@ jobs:
shell: bash
run: |
cd build
tar -zcvf "../build_linux_${{ matrix.config.cc }}.tar.xz" *
tar -zcvf "../build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" *

- name: Upload build artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: build_linux_${{ matrix.config.cc }}.tar.xz
path: build_linux_${{ matrix.config.cc }}.tar.xz
name: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz
path: build_linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz

- name: Prepare release artifacts
- name: Prepare Artifacts
shell: bash
run: |
mkdir release
cp -r ./build/bin/ release
cp -r ./configuration/ release
cp -r ./assets/ release
mkdir -p ./release/shaders
cp ./shaders/*.spv ./release/shaders/
cd release
tar -zcvf "../release_linux_amd64_${{ matrix.config.cc }}.tar.xz" *
mkdir artifacts
cp ./build/example/inexor-vulkan-renderer-example artifacts/
cp -r ./configuration/ artifacts/
cp -r ./assets/ artifacts
mkdir -p ./artifacts/shaders
cp ./shaders/*.spv ./artifacts/shaders/
cd artifacts
tar -zcvf "../linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz" *

- name: Upload release artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: release_linux_amd64_${{ matrix.config.cc }}.tar.xz
path: release_linux_amd64_${{ matrix.config.cc }}.tar.xz
name: linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz
path: linux_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.tar.xz
retention-days: 7

- name: Clean Up Conan
if: always()
shell: bash
run: |
conan remove "*" -f --builds --src
conan remove "*" -f --system-reqs

windows:
name: ${{ matrix.config.name }}
runs-on: windows-latest
env:
CONAN_USER_HOME: "${{ github.workspace }}/conan/"
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan/s"
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows MSVC",
name: "Windows MSVC (Debug)",
compiler: "msvc",
cc: "cl", cxx: "cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64',
build_type: "Debug",
cmake_build_options: "--config Debug",
}
- {
name: "Windows MSVC (Release)",
compiler: "msvc",
cc: "cl", cxx: "cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64',
build_type: "Release",
cmake_build_options: "--config Release",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64',
conan_profile_update: ''
}
- {
name: "Windows Clang",
name: "Windows Clang (Debug)",
compiler: "clang",
cc: "clang-cl", cxx: "clang-cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64 -T "LLVM_v143" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_LINKER="lld.exe"',
build_type: "Debug",
cmake_build_options: "--config Debug",
}
- {
name: "Windows Clang (Release)",
compiler: "clang",
cc: "clang-cl", cxx: "clang-cl",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64 -T "LLVM_v143" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_LINKER="lld.exe"',
build_type: "Release",
cmake_build_options: "--config Release",
cmake_configure_options: '-G "Visual Studio 17 2022" -A x64 -T "LLVM_v143" -DCMAKE_CXX_COMPILER="clang-cl.exe" -DCMAKE_C_COMPILER="clang-cl.exe" -DCMAKE_LINKER="lld.exe"',
conan_profile_update: 'conan profile update settings.compiler.libcxx=libstdc++11 default',
}

steps:
- name: Update environment
shell: pwsh
run: |
pip3 install wheel setuptools
pip3 install conan

- name: Checkout
uses: actions/checkout@v3

- name: Cache Conan Dependencies
uses: actions/cache@v3
with:
path: ${{ env.CONAN_USER_HOME }}
key: conan-${{ runner.os }}-${{ matrix.config.name }}-${{ matrix.config.build_type }}-${{ hashFiles('conanfile.py') }}

- name: Configure LLVM
if: matrix.config.compiler == 'clang'
shell: pwsh
run: |
choco upgrade --no-progress llvm
curl -fsSL -o "LLVM_VS2017.zip" "https://github.com/zufuliu/llvm-utils/releases/download/v22.09/LLVM_VS2017.zip"
curl -fsSL -o "LLVM_VS2017.zip" "https://github.com/zufuliu/llvm-utils/releases/download/v23.03/LLVM_VS2017.zip"
7z x -y "LLVM_VS2017.zip" >NUL
LLVM_VS2017\install.bat
conan config init
(Get-Content "$(conan config home)\settings.yml") -replace 'v143', 'v143, LLVM_v143' | Out-File -encoding ASCII "$(conan config home)\settings.yml"

- name: Install Vulkan SDK
shell: pwsh
run: |
curl -LS -o vulkansdk.exe `
https://sdk.lunarg.com/sdk/download/${{ env.INEXOR_VULKAN_VERSION }}/windows/VulkanSDK-${{ env.INEXOR_VULKAN_VERSION }}-Installer.exe
7z x vulkansdk.exe -o"${{ env.INEXOR_VULKAN_SDK_PATH }}"

- name: Configure CMake
shell: pwsh
run: |
$env:CC="${{ matrix.config.cc }}"
$env:CXX="${{ matrix.config.cxx }}"

# Setup conan
conan profile new default --detect --force
${{ matrix.config.conan_profile_update }}

# Configure CMake
$env:Path += ";${{ env.INEXOR_VULKAN_SDK_PATH }}\;${{ env.INEXOR_VULKAN_SDK_PATH }}\Bin\"
# TODO: Bring back Google tests and benchmarks in Windows CI
cmake . `
-Bbuild `
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} `
-DINEXOR_BUILD_BENCHMARKS=OFF `
-DINEXOR_BUILD_TESTS=OFF `
${{ matrix.config.cmake_configure_options }}

- name: Build
Expand All @@ -217,35 +237,28 @@ jobs:
- name: Prepare build artifacts
shell: pwsh
run: |
7z a -tzip "build_windows_${{ matrix.config.compiler }}.zip" ./build/*
7z a -tzip "build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip" ./build/*

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build_windows_${{ matrix.config.compiler }}.zip
path: build_windows_${{ matrix.config.compiler }}.zip
name: build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip
path: build_windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip

- name: Prepare release artifacts
shell: pwsh
run: |
mkdir release
cp -r ./build/bin/. release
cp -r ./build/example/${{ matrix.config.build_type }}/. release
cp -r ./configuration/. release
cp -r ./assets/. release
mkdir -P ./release/shaders
cp ./shaders/*.spv ./release/shaders/
7z a -tzip "release_windows_amd64_${{ matrix.config.compiler }}.zip" ./release/*
7z a -tzip "windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip" ./release/*

- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: release_windows_amd64_${{ matrix.config.compiler }}.zip
path: release_windows_amd64_${{ matrix.config.compiler }}.zip
name: windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip
path: windows_${{ matrix.config.build_type }}_${{ matrix.config.compiler }}.zip
retention-days: 7

- name: Clean Up Conan
if: always()
shell: pwsh
run: |
conan remove "*" -f --builds --src
conan remove "*" -f --system-reqs
9 changes: 7 additions & 2 deletions .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
name: Build Documentation
on: [push, pull_request]

on:
push:
pull_request:
types: [opened]

jobs:
build_documentation:
name: Build Documentation
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !github.event.pull_request.merged || github.event_name == 'push' }}
container: ubuntu:rolling
env:
DEBIAN_FRONTEND: "noninteractive"
Expand Down Expand Up @@ -44,7 +49,7 @@ jobs:
tar cfz documentation.tar.xz build/html/*

- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/documentation/documentation.tar.xz
name: documentation.tar.xz
6 changes: 5 additions & 1 deletion .github/workflows/commit_naming.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Commit Naming
on: [push, pull_request]
on:
push:
pull_request:
types: [opened]

jobs:
naming:
name: Commit Naming
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !github.event.pull_request.merged || github.event_name == 'push' }}
steps:
- uses: IceflowRE/gitcc@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
devel-release:
name: Development
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event_name == 'pull_request' && github.event.action == 'opened' && !github.event.pull_request.merged || github.event_name == 'push' }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand Down
Loading