CMake: add SOURCESDK_COMPILE_PROTOBUF
option
#190
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build on Windows | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- '.github/workflows/build-windows.yml' | |
- 'cmake/**' | |
- 'common/**' | |
- 'devtools/bin/win64/**' | |
- 'entity2/**' | |
- 'game/server/**' | |
- 'game/shared/**' | |
- 'gcsdk/**' | |
- 'interfaces/**' | |
- 'lib/win64/**' | |
- 'mathlib/**' | |
- 'public/**' | |
- 'thirdparty/**' | |
- 'tier1/**' | |
- 'CMakeGameManifests.json' | |
- 'CMakeLists.txt' | |
- 'CMakePresets.json' | |
- 'trigger-build.txt' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- '.github/workflows/build-windows.yml' | |
- 'cmake/**' | |
- 'common/**' | |
- 'devtools/bin/win64/**' | |
- 'entity2/**' | |
- 'game/server/**' | |
- 'game/shared/**' | |
- 'interfaces/**' | |
- 'lib/win64/**' | |
- 'mathlib/**' | |
- 'public/**' | |
- 'thirdparty/**' | |
- 'tier1/**' | |
- 'CMakeGameManifests.json' | |
- 'CMakeLists.txt' | |
- 'CMakePresets.json' | |
- 'trigger-build.txt' | |
env: | |
CMAKE_DEBUG_PRESET_NAME: VisualStudio/Debug | |
CMAKE_DEBUG_PRESET_PUBLIC_NAME: Debug | |
CMAKE_DEBUG_CONFIG_NAME: Debug | |
CMAKE_DEBUG_OUTPUT_PATTERN: build/Windows/VisualStudio/Debug/Debug/* | |
CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_NAME: VisualStudio/RelWithDebInfo | |
CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_PUBLIC_NAME: RelWithDebInfo | |
CMAKE_RELEASE_WITH_DEBUG_INFO_CONFIG_NAME: Debug | |
CMAKE_RELEASE_WITH_DEBUG_INFO_OUTPUT_PATTERN: build/Windows/VisualStudio/RelWithDebInfo/Debug/* | |
CMAKE_RELEASE_PRESET_NAME: VisualStudio/Release | |
CMAKE_RELEASE_PRESET_PUBLIC_NAME: Release | |
CMAKE_RELEASE_CONFIG_NAME: Release | |
CMAKE_RELEASE_OUTPUT_PATTERN: build/Windows/VisualStudio/Release/Release/* | |
SOURCESDK_MALLOC_OVERRIDE: ON | |
MSVC_CC: cl | |
MSVC_CXX: cl | |
MSVC_NAME: MSVC | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Set up environment variables | |
run: | | |
echo "REPOSITORY_NAME=$(basename ${env:GITHUB_REPOSITORY})" | Out-File -FilePath $env:GITHUB_ENV -Append | |
echo "ABSOLUTE_PATH=${env:GITHUB_WORKSPACE}" | Out-File -FilePath $env:GITHUB_ENV -Append | |
shell: pwsh | |
- name: Configure Git to treat current directory as safe | |
run: git config --global --add safe.directory $env:GITHUB_WORKSPACE | |
shell: pwsh | |
- name: Get latest tag | |
id: get-latest-tag | |
run: | | |
if ((git tag) -eq $null) { | |
echo "No tags found" | |
echo "LATEST_TAG=none" | Out-File -FilePath $env:GITHUB_ENV -Append | |
} else { | |
$LATEST_TAG = git describe --tags (git rev-list --tags --max-count=1) | |
echo "LATEST_TAG=$LATEST_TAG" | Out-File -FilePath $env:GITHUB_ENV -Append | |
} | |
shell: pwsh | |
- name: Debug - Configure CMake | |
run: > | |
cmake --preset ${{ env.CMAKE_DEBUG_PRESET_NAME }} | |
-DCMAKE_C_COMPILER=${{ env.MSVC_CC }} | |
-DCMAKE_CXX_COMPILER=${{ env.MSVC_CXX }} | |
-DSOURCESDK_MALLOC_OVERRIDE=${{ env.SOURCESDK_MALLOC_OVERRIDE }} | |
- name: Debug - Build | |
run: cmake --build --preset ${{ env.CMAKE_DEBUG_PRESET_NAME }} --parallel --config ${{ env.CMAKE_DEBUG_CONFIG_NAME }} | |
- name: Debug - Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.REPOSITORY_NAME }}-${{ env.LATEST_TAG }}-${{ runner.os }}-${{ env.MSVC_NAME }}-${{ env.CMAKE_DEBUG_PRESET_PUBLIC_NAME }} | |
path: ${{ env.CMAKE_DEBUG_OUTPUT_PATTERN }} | |
- name: Release With Debug Info - Configure CMake | |
run: > | |
cmake --preset ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_NAME }} | |
-DCMAKE_C_COMPILER=${{ env.MSVC_CC }} | |
-DCMAKE_CXX_COMPILER=${{ env.MSVC_CXX }} | |
-DSOURCESDK_MALLOC_OVERRIDE=${{ env.SOURCESDK_MALLOC_OVERRIDE }} | |
- name: Release With Debug Info - Build | |
run: cmake --build --preset ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_NAME }} --parallel --config ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_CONFIG_NAME }} | |
- name: Release With Debug Info - Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.REPOSITORY_NAME }}-${{ env.LATEST_TAG }}-${{ runner.os }}-${{ env.MSVC_NAME }}-${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_PRESET_PUBLIC_NAME }} | |
path: ${{ env.CMAKE_RELEASE_WITH_DEBUG_INFO_OUTPUT_PATTERN }} | |
- name: Release - Configure CMake | |
run: > | |
cmake --preset ${{ env.CMAKE_RELEASE_PRESET_NAME }} | |
-DCMAKE_C_COMPILER=${{ env.MSVC_CC }} | |
-DCMAKE_CXX_COMPILER=${{ env.MSVC_CXX }} | |
-DSOURCESDK_MALLOC_OVERRIDE=${{ env.SOURCESDK_MALLOC_OVERRIDE }} | |
- name: Release - Build | |
run: cmake --build --preset ${{ env.CMAKE_RELEASE_PRESET_NAME }} --parallel --config ${{ env.CMAKE_RELEASE_CONFIG_NAME }} | |
- name: Release - Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.REPOSITORY_NAME }}-${{ env.LATEST_TAG }}-${{ runner.os }}-${{ env.MSVC_NAME }}-${{ env.CMAKE_RELEASE_PRESET_PUBLIC_NAME }} | |
path: ${{ env.CMAKE_RELEASE_OUTPUT_PATTERN }} |