diff options
| author | ruki <[email protected]> | 2023-02-27 22:46:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-27 22:46:47 +0800 |
| commit | ba3b6f151515c3ea1e400e489e2661f87ce2e032 (patch) | |
| tree | 8b2891b2b3a18073928a831fd271fc86558a8c6e /xmake/modules/core/tools/gcc.lua | |
| parent | 3f0c48dcfb366e61b9c8d2c1c0d6f8a565039061 (diff) | |
improve to load tool
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 84a1d187f..0d33decb4 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -32,7 +32,6 @@ import("utils.progress") import("private.cache.build_cache") import("private.service.distcc_build.client", {alias = "distcc_build_client"}) --- init it function init(self) -- init mxflags @@ -44,16 +43,6 @@ function init(self) -- init shflags self:set("shflags", "-shared") - -- add -fPIC for shared - -- - -- we need check it for clang/gcc with window target - -- @see https://github.com/xmake-io/xmake/issues/1392 - -- - if not self:is_plat("windows", "mingw") and self:has_flags("-fPIC", "cxflags") then - self:add("shflags", "-fPIC") - self:add("shared.cxflags", "-fPIC") - end - -- init flags map self:set("mapflags", { -- warnings @@ -76,6 +65,21 @@ function init(self) end end +-- we can only call has_flags in load(), +-- as it requires the full platform toolchain flags. +-- +function load(self) + -- add -fPIC for shared + -- + -- we need check it for clang/gcc with window target + -- @see https://github.com/xmake-io/xmake/issues/1392 + -- + if not self:is_plat("windows", "mingw") and self:has_flags("-fPIC", "cxflags") then + self:add("shflags", "-fPIC") + self:add("shared.cxflags", "-fPIC") + end +end + -- make the strip flag function nf_strip(self, level, target) local maps = { |
