Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ jobs:
- run: gem env
- 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
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
- run: bundle install
Expand Down
19 changes: 18 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async function installVCPKG(url) {
await common.measure('Extracting mswin vcpkg packages', async () =>
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${extractPath}`], { silent: true }))

return await common.measure('Setting up MSVC environment', async () => {
const paths = await common.measure('Setting up MSVC environment', async () => {
const cmd = 'vswhere -latest -property installationPath'
const vcVarsBat = os.arch() === 'arm64' ? 'vcvarsarm64.bat' : 'vcvars64.bat'
const vcVars = `${cp.execSync(cmd).toString().trim()}\\VC\\Auxiliary\\Build\\${vcVarsBat}`
Expand All @@ -226,6 +226,23 @@ async function installVCPKG(url) {

return exportCommandEnv(`set "MAKE=nmake" && "${vcVars}"`)
})

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
exportEnv({
PKG_CONFIG: `${vcpkgDir}\\tools\\pkgconf\\pkgconf.exe`,
PKG_CONFIG_PATH: `${vcpkgDir}\\lib\\pkgconfig`
Comment thread
ntkme marked this conversation as resolved.
Resolved
})
Comment thread
ntkme marked this conversation as resolved.
Resolved
})

return paths
}

// Run a cmd command, export its environment, and return new paths
Expand Down
Loading