diff options
| author | ruki <[email protected]> | 2019-10-30 22:44:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-10-30 10:27:01 +0800 |
| commit | ef055ce4ca8ba96422488e115ab43a3fb981ea21 (patch) | |
| tree | a78a3e2b20a9c307bbe71fd2c810c0a53cc33fdf | |
| parent | e51e92ebd5c96f88223556912c56bebf594d2432 (diff) | |
fix libunwind and link for windows
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 18 | ||||
| -rw-r--r-- | xmake/platforms/android/load.lua | 16 |
2 files changed, 27 insertions, 7 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 301f13ec3..1dffd8743 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -296,7 +296,7 @@ function nf_pcxxheader(self, pcheaderfile, target) end -- make the link arguments list -function linkargv(self, objectfiles, targetkind, targetfile, flags) +function linkargv(self, objectfiles, targetkind, targetfile, flags, opt) -- add rpath for dylib (macho), e.g. -install_name @rpath/file.dylib local flags_extra = {} @@ -310,8 +310,20 @@ function linkargv(self, objectfiles, targetkind, targetfile, flags) table.insert(flags_extra, "-Wl,--out-implib," .. os.args(path.join(path.directory(targetfile), path.basename(targetfile) .. ".lib"))) end - -- make link args - return self:program(), table.join("-o", targetfile, objectfiles, flags, flags_extra) + -- init arguments + local argv = table.join("-o", targetfile, objectfiles, flags, flags_extra) + + -- too long arguments for windows? + if is_host("windows") then + opt = opt or {} + local args = os.args(argv) + if #args > 1024 and not opt.rawargs then + local argsfile = os.tmpfile(args) .. ".args.txt" + io.writefile(argsfile, args) + argv = {"@" .. argsfile} + end + end + return self:program(), argv end -- link the target file diff --git a/xmake/platforms/android/load.lua b/xmake/platforms/android/load.lua index bef9733d5..3ba9e911b 100644 --- a/xmake/platforms/android/load.lua +++ b/xmake/platforms/android/load.lua @@ -232,11 +232,19 @@ function main(platform) -- add c++ stl links if ndk_cxxstl == "llvmstl_static" then - platform:add("ldflags", "-lc++_static", "-lc++abi", "-lunwind", "-latomic") - platform:add("shflags", "-lc++_static", "-lc++abi", "-lunwind", "-latomic") + platform:add("ldflags", "-lc++_static", "-lc++abi") + platform:add("shflags", "-lc++_static", "-lc++abi") + if arch == "armv7-a" or arch == "armv5te" then + platform:add("ldflags", "-lunwind", "-latomic") + platform:add("shflags", "-lunwind", "-latomic") + end elseif ndk_cxxstl == "llvmstl_shared" then - platform:add("ldflags", "-lc++_shared", "-lc++abi", "-lunwind", "-latomic") - platform:add("shflags", "-lc++_shared", "-lc++abi", "-lunwind", "-latomic") + platform:add("ldflags", "-lc++_shared", "-lc++abi") + platform:add("shflags", "-lc++_shared", "-lc++abi") + if arch == "armv7-a" or arch == "armv5te" then + platform:add("ldflags", "-lunwind", "-latomic") + platform:add("shflags", "-lunwind", "-latomic") + end elseif ndk_cxxstl == "gnustl_static" then platform:add("ldflags", "-lgnustl_static") platform:add("shflags", "-lgnustl_static") |
