From f367f97b0dac187c58eaba25f258979108d0d7f4 Mon Sep 17 00:00:00 2001 From: Dmytro Bulatov Date: Sun, 17 Nov 2024 19:18:41 +0900 Subject: [PATCH 1/4] First version of github actions build --- .github/workflows/CI.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..e148faf --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,25 @@ +name: CI + +on: [push] + +jobs: + build: + name: Build + runs-on: windows-2022 + steps: + - name: Sync + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Configure + shell: pwsh + run: cmake -S . -B build + + - name: Build Debug + shell: pwsh + run: cmake --build build --config Debug + + - name: Build Release + shell: pwsh + run: cmake --build build --config Release From c8894ce4fdd2258a2e5e92cf22c29254a33e0a0a Mon Sep 17 00:00:00 2001 From: Dmytro Bulatov Date: Sun, 17 Nov 2024 19:53:58 +0900 Subject: [PATCH 2/4] Removed Vulkan SDK dependency. Added artifact upload. --- .github/workflows/CI.yml | 15 +++++++++++++++ .gitmodules | 3 +++ CMakeLists.txt | 20 +++++++++----------- README.md | 4 ++-- Src/ThirdParty/Vulkan-Headers | 1 + 5 files changed, 30 insertions(+), 13 deletions(-) create mode 160000 Src/ThirdParty/Vulkan-Headers diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e148faf..0f45ee9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,6 +20,21 @@ jobs: shell: pwsh run: cmake --build build --config Debug + - name: Upload Debug artifacts + uses: actions/upload-artifact@v4 + with: + name: D3d12info - Debug + path: ./build/Debug/ + - name: Build Release shell: pwsh run: cmake --build build --config Release + + - name: Upload Release artifacts + uses: actions/upload-artifact@v4 + with: + name: D3d12info - Release + path: | + ./build/Release/ + ! ./build/Release/*.lib + ! ./build/Release/*.exp diff --git a/.gitmodules b/.gitmodules index 4d646e1..98a8da7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "Src/ThirdParty/AGS_SDK"] path = Src/ThirdParty/AGS_SDK url = https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK.git +[submodule "Src/ThirdParty/Vulkan-Headers"] + path = Src/ThirdParty/Vulkan-Headers + url = https://github.com/KhronosGroup/Vulkan-Headers.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 54ac13d..2e68160 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,18 +43,17 @@ else() message(STATUS "NVAPI library not used.") endif() -option(ENABLE_VULKAN "Enables usage of Vulkan SDK." ON) +option(ENABLE_VULKAN "Enables usage of Vulkan." ON) if(ENABLE_VULKAN) - # 1.3.231 is oldest tested Vulkan SDK version - # if Cmake finds older version, it will print warning and set Vulkan_FOUND to false - find_package(Vulkan 1.3.231) - if (Vulkan_FOUND) - message(STATUS "Vulkan SDK found. Include directory is \"${Vulkan_INCLUDE_DIRS}\".") + if(EXISTS "${PROJECT_SOURCE_DIR}/Src/ThirdParty/Vulkan-Headers/CMakeLists.txt") + message(STATUS "Vulkan library used.") + add_subdirectory("${PROJECT_SOURCE_DIR}/Src/ThirdParty/Vulkan-Headers" Vulkan-Headers) else() - message(STATUS "Vulkan SDK not found. Please install Vulkan SDK or set ENABLE_VULKAN to OFF.") + message(STATUS "Vulkan library not found. This is likely due to missing submodule. Please initialize submodules or set ENABLE_VULKAN to OFF.") + set(ENABLE_VULKAN OFF) endif() else() - message(STATUS "Vulkan SDK not used.") + message(STATUS "Vulkan library not used.") endif() option(ENABLE_INTEL_GPUDETECT "Enable usage of Intel GPU Detect library." ON) @@ -119,10 +118,9 @@ function(add_my_executable USE_PREVIEW_AGILITY_SDK) target_link_libraries(${EXE_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/Src/ThirdParty/nvapi/amd64/nvapi64.lib") endif() - if (Vulkan_FOUND) + if (ENABLE_VULKAN) target_compile_definitions(${EXE_NAME} PRIVATE USE_VULKAN=1) - target_include_directories(${EXE_NAME} PRIVATE ${Vulkan_INCLUDE_DIRS}) - target_link_libraries(${EXE_NAME} PRIVATE ${Vulkan_LIBRARIES}) + target_link_libraries(${EXE_NAME} PRIVATE Vulkan::Headers) endif() if(ENABLE_INTEL_GPUDETECT) diff --git a/README.md b/README.md index a2d7847..25b6efd 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,6 @@ It uses following thirt-party libraries: - **[Intel GPU Detect](https://github.com/GameTechDev/gpudetect)** - custom vendor extensions to graphics APIs by Intel. License: Apache 2.0. - Linked via submodule. - Optional, controlled by Cmake variable `ENABLE_INTEL_GPUDETECT` - on by default. -- **[Vulkan SDK](https://www.lunarg.com/vulkan-sdk/)** - - Linked externally. Cmake automatically detects Vulkan SDK path. +- **[Vulkan Headers](https://github.com/KhronosGroup/Vulkan-Headers)** + - Linked via submodule. - Optional, controlled by Cmake variable `ENABLE_VULKAN` - on by default. diff --git a/Src/ThirdParty/Vulkan-Headers b/Src/ThirdParty/Vulkan-Headers new file mode 160000 index 0000000..98f440c --- /dev/null +++ b/Src/ThirdParty/Vulkan-Headers @@ -0,0 +1 @@ +Subproject commit 98f440ce6868c94f5ec6e198cc1adda4760e8849 From 20b2d754edb28a559ca07c80b0889e55f6b9bc01 Mon Sep 17 00:00:00 2001 From: Dmytro Bulatov Date: Mon, 18 Nov 2024 03:05:11 +0900 Subject: [PATCH 3/4] Implemented end-to-end release packaging --- .github/workflows/Package.yml | 76 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/Package.yml diff --git a/.github/workflows/Package.yml b/.github/workflows/Package.yml new file mode 100644 index 0000000..60eaaca --- /dev/null +++ b/.github/workflows/Package.yml @@ -0,0 +1,76 @@ +name: Package + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +permissions: + id-token: write + contents: read + +jobs: + package: + name: Package + runs-on: windows-2022 + environment: production + steps: + - name: Azure login + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: Sync + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Configure + shell: pwsh + run: cmake -S . -B build + + - name: Build Release + shell: pwsh + run: cmake --build build --config Release + + - name: Sign with Trusted Signing + uses: azure/trusted-signing-action@v0.5.0 + with: + endpoint: https://eus.codesigning.azure.net/ + trusted-signing-account-name: dmytro-bulatov-sign + certificate-profile-name: dmytro-bulatov + files: | + ./build/Release/D3d12info.exe + ./build/Release/D3d12info_preview.exe + file-digest: SHA256 + timestamp-rfc3161: http://timestamp.acs.microsoft.com + timestamp-digest: SHA256 + exclude-environment-credential: true + exclude-workload-identity-credential: true + exclude-managed-identity-credential: true + exclude-shared-token-cache-credential: true + exclude-visual-studio-credential: true + exclude-visual-studio-code-credential: true + exclude-azure-cli-credential: false + exclude-azure-powershell-credential: true + exclude-azure-developer-cli-credential: true + exclude-interactive-browser-credential: true + + - name: Prepare Package + shell: pwsh + run: | + $PackagePath = "./package/D3d12info" + New-Item -ItemType Directory -Path $PackagePath + Copy-Item -Path "./build/Release/*" -Destination $PackagePath -Recurse -Exclude *.lib, *.exp + Copy-Item -Path "./LICENSE.txt" -Destination $PackagePath + Copy-Item -Path "./CHANGELOG.md" -Destination $PackagePath + Copy-Item -Path "./D3d12info on GitHub.url" -Destination $PackagePath + + - name: Upload Package + uses: actions/upload-artifact@v4 + with: + name: D3d12info + path: | + ./package/ diff --git a/.gitignore b/.gitignore index 84c048a..83b4f06 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /build/ +/package/ From 403429a833d527a886266ced5bdcd4d09724419f Mon Sep 17 00:00:00 2001 From: Dmytro Bulatov Date: Mon, 18 Nov 2024 03:38:35 +0900 Subject: [PATCH 4/4] Fixed signing step. Increased compression level. --- .github/workflows/Package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Package.yml b/.github/workflows/Package.yml index 60eaaca..2880213 100644 --- a/.github/workflows/Package.yml +++ b/.github/workflows/Package.yml @@ -42,8 +42,8 @@ jobs: trusted-signing-account-name: dmytro-bulatov-sign certificate-profile-name: dmytro-bulatov files: | - ./build/Release/D3d12info.exe - ./build/Release/D3d12info_preview.exe + ${{ github.workspace }}/build/Release/D3d12info.exe + ${{ github.workspace }}/build/Release/D3d12info_preview.exe file-digest: SHA256 timestamp-rfc3161: http://timestamp.acs.microsoft.com timestamp-digest: SHA256 @@ -72,5 +72,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: D3d12info - path: | - ./package/ + path: ./package/ + compression-level: 9