summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSirLynix <[email protected]>2024-03-30 15:51:00 +0100
committerSirLynix <[email protected]>2024-03-30 15:51:00 +0100
commite6b5288b207fe85ba0c0e620d44d718c8e00b82d (patch)
tree1c421756c300f03e189a5065cfa49b027b3e1b5f
parent75d8f661e2a5fd4090c6f90512481f8613e540c9 (diff)
move path translation to autoconf/cmake tools
-rw-r--r--xmake/modules/package/tools/autoconf.lua16
-rw-r--r--xmake/modules/package/tools/cmake.lua10
-rw-r--r--xmake/toolchains/ndk/load.lua8
3 files changed, 24 insertions, 10 deletions
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 9f4181b0b..d026ec767 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -400,6 +400,22 @@ function buildenvs(package, opt)
envs.LDSHARED = _translate_windows_bin_path(envs.LDSHARED)
envs.CPP = _translate_windows_bin_path(envs.CPP)
envs.RANLIB = _translate_windows_bin_path(envs.RANLIB)
+ if package:is_plat("android") then
+ -- use unix path separator on android as windows seps may not be understood by some tools (e.g. openssl's perl)
+ envs.CFLAGS = path.unix(envs.CFLAGS)
+ envs.CXXFLAGS = path.unix(envs.CXXFLAGS)
+ envs.CPPFLAGS = path.unix(envs.CPPFLAGS)
+ envs.ASFLAGS = path.unix(envs.ASFLAGS)
+ if envs.ARFLAGS then
+ envs.ARFLAGS = path.unix(envs.ARFLAGS)
+ end
+ if envs.LDFLAGS then
+ envs.LDFLAGS = path.unix(envs.LDFLAGS)
+ end
+ if envs.SHFLAGS then
+ envs.SHFLAGS = path.unix(envs.SHFLAGS)
+ end
+ end
end
local ACLOCAL_PATH = {}
local PKG_CONFIG_PATH = {}
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 15bcb2d99..9b1181095 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -169,7 +169,7 @@ function _get_cflags(package, opt)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
if #result > 0 then
- return os.args(result)
+ return _translate_paths(os.args(result))
end
end
@@ -200,7 +200,7 @@ function _get_cxxflags(package, opt)
end
table.join2(result, _get_cflags_from_packagedeps(package, opt))
if #result > 0 then
- return os.args(result)
+ return _translate_paths(os.args(result))
end
end
@@ -219,7 +219,7 @@ function _get_asflags(package, opt)
table.join2(result, opt.asflags)
end
if #result > 0 then
- return os.args(result)
+ return _translate_paths(os.args(result))
end
end
@@ -245,7 +245,7 @@ function _get_ldflags(package, opt)
table.join2(result, opt.ldflags)
end
if #result > 0 then
- return os.args(result)
+ return _translate_paths(os.args(result))
end
end
@@ -271,7 +271,7 @@ function _get_shflags(package, opt)
table.join2(result, opt.shflags)
end
if #result > 0 then
- return os.args(result)
+ return _translate_paths(os.args(result))
end
end
diff --git a/xmake/toolchains/ndk/load.lua b/xmake/toolchains/ndk/load.lua
index 9f11146b7..4e60f0075 100644
--- a/xmake/toolchains/ndk/load.lua
+++ b/xmake/toolchains/ndk/load.lua
@@ -166,8 +166,6 @@ function main(toolchain)
-- add sysroot flags
local ndk_sysroot = toolchain:config("ndk_sysroot")
if ndk_sysroot and os.isdir(ndk_sysroot) then
- -- use unix path separator on android as windows seps may not be understood by some tools (e.g. openssl's perl)
- ndk_sysroot = path.unix(ndk_sysroot)
local triple = _get_triple(arch)
if ndkver and tonumber(ndkver) < 22 then
toolchain:add("cxflags", "-D__ANDROID_API__=" .. ndk_sdkver)
@@ -176,9 +174,9 @@ function main(toolchain)
toolchain:add("cflags", "--sysroot=" .. ndk_sysroot)
toolchain:add("cxxflags","--sysroot=" .. ndk_sysroot)
toolchain:add("asflags", "--sysroot=" .. ndk_sysroot)
- toolchain:add("cflags", "-isystem " .. format("%s/%s/%s/%s", ndk_sysroot, "usr", "include", triple))
- toolchain:add("cxxflags","-isystem " .. format("%s/%s/%s/%s", ndk_sysroot, "usr", "include", triple))
- toolchain:add("asflags", "-isystem " .. format("%s/%s/%s/%s", ndk_sysroot, "usr", "include", triple))
+ toolchain:add("cflags", "-isystem " .. path.join(ndk_sysroot, "usr", "include", triple))
+ toolchain:add("cxxflags","-isystem " .. path.join(ndk_sysroot, "usr", "include", triple))
+ toolchain:add("asflags", "-isystem " .. path.join(ndk_sysroot, "usr", "include", triple))
else
local ndk_sdkdir = path.translate(format("%s/platforms/android-%d", ndk, ndk_sdkver))
if os.isdir(ndk_sdkdir) then