Changeset - r28361:99a1cc03aea0
[Not reviewed]
master
0 6 1
Patric Stout - 11 months ago 2023-12-30 17:00:24
truebrain@openttd.org
Change: add vcpkg.json to instruct vcpkg what dependencies we require

This works on all OSes, making it far simpler for any developer
to jump in. Just install vcpkg, run "vcpkg install" in our root,
and you have all the dependencies.
7 files changed with 76 insertions and 82 deletions:
0 comments (0 inline, 0 general)
.github/workflows/ci-build.yml
Show inline comments
 
@@ -135,9 +135,15 @@ jobs:
 
          zlib1g-dev \
 
          # EOF
 

	
 
        sudo vcpkg install \
 
          breakpad \
 
          # EOF
 
        echo "::group::Install vcpkg dependencies"
 

	
 
        # Disable vcpkg integration, as we mostly use system libraries.
 
        mv vcpkg.json vcpkg-disabled.json
 

	
 
        # We only use breakpad from vcpkg, as its CMake files
 
        # are a bit special. So the Ubuntu's variant doesn't work.
 
        vcpkg install breakpad
 

	
 
        echo "::endgroup::"
 
      env:
 
        DEBIAN_FRONTEND: noninteractive
 
@@ -176,10 +182,15 @@ jobs:
 

	
 
    - name: Test
 
      run: |
 
        (
 
        cd build
 
        ctest -j $(nproc) --timeout 120
 
        )
 

	
 
        # Check no tracked files have been modified
 
        # Re-enable vcpkg.
 
        mv vcpkg-disabled.json vcpkg.json
 

	
 
        # Check no tracked files have been modified.
 
        git diff --exit-code
 

	
 
  macos:
 
@@ -208,17 +219,6 @@ jobs:
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Prepare vcpkg
 
      run: |
 
        vcpkg install --triplet=${{ matrix.arch }}-osx \
 
          breakpad \
 
          curl \
 
          liblzma \
 
          libpng \
 
          lzo \
 
          zlib \
 
          # EOF
 

	
 
    - name: Install OpenGFX
 
      run: |
 
        mkdir -p ~/Documents/OpenTTD/baseset
 
@@ -283,17 +283,6 @@ jobs:
 
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
 
          core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
 

	
 
    - name: Prepare vcpkg
 
      shell: bash
 
      run: |
 
        vcpkg install --triplet=${{ matrix.arch }}-windows-static \
 
          breakpad \
 
          liblzma \
 
          libpng \
 
          lzo \
 
          zlib \
 
          # EOF
 

	
 
    - name: Install OpenGFX
 
      shell: bash
 
      run: |
.github/workflows/release-linux.yml
Show inline comments
 
@@ -132,28 +132,12 @@ jobs:
 
        # Make Python3 available for other packages. This needs to be done
 
        # first, as otherwise dependencies fail to build because Python3 is
 
        # not available.
 
        (
 
          cd /
 

	
 
        /vcpkg/vcpkg install python3
 
        ln -sf /vcpkg/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3
 

	
 
        # SDL2 needs dbus, but dbus default install comes with libsystemd
 
        # and some of libsystemd deps fail to build on our quite old linux.
 
        # So just install basic dbus without any extra deps.
 
        /vcpkg/vcpkg install dbus[core]
 

	
 
        # Now we can install OpenTTD dependencies
 
        /vcpkg/vcpkg install \
 
          breakpad \
 
          curl[http2] \
 
          fontconfig \
 
          freetype \
 
          harfbuzz \
 
          icu \
 
          liblzma \
 
          libpng \
 
          lzo \
 
          sdl2 \
 
          zlib \
 
          # EOF
 
        )
 
        echo "::endgroup::"
 

	
 
        echo "::group::Install breakpad dependencies"
.github/workflows/release-macos.yml
Show inline comments
 
