From f5868b65f089eb9bdd31247e7f0266b74f4584aa Mon Sep 17 00:00:00 2001 From: MihailRis Date: Fri, 5 Dec 2025 22:11:47 +0300 Subject: [PATCH] add build info to release (#725) * attempt to add VC_BUILD_NAME * fix * fix * update macos.yml * fix * update macos.yml * update macos.yml * add debug step * update * update * fix release.yml * update cmake * update WindowControl.cpp * update workflows * update release.yml * add --output-always * cleanup --- .github/workflows/appimage.yml | 7 ++++++- .github/workflows/macos.yml | 7 ++++++- .github/workflows/release.yml | 15 +++++++++++++++ .github/workflows/windows-clang.yml | 7 ++++++- CMakeLists.txt | 2 ++ src/engine/WindowControl.cpp | 4 ++++ src/main.cpp | 4 ++++ 7 files changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 9fd508b9..9c943bca 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -6,6 +6,11 @@ on: pull_request: branches: [ "main", "dev" ] workflow_call: + inputs: + build_name: + required: true + type: string + description: 'Build name passed as VC_BUILD_NAME define' jobs: build-appimage: @@ -37,7 +42,7 @@ jobs: sudo make install cd ../.. - name: Configure - run: cmake -S . -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON + run: cmake -S . -B build -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON -DVC_BUILD_NAME="${{ inputs.build_name }}" - name: Build run: cmake --build build -t install - name: Run tests diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index e5d26f2c..99466dda 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -6,6 +6,11 @@ on: pull_request: branches: [ "main", "dev" ] workflow_call: + inputs: + build_name: + required: true + type: string + description: 'Build name passed as VC_BUILD_NAME define' jobs: build-dmg: @@ -21,7 +26,7 @@ jobs: brew install glfw3 glew libpng openal-soft luajit libvorbis skypjack/entt/entt googletest glm - name: Configure - run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_APPDIR=1 + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_TESTS=ON -DVOXELENGINE_BUILD_APPDIR=1 -DVC_BUILD_NAME="${{ inputs.build_name }}" - name: Build run: cmake --build build -t install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 46772820..8a1d17c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,12 +10,27 @@ env: RELEASE_VERSION: ${{ github.event.inputs.version || 'testrelease' }} BRANCH_NAME: ${{ github.event_name == 'workflow_dispatch' && github.ref_name || 'main' }} jobs: + prepare: + runs-on: ubuntu-latest + steps: + - run: echo "exists just for outputs" + outputs: + build_name: '${{ env.RELEASE_VERSION }}' build_linux: + needs: [prepare] uses: ./.github/workflows/appimage.yml + with: + build_name: '${{ needs.prepare.outputs.build_name }}' build_macos: + needs: [prepare] uses: ./.github/workflows/macos.yml + with: + build_name: '${{ needs.prepare.outputs.build_name }}' build_windows: + needs: [prepare] uses: ./.github/workflows/windows-clang.yml + with: + build_name: '${{ needs.prepare.outputs.build_name }}' publish_release: runs-on: ubuntu-latest needs: [build_linux, build_macos, build_windows] diff --git a/.github/workflows/windows-clang.yml b/.github/workflows/windows-clang.yml index 40ebca9d..af0b060a 100644 --- a/.github/workflows/windows-clang.yml +++ b/.github/workflows/windows-clang.yml @@ -6,6 +6,11 @@ on: pull_request: branches: [ "main", "dev" ] workflow_call: + inputs: + build_name: + required: true + type: string + description: 'Build name passed as VC_BUILD_NAME define' jobs: build-windows: @@ -48,7 +53,7 @@ jobs: export VCPKG_ROOT=$(pwd)/vcpkg mkdir build cd build - cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake .. + cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVC_BUILD_NAME="${{ inputs.build_name }}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake .. cmake --build . --config Release - name: Package for Windows run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 6966e81f..27a9d507 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ execute_process(COMMAND ${CMAKE_COMMAND} --version) option(VOXELENGINE_BUILD_APPDIR "Pack linux build" OFF) option(VOXELENGINE_BUILD_TESTS "Build tests" OFF) +add_compile_definitions(VC_BUILD_NAME="${VC_BUILD_NAME}") + # Need for static compilation on Windows with MSVC clang TODO: Make single build # on Windows to avoid dependence on combinations of platforms and compilers and # make it independent diff --git a/src/engine/WindowControl.cpp b/src/engine/WindowControl.cpp index a93c1599..2126378f 100644 --- a/src/engine/WindowControl.cpp +++ b/src/engine/WindowControl.cpp @@ -37,8 +37,12 @@ WindowControl::Result WindowControl::initialize() { title += " - "; } title += "VoxelCore v" + +#ifdef VC_BUILD_NAME + std::string(VC_BUILD_NAME); +#else std::to_string(ENGINE_VERSION_MAJOR) + "." + std::to_string(ENGINE_VERSION_MINOR); +#endif if (ENGINE_DEBUG_BUILD) { title += " [debug]"; } diff --git a/src/main.cpp b/src/main.cpp index 256818c3..ea6ad550 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,6 +14,10 @@ static void sigterm_handler(int signum) { } int main(int argc, char** argv) { +#ifdef VC_BUILD_NAME + logger.info() << "build: " << VC_BUILD_NAME; +#endif + CoreParameters coreParameters; try { if (!parse_cmdline(argc, argv, coreParameters)) {