From f36a596b3d7a96e92a230c3dd03d4f787efba7bb Mon Sep 17 00:00:00 2001 From: mclee Date: Sat, 22 Dec 2018 21:07:17 +0800 Subject: improve abi include directory for ndk --- xmake/platforms/android/load.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xmake/platforms/android/load.lua b/xmake/platforms/android/load.lua index 1575ee4f9..f4e913503 100644 --- a/xmake/platforms/android/load.lua +++ b/xmake/platforms/android/load.lua @@ -172,6 +172,8 @@ function main(platform) platform:add("cxxflags", format("-I%s/libs/%s/include", cxxstl_sdkdir, toolchains_archs[arch])) platform:add("ldflags", format("-L%s/libs/%s", cxxstl_sdkdir, toolchains_archs[arch])) platform:add("shflags", format("-L%s/libs/%s", cxxstl_sdkdir, toolchains_archs[arch])) + + -- link to c++ std library if cxxstl_sdkdir:find("llvm-libc++", 1, true) then platform:add("ldflags", "-lc++_static", "-lc++abi") platform:add("shflags", "-lc++_static", "-lc++abi") @@ -179,6 +181,18 @@ function main(platform) platform:add("ldflags", "-lgnustl_static") platform:add("shflags", "-lgnustl_static") end + + -- include abi directory + if cxxstl_sdkdir:find("llvm-libc++", 1, true) then + local abi_path = path.translate(format("%s/sources/cxx-stl/llvm-libc++abi", ndk)) + local before_r13 = path.translate(path.join(abi_path, "libcxxabi")) + local after_r13 = path.translate(path.join(abi_path, "include")) + if os.isdir(before_r13) then + platform:add("cxxflags", format("-I%s",before_r13)) + elseif os.isdir(after_r13) then + platform:add("cxxflags", format("-I%s",after_r13)) + end + end end end end -- cgit v1.3.1 From f114c56acb0264a094a99ceff5f45735ea17e54c Mon Sep 17 00:00:00 2001 From: mclee Date: Sat, 22 Dec 2018 22:21:29 +0800 Subject: simplify the syntax --- xmake/platforms/android/load.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xmake/platforms/android/load.lua b/xmake/platforms/android/load.lua index f4e913503..836871b9a 100644 --- a/xmake/platforms/android/load.lua +++ b/xmake/platforms/android/load.lua @@ -184,13 +184,13 @@ function main(platform) -- include abi directory if cxxstl_sdkdir:find("llvm-libc++", 1, true) then - local abi_path = path.translate(format("%s/sources/cxx-stl/llvm-libc++abi", ndk)) - local before_r13 = path.translate(path.join(abi_path, "libcxxabi")) - local after_r13 = path.translate(path.join(abi_path, "include")) + local abi_path = path.join(ndk, "sources", "cxx-stl", "llvm-libc++abi") + local before_r13 = path.join(abi_path, "libcxxabi") + local after_r13 = path.join(abi_path, "include") if os.isdir(before_r13) then - platform:add("cxxflags", format("-I%s",before_r13)) + platform:add("cxxflags", "-I" .. before_r13) elseif os.isdir(after_r13) then - platform:add("cxxflags", format("-I%s",after_r13)) + platform:add("cxxflags", "-I" .. after_r13) end end end -- cgit v1.3.1