@@ -55,23 +55,6 @@ jobs:
 
        cargo install dump_syms
 
        echo "::endgroup::"
 

	
 
    - name: Prepare vcpkg
 
      run: |
 
        vcpkg install \
 
          breakpad:x64-osx \
 
          breakpad:arm64-osx \
 
          curl:x64-osx \
 
          curl:arm64-osx \
 
          liblzma:x64-osx \
 
          liblzma:arm64-osx \
 
          libpng:x64-osx \
 
          libpng:arm64-osx \
 
          lzo:x64-osx \
 
          lzo:arm64-osx \
 
          zlib:x64-osx \
 
          zlib:arm64-osx \
 
          # EOF
 

	
 
    - name: Install GCC problem matcher
 
      uses: ammaraskar/gcc-problem-matcher@master
 

	
.github/workflows/release-windows.yml
Show inline comments
 
@@ -64,23 +64,6 @@ jobs:
 
        cargo install dump_syms
 
        echo "::endgroup::"
 

	
 
    - name: Prepare vcpkg
 
      shell: bash
 
      run: |
 
        vcpkg install --triplet=${{ matrix.arch }}-windows-static \
 
          liblzma \
 
          libpng \
 
          lzo \
 
          zlib \
 
          # EOF
 

	
 
        # arm64-windows-static is not (yet) supported for breakpad.
 
        if [ "${{ matrix.arch }}" != "arm64" ]; then
 
          vcpkg install --triplet=${{ matrix.arch }}-windows-static \
 
            breakpad \
 
            # EOF
 
        fi
 

	
 
    - name: Install MSVC problem matcher
 
      uses: ammaraskar/msvc-problem-matcher@master
 

	
.gitignore
Show inline comments
 
@@ -5,3 +5,4 @@ docs/aidocs/*
 
docs/gamedocs/*
 
docs/source/*
 
/out
 
/vcpkg_installed
COMPILING.md
Show inline comments
 
@@ -59,8 +59,8 @@ the `static` versions, and OpenTTD curre
 
To install both the x64 (64bit) and x86 (32bit) variants (though only one is necessary), you can use:
 

	
 
```ps
 
.\vcpkg install breakpad:x64-windows-static liblzma:x64-windows-static libpng:x64-windows-static lzo:x64-windows-static zlib:x64-windows-static
 
.\vcpkg install breakpad:x86-windows-static liblzma:x86-windows-static libpng:x86-windows-static lzo:x86-windows-static zlib:x86-windows-static
 
.\vcpkg install --triplet=x64-windows-static
 
.\vcpkg install --triplet=x86-windows-static
 
```
 

	
 
You can open the folder (as a CMake project). CMake will be detected, and you can compile from there.
vcpkg.json
Show inline comments
 
new file 100644
 
{
 
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
 
  "dependencies": [
 
    {
 
      "name": "breakpad",
 
      "platform": "!(windows & arm)"
 
    },
 
    {
 
      "name": "curl",
 
      "platform": "linux",
 
      "features": [
 
        "http2"
 
      ]
 
    },
 
    {
 
      "name": "dbus",
 
      "platform": "linux",
 
      "default-features": false
 
    },
 
    {
 
      "name": "fontconfig",
 
      "platform": "linux"
 
    },
 
    {
 
      "name": "freetype",
 
      "platform": "linux"
 
    },
 
    {
 
      "name": "harfbuzz",
 
      "platform": "linux"
 
    },
 
    {
 
      "name": "icu",
 
      "platform": "linux"
 
    },
 
    {
 
      "name": "liblzma"
 
    },
 
    {
 
      "name": "libpng"
 
    },
 
    {
 
      "name": "lzo"
 
    },
 
    {
 
      "name": "sdl2",
 
      "platform": "linux"
 
    },
 
    {
 
      "name": "zlib"
 
    }
 
  ],
 
  "builtin-baseline": "94cf042e6b7713913a3b3150f3ca3d0f4550f7c4"
 
}
0 comments (0 inline, 0 general)