Skip to content

Commit

Permalink
🚑 Fix MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Dec 6, 2024
1 parent 1ea8395 commit c481034
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
- name: Build
run: |
PKG_CONFIG_PATH="$HOME/.nix-profile/lib/pkgconfig" yarn install
ls -Rl build
PKG_CONFIG_PATH="$HOME/.nix-profile/lib/pkgconfig" yarn pack
env:
NODE_ENV: production
Expand Down
20 changes: 7 additions & 13 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ do
target:set("kind", "shared")
end

-- set library name
local modulename = target:name():split('.', { plain = true })
modulename = modulename[#modulename]
target:set("filename", modulename .. ".node")

-- export symbols
if target:is_plat("windows") then
local exported_name = target:name():gsub("%.", "_")
exported_name = exported_name:match('^[^%-]+%-(.+)$') or exported_name
target:add("shflags", "/export:napi_register_module_v1", { force = true })
target:add("shflags", "/export:napi_register_module_v1", "/export:node_api_module_get_api_version_v1",
{ force = true })
else
target:set("symbols", "none")
end
Expand All @@ -44,6 +38,11 @@ do
git.clone("https://github.com/napi-bindings/node-api-stub", { depth = 1, outputdir = outputdir })
end
target:add("files", outputdir .. "/node_api.c")
else
-- set library name
local modulename = target:name():split('.', { plain = true })
modulename = modulename[#modulename]
target:set("filename", modulename .. ".node")
end

-- add node library
Expand Down Expand Up @@ -77,11 +76,6 @@ do
bindir = path.join("lib", moduledir),
includedir = path.join("include", moduledir)
})
if is_plat("mingw") then
local modulename = target:name():split('.', { plain = true })
modulename = modulename[#modulename]
os.mv(installdir .. "/" .. modulename .. ".dll.a", installdir .. "/" .. modulename .. ".node")
end
end)
end

Expand Down

0 comments on commit c481034

Please sign in to comment.