Skip to content

Commit

Permalink
Merge pull request #845 from stephengtuggy/fix/844_on_master
Browse files Browse the repository at this point in the history
Adjust vcpkg baseline, etc. to fix backdoored liblzma issue
  • Loading branch information
stephengtuggy authored Apr 23, 2024
2 parents 2eacb16 + b2b085f commit c83efb1
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 49 deletions.
58 changes: 31 additions & 27 deletions .github/workflows/Windows-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,58 +33,62 @@ jobs:
VCPKG_ROOT: '${{ github.workspace }}/v'
# Tells vcpkg where binary packages are stored.
VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/vbincache'
## Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
#VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
VCPKG_BINARY_SOURCES: 'x-gha,readwrite'
VCPKG_DEFAULT_TRIPLET: x64-windows
VCPKG_DEFAULT_HOST_TRIPLET: x64-windows
PYTHONHOME: '${{ github.workspace }}/v/packages/python3_x64-windows/tools/python3'

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage
# for Binary Caching.
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 #v6.4.1
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3

- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1.0
with:
python-version: 3.11

- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
shell: bash

- name: install-cmake
uses: lukka/get-cmake@359fbae4b163fa01633e6de228fa7f2a31ab1fc7 #v3.26.1
uses: lukka/get-cmake@4931ab1fc1604964c055eb330edb3f6b26ba0cfa #v3.29.2
with:
cmakeVersion: 3.26.1
cmakeVersion: 3.29.2
ninjaVersion: 1.11.1

# # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# # when it is being run afterward by CMake.
# - name: restore-vcpkg
# uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 #v3.3.1
# with:
# # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# # The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
# path: |
# ${{ env.VCPKG_ROOT }}
# !${{ env.VCPKG_ROOT }}/buildtrees
# !${{ env.VCPKG_ROOT }}/packages
# !${{ env.VCPKG_ROOT }}/downloads
# !${{ env.VCPKG_ROOT }}/installed
# # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
# key: |
# ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
# when it is being run afterward by CMake.
- name: restore-vcpkg
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 #v4.0.2
with:
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages.
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ matrix.os }}-${{ hashFiles( './engine/vcpkg.json' )}}
- name: install-vcpkg
#if: steps.cache.outputs.cache-hit != 'true'
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/vegastrike/vcpkg-local.git ${{ env.VCPKG_ROOT }}
git clone https://github.com/Microsoft/vcpkg.git ${{ env.VCPKG_ROOT }}
${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics
- name: run-build-script
Expand All @@ -99,7 +103,7 @@ jobs:
run: .\script\test.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }}

- name: Upload test results
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 #v4.3.3
if: failure()
with:
name: test_results_xml
Expand Down
17 changes: 11 additions & 6 deletions engine/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,17 @@
"displayName": "Windows Default",
"description": "Default build for Windows",
"environment": {
"VCPKG_DEFAULT_TRIPLET": "x64-windows",
"VCPKG_DEFAULT_HOST_TRIPLET": "x64-windows",
"VCPKG_TARGET_TRIPLET": "x64-windows",
"VCPKG_HOST_TRIPLET": "x64-windows"
"VCPKG_TARGET_TRIPLET": "x64-windows-win10",
"VCPKG_HOST_TRIPLET": "x64-windows-win10"
},
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"VCPKG_TARGET_TRIPLET": "x64-windows-win10",
"VCPKG_HOST_TRIPLET": "x64-windows-win10"
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"debug": {
"output": true,
"find": true
Expand Down Expand Up @@ -326,7 +331,7 @@
"hidden": true,
"inherits": "windows-default",
"displayName": "Ninja on Windows",
"generator": "Ninja",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
Expand Down
6 changes: 6 additions & 0 deletions engine/custom-triplets/x64-windows-win10.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)

