summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-04-24 22:58:58 +0800
committerruki <[email protected]>2019-04-24 11:53:49 +0800
commit91470eed87a2def7f537a056145f86271a95224f (patch)
tree9966adcfd7e58064f824f40cc621a4b00d739e09
parent2898840b2fee9a838ca84e1c0df129b00d81aa45 (diff)
add cpp and ranlib to cross plat
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua2
-rw-r--r--xmake/modules/package/tools/autoconf.lua2
-rw-r--r--xmake/platforms/android/config.lua19
-rw-r--r--xmake/platforms/cross/config.lua9
-rw-r--r--xmake/platforms/macosx/config.lua7
5 files changed, 24 insertions, 15 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
index 64a60f6e6..fda3e03df 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
@@ -103,7 +103,7 @@ function sandbox_lib_detect_find_program._find_from_pathes(name, pathes, opt)
end
-- the program path
- if program_path and os.isexec(program_path) then
+ if program_path and (os.isexec(program_path) or os.isexec(program_path:split("%s+")[1])) then
-- check it
if sandbox_lib_detect_find_program._check(program_path, opt) then
return program_path
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 42096eff1..bcaf4684a 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -101,7 +101,7 @@ function _enter_envs(package)
if package:is_plat("android") then
local gcc_toolchain = config.get("gcc_toolchain")
if not gcc_toolchain then
- local bindir = config.get("bindir")
+ local bindir = config.get("bin")
if bindir then
gcc_toolchain = path.directory(bindir)
end
diff --git a/xmake/platforms/android/config.lua b/xmake/platforms/android/config.lua
index 92fa49d4c..860f37e14 100644
--- a/xmake/platforms/android/config.lua
+++ b/xmake/platforms/android/config.lua
@@ -49,9 +49,17 @@ function _toolchains()
-- get cross
local cross = config.get("cross")
+ -- get gcc toolchain bin directory
+ local gcc_toolchain_bin = nil
+ local gcc_toolchain = config.get("gcc_toolchain")
+ if gcc_toolchain then
+ gcc_toolchain_bin = path.join(gcc_toolchain, "bin")
+ end
+
-- init toolchains
local cc = toolchain("the c compiler")
local cxx = toolchain("the c++ compiler")
+ local cpp = toolchain("the c preprocessor")
local ld = toolchain("the linker")
local sh = toolchain("the shared library linker")
local ar = toolchain("the static library archiver")
@@ -62,7 +70,7 @@ function _toolchains()
local rc_ld = toolchain("the rust linker")
local rc_sh = toolchain("the rust shared library linker")
local rc_ar = toolchain("the rust static library archiver")
- local toolchains = {cc = cc, cxx = cxx, as = as, ld = ld, sh = sh, ar = ar, ex = ex, ranlib = ranlib,
+ local toolchains = {cc = cc, cxx = cxx, cpp = cpp, as = as, ld = ld, sh = sh, ar = ar, ex = ex, ranlib = ranlib,
rc = rc, ["rc-ld"] = rc_ld, ["rc-sh"] = rc_sh, ["rc-ar"] = rc_ar}
-- init the c compiler
@@ -71,6 +79,10 @@ function _toolchains()
-- init the c++ compiler
cxx:add({name = "g++", cross = cross}, "clang++")
+ -- init the c preprocessor
+-- cpp:add({name = "cpp", cross = cross, pathes = gcc_toolchain_bin}, "cpp")
+ cpp:add({name = "gcc -E", cross = cross}, "clang -E")
+
-- init the assember
as:add({name = "gcc", cross = cross}, "clang")
@@ -91,11 +103,6 @@ function _toolchains()
ex:add({name = "ar", cross = cross}, "llvm-ar")
-- init the static library index generator
- local gcc_toolchain_bin = nil
- local gcc_toolchain = config.get("gcc_toolchain")
- if gcc_toolchain then
- gcc_toolchain_bin = path.join(gcc_toolchain, "bin")
- end
ranlib:add({name = "ranlib", cross = cross, pathes = gcc_toolchain_bin}, "ranlib")
-- init the rust compiler and linker
diff --git a/xmake/platforms/cross/config.lua b/xmake/platforms/cross/config.lua
index e531da2e6..56d9d0fe1 100644
--- a/xmake/platforms/cross/config.lua
+++ b/xmake/platforms/cross/config.lua
@@ -57,16 +57,21 @@ function _toolchains()
-- init toolchains
local cc = toolchain("the c compiler")
local cxx = toolchain("the c++ compiler")
+ local cpp = toolchain("the c preprocessor")
local ld = toolchain("the linker")
local sh = toolchain("the shared library linker")
local ar = toolchain("the static library archiver")
local ex = toolchain("the static library extractor")
+ local ranlib = toolchain("the static library index generator")
local as = toolchain("the assember")
- local toolchains = {cc = cc, cxx = cxx, as = as, ld = ld, sh = sh, ar = ar, ex = ex}
+ local toolchains = {cc = cc, cxx = cxx, cpp = cpp, as = as, ld = ld, sh = sh, ar = ar, ex = ex, ranlib = ranlib}
-- init the c compiler
cc:add("$(env CC)", {name = "gcc", cross = cross}, {name = "clang", cross = cross})
+ -- init the c preprocessor
+ cpp:add("$(env CPP)", {name = "gcc -E", cross = cross}, {name = "clang -E", cross = cross})
+
-- init the c++ compiler
cxx:add("$(env CXX)")
cxx:add({name = "gcc", cross = cross})
@@ -97,6 +102,8 @@ function _toolchains()
-- init the static library extractor
ex:add("$(env AR)", {name = "ar", cross = cross})
+ -- init the static library index generator
+ ar:add("$(env RANLIB)", {name = "ranlib", cross = cross})
return toolchains
end
diff --git a/xmake/platforms/macosx/config.lua b/xmake/platforms/macosx/config.lua
index 618dba0e1..4db391d7d 100644
--- a/xmake/platforms/macosx/config.lua
+++ b/xmake/platforms/macosx/config.lua
@@ -31,12 +31,10 @@ import("private.platform.check_toolchain")
function _toolchains()
-- init cross
- local arch = config.get("arch") or os.arch()
local cross = "xcrun -sdk macosx "
-- init toolchains
local cc = toolchain("the c compiler")
- local cpp = toolchain("the c preprocessor")
local cxx = toolchain("the c++ compiler")
local ld = toolchain("the linker")
local sh = toolchain("the shared library linker")
@@ -62,7 +60,7 @@ function _toolchains()
local cu = toolchain("the cuda compiler")
local cu_ld = toolchain("the cuda linker")
local cu_sh = toolchain("the cuda shared library linker")
- local toolchains = {cc = cc, cpp = cpp, cxx = cxx, as = as, ld = ld, sh = sh, ar = ar, ex = ex,
+ local toolchains = {cc = cc, cxx = cxx, as = as, ld = ld, sh = sh, ar = ar, ex = ex,
mm = mm, mxx = mxx, sc = sc, ["sc-ld"] = sc_ld, ["sc-sh"] = sc_sh,
gc = gc, ["gc-ld"] = gc_ld, ["gc-ar"] = gc_ar,
dc = dc, ["dc-ld"] = dc_ld, ["dc-sh"] = dc_sh, ["dc-ar"] = dc_ar,
@@ -72,9 +70,6 @@ function _toolchains()
-- init the c compiler
cc:add("$(env CC)", {name = "clang", cross = cross}, "clang", "gcc")
- -- init the c preprocessor
- cpp:add("$(env CPP)", {name = "clang -arch " .. arch .. " -E", cross = cross}, "clang -arch " .. arch .. " -E")
-
-- init the c++ compiler
cxx:add("$(env CXX)")
cxx:add({name = "clang", cross = cross})