summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-10-16 22:34:57 +0800
committerruki <[email protected]>2018-10-16 09:29:47 +0800
commite97e34938bdace77ff10dcd933f2af961432949d (patch)
tree8ec6dec78b2c575600a1b995462ff0cc49119b72
parent29598d7ee9489d7383ac2bb4da48264c99539477 (diff)
improve tbox templates and package install scripts
-rw-r--r--xmake/modules/package/tools/xmake.lua29
-rw-r--r--xmake/platforms/android/check.lua4
-rw-r--r--xmake/templates/c++/console_tbox/project/xmake.lua7
-rw-r--r--xmake/templates/c++/shared_library_tbox/project/xmake.lua7
-rw-r--r--xmake/templates/c++/static_library_tbox/project/xmake.lua7
-rw-r--r--xmake/templates/c/console_tbox/project/xmake.lua7
-rw-r--r--xmake/templates/c/shared_library_tbox/project/xmake.lua7
-rw-r--r--xmake/templates/c/static_library_tbox/project/xmake.lua7
8 files changed, 29 insertions, 46 deletions
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index 300b3f5e1..6a5772e8f 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -34,6 +34,7 @@ function install(package, configs)
for _, name in ipairs(names) do
local value = get_config(name)
if value ~= nil then
+ value = tostring(value)
if value:find(" ", 1, true) then
value = '"' .. value .. '"'
end
@@ -50,7 +51,31 @@ function install(package, configs)
end
table.insert(argv, "--" .. name .. "=" .. value)
end
+ if option.get("verbose") then
+ table.insert(argv, "-v")
+ end
+ if option.get("backtrace") then
+ table.insert(argv, "--backtrace")
+ end
+ os.vrunv("xmake", argv)
+
+ -- do build
+ argv = {}
+ if option.get("verbose") then
+ table.insert(argv, "-v")
+ end
+ if option.get("backtrace") then
+ table.insert(argv, "--backtrace")
+ end
+ os.vrunv("xmake", argv)
+
+ -- do install
+ argv = {"install", "-y", "-o", package:installdir()}
+ if option.get("verbose") then
+ table.insert(argv, "-v")
+ end
+ if option.get("backtrace") then
+ table.insert(argv, "--backtrace")
+ end
os.vrunv("xmake", argv)
- os.vrun("xmake" .. (option.get("verbose") and " -v" or ""))
- os.vrunv("xmake", {"install", "-o", package:installdir()})
end
diff --git a/xmake/platforms/android/check.lua b/xmake/platforms/android/check.lua
index cb1cc6436..cd4c8b786 100644
--- a/xmake/platforms/android/check.lua
+++ b/xmake/platforms/android/check.lua
@@ -31,8 +31,8 @@ function _check_ndk(config)
local ndk = find_ndk(config.get("ndk"), {force = true, verbose = true})
if ndk then
config.set("ndk", ndk.sdkdir, {force = true, readonly = true}) -- maybe to global
- config.set("bin", ndk.bindir)
- config.set("cross", ndk.cross)
+ config.set("bin", ndk.bindir, {force = true, readonly = true})
+ config.set("cross", ndk.cross, {force = true, readonly = true})
else
-- failed
cprint("${bright red}please run:")
diff --git a/xmake/templates/c++/console_tbox/project/xmake.lua b/xmake/templates/c++/console_tbox/project/xmake.lua
index 68cc9cfb7..0babdcd1e 100644
--- a/xmake/templates/c++/console_tbox/project/xmake.lua
+++ b/xmake/templates/c++/console_tbox/project/xmake.lua
@@ -11,10 +11,6 @@ set_languages("c99", "cxx11")
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
--- set the object files directory
-set_objectdir("$(buildir)/$(mode)/$(arch)/.objs")
-set_targetdir("$(buildir)/$(mode)/$(arch)")
-
-- the debug mode
if is_mode("debug") then
@@ -37,9 +33,6 @@ if is_mode("release") then
-- strip all symbols
set_strip("all")
- -- fomit the frame pointer
- add_cxflags("-fomit-frame-pointer")
-
-- enable fastest optimization
set_optimize("fastest")
end
diff --git a/xmake/templates/c++/shared_library_tbox/project/xmake.lua b/xmake/templates/c++/shared_library_tbox/project/xmake.lua
index 4b16c1995..472339253 100644
--- a/xmake/templates/c++/shared_library_tbox/project/xmake.lua
+++ b/xmake/templates/c++/shared_library_tbox/project/xmake.lua
@@ -11,10 +11,6 @@ set_languages("c99", "cxx11")
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
--- set the object files directory
-set_objectdir("$(buildir)/$(mode)/$(arch)/.objs")
-set_targetdir("$(buildir)/$(mode)/$(arch)")
-
-- the debug mode
if is_mode("debug") then
@@ -37,9 +33,6 @@ if is_mode("release") then
-- strip all symbols
set_strip("all")
- -- fomit the frame pointer
- add_cxflags("-fomit-frame-pointer")
-
-- enable fastest optimization
set_optimize("fastest")
end
diff --git a/xmake/templates/c++/static_library_tbox/project/xmake.lua b/xmake/templates/c++/static_library_tbox/project/xmake.lua
index 4b16c1995..472339253 100644
--- a/xmake/templates/c++/static_library_tbox/project/xmake.lua
+++ b/xmake/templates/c++/static_library_tbox/project/xmake.lua
@@ -11,10 +11,6 @@ set_languages("c99", "cxx11")
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
--- set the object files directory
-set_objectdir("$(buildir)/$(mode)/$(arch)/.objs")
-set_targetdir("$(buildir)/$(mode)/$(arch)")
-
-- the debug mode
if is_mode("debug") then
@@ -37,9 +33,6 @@ if is_mode("release") then
-- strip all symbols
set_strip("all")
- -- fomit the frame pointer
- add_cxflags("-fomit-frame-pointer")
-
-- enable fastest optimization
set_optimize("fastest")
end
diff --git a/xmake/templates/c/console_tbox/project/xmake.lua b/xmake/templates/c/console_tbox/project/xmake.lua
index 68cc9cfb7..0babdcd1e 100644
--- a/xmake/templates/c/console_tbox/project/xmake.lua
+++ b/xmake/templates/c/console_tbox/project/xmake.lua
@@ -11,10 +11,6 @@ set_languages("c99", "cxx11")
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
--- set the object files directory
-set_objectdir("$(buildir)/$(mode)/$(arch)/.objs")
-set_targetdir("$(buildir)/$(mode)/$(arch)")
-
-- the debug mode
if is_mode("debug") then
@@ -37,9 +33,6 @@ if is_mode("release") then
-- strip all symbols
set_strip("all")
- -- fomit the frame pointer
- add_cxflags("-fomit-frame-pointer")
-
-- enable fastest optimization
set_optimize("fastest")
end
diff --git a/xmake/templates/c/shared_library_tbox/project/xmake.lua b/xmake/templates/c/shared_library_tbox/project/xmake.lua
index 4b16c1995..472339253 100644
--- a/xmake/templates/c/shared_library_tbox/project/xmake.lua
+++ b/xmake/templates/c/shared_library_tbox/project/xmake.lua
@@ -11,10 +11,6 @@ set_languages("c99", "cxx11")
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
--- set the object files directory
-set_objectdir("$(buildir)/$(mode)/$(arch)/.objs")
-set_targetdir("$(buildir)/$(mode)/$(arch)")
-
-- the debug mode
if is_mode("debug") then
@@ -37,9 +33,6 @@ if is_mode("release") then
-- strip all symbols
set_strip("all")
- -- fomit the frame pointer
- add_cxflags("-fomit-frame-pointer")
-
-- enable fastest optimization
set_optimize("fastest")
end
diff --git a/xmake/templates/c/static_library_tbox/project/xmake.lua b/xmake/templates/c/static_library_tbox/project/xmake.lua
index 4b16c1995..472339253 100644
--- a/xmake/templates/c/static_library_tbox/project/xmake.lua
+++ b/xmake/templates/c/static_library_tbox/project/xmake.lua
@@ -11,10 +11,6 @@ set_languages("c99", "cxx11")
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
add_mxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
--- set the object files directory
-set_objectdir("$(buildir)/$(mode)/$(arch)/.objs")
-set_targetdir("$(buildir)/$(mode)/$(arch)")
-
-- the debug mode
if is_mode("debug") then
@@ -37,9 +33,6 @@ if is_mode("release") then
-- strip all symbols
set_strip("all")
- -- fomit the frame pointer
- add_cxflags("-fomit-frame-pointer")
-
-- enable fastest optimization
set_optimize("fastest")
end