set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} /DBOOST_ALL_DYN_LINK /DBOOST_USE_WINAPI_VERSION=0x0A00 /D_WIN32_WINNT=0x0A00 /DWINVER=0x0A00")
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} /DBOOST_ALL_DYN_LINK /DBOOST_USE_WINAPI_VERSION=0x0A00 /D_WIN32_WINNT=0x0A00 /DWINVER=0x0A00")
6 changes: 1 addition & 5 deletions engine/vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
"default-registry": {
"kind": "git",
"baseline": "45c660987c371515ddcc5c355e7989c0d652b85f",
"repository": "https://github.com/vegastrike/vcpkg-local"
}
"overlay-triplets": [ "./custom-triplets" ]
}
4 changes: 3 additions & 1 deletion engine/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "vega-strike",
"version-string": "0.9.0",
"builtin-baseline": "da4b78d35084ec4e9808aa02017028da03b8d2ab",
"dependencies": [
"boost-python",
"boost-log",
Expand All @@ -13,14 +14,15 @@
"boost-chrono",
"boost-atomic",
"boost-assign",
"boost-format",
"egl-registry",
"expat",
"freeglut",
"libpng",
"libjpeg-turbo",
"libvorbis",
"openal-soft",
"opengl",
"opengl-registry",
"openssl",
"sdl1",
"sdl2",
Expand Down
20 changes: 10 additions & 10 deletions script/bootstrap.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# bootstrap.ps1

# Copyright (C) 2021-2023 Stephen G. Tuggy and other Vega Strike contributors
# Copyright (C) 2021-2024 Stephen G. Tuggy and other Vega Strike contributors

# https://github.com/vegastrike/Vega-Strike-Engine-Source

Expand All @@ -13,11 +13,11 @@

# Vega Strike is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.
# along with Vega Strike. If not, see <https://www.gnu.org/licenses/>.


# You can customize this directory location if desired, but it should be
Expand All @@ -26,18 +26,18 @@ param(
[String]$VCPKG_PARENT_DIR = "C:\Projects"
)

Set-Variable -Name CMAKE_VERSION -Value "3.26.1"
Set-Variable -Name CMAKE_VERSION -Value "3.29.2"

New-Item "$VCKPG_PARENT_DIR" -ItemType Directory -Force
Push-Location "$VCKPG_PARENT_DIR"
New-Item "$VCPKG_PARENT_DIR" -ItemType Directory -Force
Push-Location "$VCPKG_PARENT_DIR"
git clone https://github.com/vegastrike/vcpkg-local.git ./v
.\v\bootstrap-vcpkg.bat -disableMetrics

[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCKPG_PARENT_DIR\v", 'User')
$env:VCPKG_ROOT = "$VCKPG_PARENT_DIR\v"
[Environment]::SetEnvironmentVariable('VCPKG_ROOT', "$VCPKG_PARENT_DIR\v", 'User')
$env:VCPKG_ROOT = "$VCPKG_PARENT_DIR\v"

$path = [Environment]::GetEnvironmentVariable('PATH', 'User')
$newPath = $path + ";$VCKPG_PARENT_DIR\v\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin"
$newPath = $path + ";$VCPKG_PARENT_DIR\v\downloads\tools\cmake-$CMAKE_VERSION-windows\cmake-$CMAKE_VERSION-windows-i386\bin"
[Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')
$env:PATH = $newPath

Expand All @@ -47,7 +47,7 @@ $env:VCPKG_DEFAULT_TRIPLET = $triplet
[Environment]::SetEnvironmentVariable('VCPKG_DEFAULT_HOST_TRIPLET', $triplet, 'User')
$env:VCPKG_DEFAULT_HOST_TRIPLET = $triplet

$pythonHome = "$VCKPG_PARENT_DIR\v\packages\python3_x64-windows\tools\python3"
$pythonHome = "$VCPKG_PARENT_DIR\v\packages\python3_x64-windows\tools\python3"
[Environment]::SetEnvironmentVariable('PYTHONHOME', $pythonHome, 'User')
$env:PYTHONHOME = $pythonHome

Expand Down

0 comments on commit c83efb1

Please sign in to comment.