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
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions dist/index.js

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

8 changes: 4 additions & 4 deletions windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('\\', '/'),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should mkmf support either forward slash or backward slash?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should. I'm working on making native builds on mswin work properly, and I'll use this case, where mkmf silently ignores a backslashed absolute PKG_CONFIG, as material to improve mkmf there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed in ruby/ruby#19970, so mkmf now accepts a backslashed absolute PKG_CONFIG on master. Released versions still need the forward slashes here.

PKG_CONFIG_PATH: `${vcpkgDir}\\lib\\pkgconfig`
})
})

return paths
return [...paths, `${vcpkgDir}\\bin`]
}

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