diff --git a/.github/workflows/win-deploy.yml b/.github/workflows/win-deploy.yml index a68ed09..fff1548 100644 --- a/.github/workflows/win-deploy.yml +++ b/.github/workflows/win-deploy.yml @@ -1,11 +1,14 @@ name: Windows Deploy +env: + PACKAGE_NAME: engine-${{ github.ref_name }}-windows-mingw-x64.zip + on: push: branches: - - main + - '**' tags: - - 'v[0-9]+.[0-9]+.[0-9]+*' + - '**' workflow_dispatch: permissions: @@ -113,19 +116,17 @@ jobs: - name: Compress artifact run: | - $zipName = "engine-${{ github.ref_name }}-windows-mingw-x64.zip" - Compress-Archive -Path dist/engine-windows/* -DestinationPath $zipName - + Compress-Archive -Path dist/engine-windows/* -DestinationPath $env:PACKAGE_NAME + - name: Upload artifact uses: actions/upload-artifact@v4 with: name: windows-release-artifact - path: engine-v*-windows-mingw-x64.zip + path: ${{ env.PACKAGE_NAME }} if-no-files-found: error release-github: name: Create GitHub Release - if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: [build-windows] @@ -134,11 +135,26 @@ jobs: uses: actions/download-artifact@v4 with: name: windows-release-artifact + path: windows-release-artifact + + - name: Determine release metadata + id: meta + run: | + if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then + echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" + echo "name=Release ${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" + else + echo "tag=push-${GITHUB_RUN_ID}" >> "$GITHUB_OUTPUT" + echo "name=Automated release for ${GITHUB_REF_NAME} (run #${GITHUB_RUN_NUMBER})" >> "$GITHUB_OUTPUT" + fi - name: Create Release and Upload Assets uses: softprops/action-gh-release@v2 with: - files: engine-v*-windows-mingw-x64.zip + tag_name: ${{ steps.meta.outputs.tag }} + name: ${{ steps.meta.outputs.name }} + files: windows-release-artifact/${{ env.PACKAGE_NAME }} + target_commitish: ${{ github.sha }} draft: false generate_release_notes: true env: diff --git a/cmake/CompileProtobuf.cmake b/cmake/CompileProtobuf.cmake index c2f4c22..6e0c1d0 100644 --- a/cmake/CompileProtobuf.cmake +++ b/cmake/CompileProtobuf.cmake @@ -28,6 +28,10 @@ function(define_proto_generation_target TARGET_NAME PROTO_SRC_DIR OUT_DIR) list(APPEND GENERATED_HDRS ${proto_hdr}) endforeach() + # Mark generated sources so CMake does not expect them to exist at configure time + set_source_files_properties(${GENERATED_SRCS} ${GENERATED_HDRS} + PROPERTIES GENERATED TRUE) + add_custom_target(${TARGET_NAME} DEPENDS ${GENERATED_SRCS}) # Export file lists back to parent diff --git a/src/protobuf/CMakeLists.txt b/src/protobuf/CMakeLists.txt index 0fc263a..d69f13c 100644 --- a/src/protobuf/CMakeLists.txt +++ b/src/protobuf/CMakeLists.txt @@ -1,25 +1,12 @@ -# Create a library for the Proto files -add_library(protobuf - ssl_vision_detection.pb.cc - ssl_vision_geometry.pb.cc - ssl_vision_wrapper.pb.cc - - grSim_Packet.pb.cc - grSim_Replacement.pb.cc - grSim_Commands.pb.cc - - ssl_gc_rcon_team.pb.cc - ssl_gc_rcon.pb.cc - ssl_gc_common.pb.cc - - ssl_gc_referee_message.pb.cc - ssl_gc_game_event.pb.cc - ssl_gc_geometry.pb.cc -) +# Create a library for the Proto files generated by the top-level target +add_library(protobuf ${generate_protos_SRCS}) +add_dependencies(protobuf generate_protos) # Include the Protobuf generated headers -target_include_directories(protobuf PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(protobuf PUBLIC + ${PROTO_GEN_DIR} + ${Protobuf_INCLUDE_DIR} +) # Link Protobuf to the library -#find_package(Protobuf REQUIRED) -target_link_libraries(protobuf PUBLIC protobuf::libprotobuf) \ No newline at end of file +target_link_libraries(protobuf PUBLIC ${Protobuf_LIBRARIES}) \ No newline at end of file