# HG changeset patch # User Patric Stout # Date 2023-12-30 17:00:24 # Node ID 99a1cc03aea06d42019f6eb33d431a720691e6db # Parent bb1633c752358ed462b7fc2e1dc42b11d27b227b 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. diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -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 + ( + 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: | diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -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. - /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] + ( + cd / - # Now we can install OpenTTD dependencies - /vcpkg/vcpkg install \ - breakpad \ - curl[http2] \ - fontconfig \ - freetype \ - harfbuzz \ - icu \ - liblzma \ - libpng \ - lzo \ - sdl2 \ - zlib \ - # EOF + /vcpkg/vcpkg install python3 + ln -sf /vcpkg/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3 + ) echo "::endgroup::" echo "::group::Install breakpad dependencies" diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -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 diff --git a/.github/workflows/release-windows.yml b/.github/workflows/release-windows.yml --- a/.github/workflows/release-windows.yml +++ b/.github/workflows/release-windows.yml @@ -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 diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ docs/aidocs/* docs/gamedocs/* docs/source/* /out +/vcpkg_installed diff --git a/COMPILING.md b/COMPILING.md --- a/COMPILING.md +++ b/COMPILING.md @@ -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. diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,54 @@ +{ + "$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" +}