Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
jakoch committed Jul 11, 2024
1 parent d622a8e commit 468fdf8
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true

# "visual studio" specific
spelling_languages = en-us
guidelines = 80 dashed, 130

[CMakeLists.txt, *.{cmake}]
indent_size = 2

[*.cmake]
indent_size = 2

[*.{c,cc,cpp,h,hpp,hxx,inl}]
indent_size = 4
trim_trailing_whitespace = true

[*.{json,yaml,yml}]
indent_size = 2
insert_final_newline = false

[*.{md,markdown}]
indent_size = 4
trim_trailing_whitespace = false

[*.{clang-format}]
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# dependabot.yml
#
# Dependabot updates dependencies automatically to their latest versions.
#
# Docs: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2

updates:
# Enable automatic version updates for Github Actions
- package-ecosystem: "github-actions"
# Look for `.github/workflows` in the `root` directory
directory: "/"
schedule:
interval: "weekly"
ignore:
# ignore all updates for "https://github.com/actions/github-script"
- dependency-name: "github-script"
146 changes: 146 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#
# .github/workflows/build.yml
#
# Copyright 2024 Jens A. Koch.
# SPDX-License-Identifier: MIT
# This file is part of https://github.com/jakoch/rasterizers
#

name: "Build on Windows"

on:
# You can manually run this workflow.
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
# This workflow runs on schedule: every Sunday at 1 am.
#schedule:
# - cron: "0 1 * * 0"

# needed by "softprops/action-gh-release"
permissions:
contents: write

# improve CI concurrency by automatically cancelling outdated jobs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:

# ---------------------------------------------------------------------------------------

build-on-windows:

# ---------------------------------------------------------------------------------------

name: "Windows VC17"
# https://github.com/actions/runner-images
runs-on: windows-2022

env:
BUILD_DIR: ${{github.workspace}}\swiftshader\build
INSTALL_DIR: ${{github.workspace}}\swiftshader\install

defaults:
run:
shell: cmd

steps:
- name: 🤘 Checkout Code
uses: actions/checkout@v4 # https://github.com/actions/checkout
with:
repository: google/swiftshader
path: swiftshader

- name: 🛠️ Setup Visual Studio Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1

# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md#visual-studio-enterprise-2022
#- name: 🛠️ Setup Visual Studio Developer Command Prompt
# run: call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
# shell: cmd

# https://community.chocolatey.org/packages/cmake
- name: 🔽 Install CMake
run: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' --no-progress

# Reminder: This step requires that the CMakePresets for CI contain
# "CMAKE_CXX_COMPILER_LAUNCHER": "sccache".
- name: 🎯 Setup Build Cache
uses: hendrikmuhs/ccache-action@v1 # https://github.com/hendrikmuhs/ccache-action
with:
variant: sccache
key: cache-build-${{ github.ref }}
restore-keys: |
cache-build-${{ github.ref }}
cache-build-
- name: 🖋️ CMake ➔ Configure
run: |
cmake -S swiftshader -B ${{ env.BUILD_DIR }} ^
-G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache ^
-DSWIFTSHADER_BUILD_VULKAN=ON ^
-DSWIFTSHADER_BUILD_EGL=OFF ^
-DSWIFTSHADER_BUILD_GLESv2=OFF ^
-DSWIFTSHADER_BUILD_GLES_CM=OFF ^
-DSWIFTSHADER_BUILD_PVR=OFF ^
-DSWIFTSHADER_BUILD_TESTS=OFF
- name: 🙏 CMake ➔ Build
run: |
cmake --build ${{ env.BUILD_DIR }} --parallel --config Release --target vk_swiftshader
#- name: CMake ➔ Install
# run: |
# cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_DIR }} --verbose

- name: ❔ CHECK folders, to see if everything is present (after building & installing)
run: |
dir /S /B ${{ env.BUILD_DIR }}
# dir /S /B ${{ env.INSTALL_DIR }}
# Change back to INSTALL_DIR, when i figured out how to "cmake install" this crap.
# Well, after build, there is a folder "Windows"... lets package only that.

- name: 📝 Get Version of SwiftShader Library (Maj.Min.Patch.Rev)
shell: pwsh
run: |
$libraryPath = "${{ env.BUILD_DIR }}\Windows\vk_swiftshader.dll"
$versionInfo = (Get-Item $libraryPath).VersionInfo
$fileVersionRaw = $versionInfo.FileVersionRaw
Write-Output "FileVersionRaw: $fileVersionRaw"
echo "VERSION=$fileVersionRaw" >> $env:GITHUB_ENV
- name: 📝 Get Git commit shorthash
shell: pwsh
run: |
echo "SHORTHASH=$($env:GITHUB_SHA.substring(0,7))" >> $env:GITHUB_ENV
# Versioning Pattern: "swiftshader-5.0.0.0-a2s8ad3-win64.zip"
- name: 🏷️ Versionize Artifact
shell: pwsh
run: |
echo "SWIFTSHADER_ARTIFACT_NAME=swiftshader-${{ env.VERSION }}-${{ env.SHORTHASH }}-win64" >> $env:GITHUB_ENV
echo "SWIFTSHADER_ARTIFACT_ZIPFILE=swiftshader-${{ env.VERSION }}-${{ env.SHORTHASH }}-win64.zip" >> $env:GITHUB_ENV
- name: 📦 Package
run: |
7z a -tzip -mx9 "${{ env.SWIFTSHADER_ARTIFACT_ZIPFILE }}" "${{ env.BUILD_DIR }}\Windows\*"
- name: 📦 🚀 Upload Artifact
uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact
with:
name: ${{ env.SWIFTSHADER_ARTIFACT_NAME }}
path: ${{ env.SWIFTSHADER_ARTIFACT_ZIPFILE }}

#- name: 📦 🚀 Release
# uses: softprops/action-gh-release@v2 https://github.com/softprops/action-gh-release
# with:
# files: swiftshader/build/swiftshader-win64.zip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# rasterizers
## rasterizers

0 comments on commit 468fdf8

Please sign in to comment.