From a5f5d14538fcfa3d077b039ecc993aba0c07d710 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 5 May 2025 11:54:20 -0400 Subject: [PATCH 1/3] build(cmake): fallback to pkg-config discovery for tomlplusplus Some distributions of it (like in vcpkg *wink*) won't contain CMake files Signed-off-by: seth --- CMakeLists.txt | 8 ++++++++ launcher/CMakeLists.txt | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4d6df243..10b0fcd08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -348,6 +348,14 @@ endif() if(NOT Launcher_FORCE_BUNDLED_LIBS) # Find toml++ find_package(tomlplusplus 3.2.0 QUIET) + # Fallback to pkg-config (if available) if CMake files aren't found + if(NOT tomlplusplus_FOUND) + find_package(PkgConfig) + if(PkgConfig_FOUND) + pkg_check_modules(tomlplusplus IMPORTED_TARGET tomlplusplus>=3.2.0) + endif() + endif() + # Find cmark find_package(cmark QUIET) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 6204acabd..7d96ffc38 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1309,12 +1309,16 @@ target_link_libraries(Launcher_logic Launcher_murmur2 nbt++ ${ZLIB_LIBRARIES} - tomlplusplus::tomlplusplus qdcss BuildConfig Qt${QT_VERSION_MAJOR}::Widgets qrcodegenerator ) +if(TARGET PkgConfig::tomlplusplus) + target_link_libraries(Launcher_logic PkgConfig::tomlplusplus) +else() + target_link_libraries(Launcher_logic tomlplusplus::tomlplusplus) +endif() if (UNIX AND NOT CYGWIN AND NOT APPLE) target_link_libraries(Launcher_logic From 7f78f6b85fd2621b3abb36c081d5b07e0b8c81fd Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 1 May 2025 21:04:37 -0400 Subject: [PATCH 2/3] build: add support for vcpkg Signed-off-by: seth --- vcpkg-configuration.json | 14 ++++++++++++++ vcpkg.json | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 vcpkg-configuration.json create mode 100644 vcpkg.json diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 000000000..610f6b31d --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,14 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "0c4cf19224a049cf82f4521e29e39f7bd680440c", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..4abf8d1b7 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,10 @@ +{ + "dependencies": [ + "bzip2", + "cmark", + { "name": "ecm", "host": true }, + { "name": "pkgconf", "host": true }, + "tomlplusplus", + "zlib" + ] +} From 463cf431610a04a3c7ec4a90f4d83389fdbae2c1 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Mon, 5 May 2025 13:00:20 -0400 Subject: [PATCH 3/3] ci(setup-deps/windows): use vcpkg for msvc Signed-off-by: Seth Flynn --- .../setup-dependencies/windows/action.yml | 25 +++++++++++++++++++ .github/workflows/build.yml | 4 +++ 2 files changed, 29 insertions(+) diff --git a/.github/actions/setup-dependencies/windows/action.yml b/.github/actions/setup-dependencies/windows/action.yml index 0a643f583..e899c36d6 100644 --- a/.github/actions/setup-dependencies/windows/action.yml +++ b/.github/actions/setup-dependencies/windows/action.yml @@ -25,6 +25,31 @@ runs: arch: ${{ inputs.vcvars-arch }} vsversion: 2022 + - name: Setup vcpkg cache (MSVC) + if: ${{ inputs.msystem == '' && inputs.build-type == 'Debug' }} + shell: pwsh + env: + USERNAME: ${{ github.repository_owner }} + FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json + run: | + .$(vcpkg fetch nuget) ` + sources add ` + -Source "$env:FEED_URL" ` + -StorePasswordInClearText ` + -Name GitHubPackages ` + -UserName "$env:USERNAME" ` + -Password "$env:GITHUB_TOKEN" + .$(vcpkg fetch nuget) ` + setapikey "$env:GITHUB_TOKEN" ` + -Source "$env:FEED_URL" + Write-Output "VCPKG_BINARY_SOURCES=clear;nuget,$env:FEED_URL,readwrite" >> "$GITHUB_ENV" + + - name: Setup vcpkg environment (MSVC) + if: ${{ inputs.msystem == '' }} + shell: bash + run: | + echo "CMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> "$GITHUB_ENV" + - name: Setup MSYS2 (MinGW) if: ${{ inputs.msystem != '' }} uses: msys2/setup-msys2@v2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 15de6f70f..b8ba57a45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,6 +69,10 @@ jobs: build: name: Build (${{ matrix.artifact-name }}) + permissions: + # Required for vcpkg binary cache + packages: write + strategy: fail-fast: false matrix: