summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-08-14 18:19:48 +0800
committerruki <[email protected]>2017-08-14 18:19:48 +0800
commitb9a0e818560c31e7638263df96f26d8a191f2e30 (patch)
tree20898f7797671e8369dc17b13e2af8ae38abf4a6
parent18e041e57463c847158f3c3d67e7e75e22b082f9 (diff)
modify linkflags order
-rw-r--r--core/src/demo/xmake.lua24
-rw-r--r--core/src/xmake/xmake.lua2
-rw-r--r--xmake/core/tool/builder.lua12
3 files changed, 18 insertions, 20 deletions
diff --git a/core/src/demo/xmake.lua b/core/src/demo/xmake.lua
index e7fd6cbc9..2bf163753 100644
--- a/core/src/demo/xmake.lua
+++ b/core/src/demo/xmake.lua
@@ -19,24 +19,22 @@ target("demo")
-- add includes directory
add_includedirs("$(projectdir)", "$(projectdir)/src", "$(buildir)/luajit")
- -- link readline
- if not is_plat("windows") then
--- add_links("readline")
- end
-
- -- add packages
- add_packages("tbox", "base")
-
-- add the common source files
add_files("**.c")
- -- for macosx
- if is_plat("macosx") then
- add_ldflags("-all_load", "-pagezero_size 10000", "-image_base 100000000")
- end
-
-- add the resource files (it will be enabled after publishing new version)
if is_plat("windows") then
add_files("*.rc")
end
+
+ -- add links
+ if is_plat("windows") then
+ add_links("ws2_32", "advapi32")
+ elseif is_plat("android") then
+ add_links("m", "c")
+ elseif is_plat("macosx") then
+ add_ldflags("-all_load", "-pagezero_size 10000", "-image_base 100000000")
+ else
+ add_links("pthread", "dl", "m", "c")
+ end
diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua
index b22712136..6ad45560b 100644
--- a/core/src/xmake/xmake.lua
+++ b/core/src/xmake/xmake.lua
@@ -20,7 +20,7 @@ target("xmake")
add_includedirs("$(projectdir)", "$(buildir)/luajit")
-- add packages
- add_packages("tbox", "base")
+ add_packages("tbox")
-- add the common source files
add_files("**.c")
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index d9c12dda6..f5bf61ef7 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -209,11 +209,9 @@ function builder:_addflags_from_target(flags, target)
local targetflags = cache[key]
if not targetflags then
- -- add the target flags
+ -- add flags (named) and inherited flags from language
targetflags = {}
- for _, flagkind in ipairs(self:_flagkinds()) do
- table.join2(targetflags, self:_mapflags(target:get(flagkind)))
- end
+ self:_addflags_from_language(targetflags, target)
-- add the flags for the target options
if target.options then
@@ -222,8 +220,10 @@ function builder:_addflags_from_target(flags, target)
end
end
- -- add flags (named) from language
- self:_addflags_from_language(targetflags, target)
+ -- add the target flags
+ for _, flagkind in ipairs(self:_flagkinds()) do
+ table.join2(targetflags, self:_mapflags(target:get(flagkind)))
+ end
-- cache it
cache[key] = targetflags