summaryrefslogtreecommitdiff
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
parent684ba799f95d3f8832a9e220ce2743aa2ecb505f (diff)
add rpath for pascal
-rw-r--r--xmake/languages/pascal/load.lua10
-rw-r--r--xmake/languages/pascal/xmake.lua24
-rw-r--r--xmake/modules/core/tools/fpc.lua44
-rw-r--r--xmake/modules/core/tools/zig.lua1
4 files changed, 55 insertions, 24 deletions
diff --git a/xmake/languages/pascal/load.lua b/xmake/languages/pascal/load.lua
index 997fc504a..6a1f1ca5b 100644
--- a/xmake/languages/pascal/load.lua
+++ b/xmake/languages/pascal/load.lua
@@ -23,6 +23,7 @@ function _get_apis()
apis.values = {
-- target.add_xxx
"target.add_links"
+ , "target.add_frameworks"
, "target.add_syslinks"
, "target.add_pcflags"
, "target.add_ldflags"
@@ -46,8 +47,6 @@ function _get_apis()
, "package.add_shflags"
, "package.add_rpathdirs"
, "package.add_linkdirs"
- , "package.add_includedirs"
- , "package.add_sysincludedirs"
-- toolchain.add_xxx
, "toolchain.add_links"
, "toolchain.add_syslinks"
@@ -57,18 +56,13 @@ function _get_apis()
, "toolchain.add_shflags"
, "toolchain.add_rpathdirs"
, "toolchain.add_linkdirs"
- , "toolchain.add_includedirs"
- , "toolchain.add_sysincludedirs"
}
apis.paths = {
-- target.add_xxx
"target.add_linkdirs"
- , "target.add_includedirs"
- , "target.add_sysincludedirs"
+ , "target.add_frameworkdirs"
-- option.add_xxx
, "option.add_linkdirs"
- , "option.add_includedirs"
- , "option.add_sysincludedirs"
}
return apis
end
diff --git a/xmake/languages/pascal/xmake.lua b/xmake/languages/pascal/xmake.lua
index ba052ef36..a3e1fb5b3 100644
--- a/xmake/languages/pascal/xmake.lua
+++ b/xmake/languages/pascal/xmake.lua
@@ -25,22 +25,17 @@ language("pascal")
set_targetkinds {binary = "pcld", static = "pcar", shared = "pcsh"}
set_targetflags {binary = "ldflags", static = "arflags", shared = "shflags"}
set_langkinds {pascal = "pc"}
- set_mixingkinds("pc", "cc", "cxx", "as")
+ set_mixingkinds("pc")
on_load("load")
on_check_main("check_main")
set_nameflags {
object = {
- "config.includedirs"
- , "target.symbols"
+ "target.symbols"
, "target.warnings"
, "target.optimize:check"
, "target.vectorexts:check"
- , "target.includedirs"
- , "toolchain.includedirs"
- , "target.sysincludedirs"
- , "toolchain.sysincludedirs"
}
, binary = {
"config.linkdirs"
@@ -52,6 +47,8 @@ language("pascal")
, "toolchain.rpathdirs"
, "config.links"
, "target.links"
+ , "target.frameworks"
+ , "target.frameworkdirs"
, "toolchain.links"
, "config.syslinks"
, "target.syslinks"
@@ -65,32 +62,29 @@ language("pascal")
, "toolchain.linkdirs"
, "config.links"
, "target.links"
+ , "target.frameworks"
+ , "target.frameworkdirs"
, "toolchain.links"
, "config.syslinks"
, "target.syslinks"
, "toolchain.syslinks"
}
- , static = {
- "target.strip"
- , "target.symbols"
- }
}
set_menu {
config =
{
{category = "Cross Complation Configuration/Compiler Configuration" }
- , {nil, "pc", "kv", nil, "The Pascal Compiler" }
+ , {nil, "pc", "kv", nil, "The Pascal Compiler" }
, {category = "Cross Complation Configuration/Linker Configuration" }
- , {nil, "pcld", "kv", nil, "The Pascal Linker" }
- , {nil, "pcsh", "kv", nil, "The Pascal Shared Library Linker" }
+ , {nil, "pcld", "kv", nil, "The Pascal Linker" }
+ , {nil, "pcsh", "kv", nil, "The Pascal Shared Library Linker" }
, {category = "Cross Complation Configuration/Builtin Flags Configuration" }
, {nil, "links", "kv", nil, "The Link Libraries" }
, {nil, "syslinks", "kv", nil, "The System Link Libraries" }
, {nil, "linkdirs", "kv", nil, "The Link Search Directories" }
- , {nil, "includedirs","kv", nil, "The Include Search Directories" }
}
}
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)
diff --git a/xmake/modules/core/tools/zig.lua b/xmake/modules/core/tools/zig.lua
index 2270e2a3e..140e1ae0a 100644
--- a/xmake/modules/core/tools/zig.lua
+++ b/xmake/modules/core/tools/zig.lua
@@ -55,7 +55,6 @@ function nf_optimize(self, level)
{
none = "-O Debug"
, fast = "-O ReleaseSafe"
- , aggressive = "-O ReleaseFast"
, fastest = "-O ReleaseFast"
, smallest = "-O ReleaseSmall"
, aggressive = "-O ReleaseFast"