summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-11-07 22:48:41 +0800
committerruki <[email protected]>2016-11-07 22:48:41 +0800
commitd59184e0fdb61ba2ac326da945e2fa41c412384a (patch)
treeca2fa5c216f3b0cf6862abd8126ed3ed44ddf41c
parentc2f463a161a717fb71ee12281e6715dfcff276e2 (diff)
add configure arguments
-rwxr-xr-xxmake/actions/config/xmake.lua5
-rw-r--r--xmake/core/tool/compiler.lua5
-rw-r--r--xmake/core/tool/linker.lua69
3 files changed, 64 insertions, 15 deletions
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index ee55959c9..8a68d53ea 100755
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -147,6 +147,11 @@ task("config")
, {nil, "shflags", "kv", nil, "The Shared Library Linker Flags" }
, {}
+ , {nil, "links", "kv", nil, "The Link Libraries" }
+ , {nil, "linkdirs", "kv", nil, "The Link Search Directories" }
+ , {nil, "includedirs","kv", nil, "The Include Search Directories" }
+
+ , {}
, {nil, "dd", "kv", "auto", "The Debugger" }
-- show platform menu options
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 00c50ea3f..b11e5c065 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -113,6 +113,11 @@ function compiler:_addflags_from_config(flags)
for _, flagname in ipairs(self:_flagnames()) do
table.join2(flags, config.get(flagname))
end
+
+ -- add the includedirs flags
+ for _, includedir in ipairs(table.wrap(config.get("includedirs"))) do
+ table.join2(flags, self:includedir(includedir))
+ end
end
-- add flags from the target
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index 19430f908..418a150ab 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -126,6 +126,11 @@ function linker:_addflags_from_config(flags)
-- done
table.join2(flags, config.get(self:_flagname()))
+
+ -- add the linkdirs flags
+ for _, linkdir in ipairs(table.wrap(config.get("linkdirs"))) do
+ table.join2(flags, self:linkdir(linkdir))
+ end
end
-- add flags from the target
@@ -139,11 +144,6 @@ function linker:_addflags_from_target(flags, target)
table.join2(flags, self:linkdir(linkdir))
end
- -- add the links flags
- for _, link in ipairs(table.wrap(target:get("links"))) do
- table.join2(flags, self:linklib(link))
- end
-
-- for target options?
if target.options then
@@ -157,11 +157,6 @@ function linker:_addflags_from_target(flags, target)
for _, linkdir in ipairs(table.wrap(opt:get("linkdirs"))) do
table.join2(flags, self:linkdir(linkdir))
end
-
- -- add the links flags from the option
- for _, link in ipairs(table.wrap(opt:get("links"))) do
- table.join2(flags, self:linklib(link))
- end
end
end
@@ -189,11 +184,6 @@ function linker:_addflags_from_platform(flags)
for _, linkdir in ipairs(table.wrap(platform.get("linkdirs"))) do
table.join2(flags, self:linkdir(linkdir))
end
-
- -- add the links flags
- for _, link in ipairs(table.wrap(platform.get("links"))) do
- table.join2(flags, self:linklib(link))
- end
end
-- add flags from the compiler
@@ -221,6 +211,46 @@ function linker:_addflags_from_linker(flags)
table.join2(flags, self:get(self:_flagname()))
end
+-- add links from the configure
+function linker:_addlinks_from_config(flags)
+
+ -- add the links flags
+ for _, link in ipairs(table.wrap(config.get("links"))) do
+ table.join2(flags, self:linklib(link))
+ end
+end
+
+-- add links from the target
+function linker:_addlinks_from_target(flags, target)
+
+ -- add the links flags
+ for _, link in ipairs(table.wrap(target:get("links"))) do
+ table.join2(flags, self:linklib(link))
+ end
+
+ -- for target options?
+ if target.options then
+
+ -- add the flags for the target options
+ for _, opt in ipairs(target:options()) do
+
+ -- add the links flags from the option
+ for _, link in ipairs(table.wrap(opt:get("links"))) do
+ table.join2(flags, self:linklib(link))
+ end
+ end
+ end
+end
+
+-- add links from the platform
+function linker:_addlinks_from_platform(flags)
+
+ -- add the links flags
+ for _, link in ipairs(table.wrap(platform.get("links"))) do
+ table.join2(flags, self:linklib(link))
+ end
+end
+
-- get the current kind
function linker:kind()
@@ -333,6 +363,15 @@ function linker:linkflags(target)
-- add flags from the linker
self:_addflags_from_linker(flags)
+ -- add links from the configure
+ self:_addlinks_from_config(flags)
+
+ -- add links from the target
+ self:_addlinks_from_target(flags, target)
+
+ -- add flags from the platform
+ self:_addlinks_from_platform(flags)
+
-- remove repeat
flags = table.unique(flags)