diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 06726e02c..2d53bff55 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,7 +86,10 @@ jobs: - name: C extension test run: gem install json -v 2.2.0 - name: C extension test with vcpkg libraries (mswin) - run: gem install fiddle -v 1.1.8 + run: gem install fiddle:1.1.8 zlib:3.2.4 + if: matrix.ruby == 'mswin' + - name: Load C extensions linked to vcpkg libraries (mswin) + run: ruby -rfiddle -e 'gem %q(zlib), %q(3.2.4); require %q(zlib); p Zlib.crc32(%q(a))' if: matrix.ruby == 'mswin' - run: bundle --version # This step is redundant with `bundler-cache: true` but is there to check a redundant `bundle install` still works diff --git a/dist/index.js b/dist/index.js index 6cce5be2a..58542e1f5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -46326,22 +46326,22 @@ async function installVCPKG(url) { return exportCommandEnv(`set "MAKE=nmake" && "${vcVars}"`) }) + const vcpkgDir = `${extractPath}\\installed\\${os.arch()}-windows` await core.group('Setting up vcpkg', async () => { // mswin Rubies do not record the vcpkg location in configure_args, so the compiler and linker find it through INCLUDE and LIB - const vcpkgDir = `${extractPath}\\installed\\${os.arch()}-windows` exportEnv({ INCLUDE: `${vcpkgDir}\\include;${process.env.INCLUDE}`, LIB: `${vcpkgDir}\\lib;${process.env.LIB}` }) - // Without these, mkmf runs the MSYS2 pkg-config on PATH, whose MinGW flags break MSVC builds, and pkgconf only searches the missing tools\lib\pkgconfig + // Otherwise mkmf runs the MSYS2 pkg-config, whose MinGW flags break MSVC builds. mkmf accepts an absolute PKG_CONFIG only with forward slashes, and pkgconf alone searches just the missing tools\lib\pkgconfig exportEnv({ - PKG_CONFIG: `${vcpkgDir}\\tools\\pkgconf\\pkgconf.exe`, + PKG_CONFIG: `${vcpkgDir}\\tools\\pkgconf\\pkgconf.exe`.replaceAll('\\', '/'), PKG_CONFIG_PATH: `${vcpkgDir}\\lib\\pkgconfig` }) }) - return paths + return [...paths, `${vcpkgDir}\\bin`] } // Run a cmd command, export its environment, and return new paths diff --git a/windows.js b/windows.js index 1e9b5cd5d..e76140688 100644 --- a/windows.js +++ b/windows.js @@ -227,22 +227,22 @@ async function installVCPKG(url) { return exportCommandEnv(`set "MAKE=nmake" && "${vcVars}"`) }) + const vcpkgDir = `${extractPath}\\installed\\${os.arch()}-windows` await core.group('Setting up vcpkg', async () => { // mswin Rubies do not record the vcpkg location in configure_args, so the compiler and linker find it through INCLUDE and LIB - const vcpkgDir = `${extractPath}\\installed\\${os.arch()}-windows` exportEnv({ INCLUDE: `${vcpkgDir}\\include;${process.env.INCLUDE}`, LIB: `${vcpkgDir}\\lib;${process.env.LIB}` }) - // Without these, mkmf runs the MSYS2 pkg-config on PATH, whose MinGW flags break MSVC builds, and pkgconf only searches the missing tools\lib\pkgconfig + // Otherwise mkmf runs the MSYS2 pkg-config, whose MinGW flags break MSVC builds. mkmf accepts an absolute PKG_CONFIG only with forward slashes, and pkgconf alone searches just the missing tools\lib\pkgconfig exportEnv({ - PKG_CONFIG: `${vcpkgDir}\\tools\\pkgconf\\pkgconf.exe`, + PKG_CONFIG: `${vcpkgDir}\\tools\\pkgconf\\pkgconf.exe`.replaceAll('\\', '/'), PKG_CONFIG_PATH: `${vcpkgDir}\\lib\\pkgconfig` }) }) - return paths + return [...paths, `${vcpkgDir}\\bin`] } // Run a cmd command, export its environment, and return new paths