diff options
| author | Saikari <[email protected]> | 2026-01-30 06:10:58 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-01-30 06:10:58 +0300 |
| commit | 72283d163a02abe02d2e53dd44a6050f80b9e956 (patch) | |
| tree | 41ae7f602316a93d4f88694c033748d09bb1f9d7 | |
| parent | 83ccf8d991d2ad1ed29af150c35f43d1cdd66663 (diff) | |
feat: enable shared configuration for zlib dependency in project
| -rw-r--r-- | tests/projects/nim/link_library/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/nim.lua | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/projects/nim/link_library/xmake.lua b/tests/projects/nim/link_library/xmake.lua index 3965e4140..46fa1bbe8 100644 --- a/tests/projects/nim/link_library/xmake.lua +++ b/tests/projects/nim/link_library/xmake.lua @@ -1,7 +1,7 @@ set_project("link_libs") add_rules("mode.debug", "mode.release") -add_requires("zlib", {system = false}) +add_requires("zlib", {system = false, config = {shared = true}}) add_requires("stb", {system = false}) target("headers") diff --git a/xmake/modules/core/tools/nim.lua b/xmake/modules/core/tools/nim.lua index 15f318b1e..a05d9a346 100644 --- a/xmake/modules/core/tools/nim.lua +++ b/xmake/modules/core/tools/nim.lua @@ -169,7 +169,16 @@ function nf_rpathdir(self, dir, opt) -- Use --passL:"-Wl,-rpath=<dir>" to pass rpath to the linker -- We use standard -Wl,-rpath for gcc/clang on linux/macosx/bsd without check mainly. - if self:is_plat("linux", "macosx", "bsd", "iphoneos", "android") then + if self:is_plat("macosx", "iphoneos") then + dir = dir:gsub("([@$][%w_]+)", function (name) + if name == "$ORIGIN" then + return "@loader_path" + end + return name + end) + local rpath = string.format("-Wl,-rpath,%s", dir) + return {string.format('--passL:"%s"', rpath)} + elseif self:is_plat("linux", "bsd", "android") then dir = dir:gsub("([@$][%w_]+)", function (name) if name == "@loader_path" or name == "@executable_path" then return "\\$ORIGIN" |
