summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/fpc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-02 23:42:22 +0800
committerruki <[email protected]>2021-09-02 23:42:22 +0800
commit13acaccc305ef18631601d1d23bfae1c9faef490 (patch)
tree9c665bf60cdcd8ff34b8670e6323dcaaf01dcb5a /xmake/modules/core/tools/fpc.lua
parent684ba799f95d3f8832a9e220ce2743aa2ecb505f (diff)
add rpath for pascal
Diffstat (limited to 'xmake/modules/core/tools/fpc.lua')
-rw-r--r--xmake/modules/core/tools/fpc.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/fpc.lua b/xmake/modules/core/tools/fpc.lua
index 7062228cc..0f2d3025f 100644
--- a/xmake/modules/core/tools/fpc.lua
+++ b/xmake/modules/core/tools/fpc.lua
@@ -29,10 +29,33 @@ end
-- make the optimize flag
function nf_optimize(self, level)
+ local maps =
+ {
+ none = "-O-"
+ , fast = "-O1"
+ , fastest = "-O3"
+ , smallest = "-O2"
+ , aggressive = "-O4"
+ }
+ return maps[level]
+end
+
+-- make the strip flag
+function nf_strip(self, level)
+ if level == "all" then
+ return "-Xs"
+ end
end
-- make the symbol flag
function nf_symbol(self, level)
+ if level == "debug" and self:kind() == "pc" then
+ if self:plat() == "windows" then
+ return {"-gw3", "-WN"}
+ else
+ return "-gw3"
+ end
+ end
end
-- make the link flag
@@ -50,6 +73,27 @@ function nf_linkdir(self, dir)
return {"-k-L" .. dir}
end
+-- make the rpathdir flag
+function nf_rpathdir(self, dir)
+ dir = path.translate(dir)
+ if self:has_flags("-k,-rpath=" .. dir, "ldflags") then
+ return {"-k,-rpath=" .. (dir:gsub("@[%w_]+", function (name)
+ local maps = {["@loader_path"] = "$ORIGIN", ["@executable_path"] = "$ORIGIN"}
+ return maps[name]
+ end))}
+ end
+end
+
+-- make the framework flag
+function nf_framework(self, framework)
+ return {"-k-framework", framework}
+end
+
+-- make the frameworkdir flag
+function nf_frameworkdir(self, frameworkdir)
+ return {"-k-F", path.translate(frameworkdir)}
+end
+
-- make the build arguments list
function buildargv(self, sourcefiles, targetkind, targetfile, flags)
return self:program(), table.join(flags, "-o" .. targetfile, sourcefiles)