summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-08-03 22:44:03 +0800
committerruki <[email protected]>2018-08-03 10:24:22 +0800
commit2a7d3704912245a2433d1071679f4253d96069c0 (patch)
treeed1875738fa7bb2e39118b7a046b94c96debfe41
parent5aa5ddbdaa2c026d65fcb17e5e36ac4995032a8b (diff)
modify format
-rw-r--r--xmake/core/project/target.lua8
-rw-r--r--xmake/modules/core/tools/go.lua3
-rw-r--r--xmake/modules/core/tools/rustc.lua3
-rw-r--r--xmake/platforms/android/xmake.lua2
-rw-r--r--xmake/platforms/cross/xmake.lua2
-rw-r--r--xmake/platforms/iphoneos/xmake.lua2
-rw-r--r--xmake/platforms/linux/xmake.lua2
-rw-r--r--xmake/platforms/macosx/xmake.lua2
-rw-r--r--xmake/platforms/mingw/xmake.lua2
-rw-r--r--xmake/platforms/watchos/xmake.lua2
-rw-r--r--xmake/platforms/windows/xmake.lua13
11 files changed, 16 insertions, 25 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index fae55d048..0dc8d3aa4 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -126,11 +126,9 @@ function target.filename(targetname, targetkind, targetformat)
-- check
assert(targetname and targetkind)
- -- get format
- local format = targetformat or platform.format(targetkind) or {"", ""}
-
- -- make it
- return format[1] .. targetname .. format[2]
+ -- make filename by format
+ local format = targetformat or platform.format(targetkind)
+ return format and (format:gsub("%$%(name%)", targetname)) or targetname
end
-- new a target instance
diff --git a/xmake/modules/core/tools/go.lua b/xmake/modules/core/tools/go.lua
index f092c3daa..f0f15ab2e 100644
--- a/xmake/modules/core/tools/go.lua
+++ b/xmake/modules/core/tools/go.lua
@@ -34,8 +34,7 @@ function init(self)
_g.arflags = { "grc" }
-- init the file formats
- _g.formats = {}
- _g.formats.static = {"", ".a"}
+ _g.formats = { static = "$(name).a" }
-- init buildmodes
_g.buildmodes =
diff --git a/xmake/modules/core/tools/rustc.lua b/xmake/modules/core/tools/rustc.lua
index 7be852edd..8df967401 100644
--- a/xmake/modules/core/tools/rustc.lua
+++ b/xmake/modules/core/tools/rustc.lua
@@ -40,8 +40,7 @@ function init(self)
_g.ldflags = { "--crate-type=bin" }
-- init the file formats
- _g.formats = {}
- _g.formats.static = {"lib", ".rlib"}
+ _g.formats = { static = "lib$(name).rlib" }
-- init buildmodes
_g.buildmodes =
diff --git a/xmake/platforms/android/xmake.lua b/xmake/platforms/android/xmake.lua
index adeaadc95..0e8edb8c7 100644
--- a/xmake/platforms/android/xmake.lua
+++ b/xmake/platforms/android/xmake.lua
@@ -35,7 +35,7 @@ platform("android")
set_archs("armv5te", "armv6", "armv7-a", "armv8-a", "arm64-v8a")
-- set formats
- set_formats {static = {"lib", ".a"}, object = {"", ".o"}, shared = {"lib", ".so"}, symbol = {"", ".sym"}}
+ set_formats {static = "lib$(name).a", object = "$(name).o", shared = "lib$(name).so", symbol = "$(name).sym"}
-- on check
on_check("check")
diff --git a/xmake/platforms/cross/xmake.lua b/xmake/platforms/cross/xmake.lua
index e430bc22e..ee6debaf4 100644
--- a/xmake/platforms/cross/xmake.lua
+++ b/xmake/platforms/cross/xmake.lua
@@ -29,7 +29,7 @@ platform("cross")
set_hosts("macosx", "linux", "windows")
-- set formats
- set_formats {static = {"lib", ".a"}, object = {"", ".o"}, shared = {"lib", ".so"}, symbol = {"", ".sym"}}
+ set_formats {static = "lib$(name).a", object = "$(name).o", shared = "lib$(name).so", symbol = "$(name).sym"}
-- on check
on_check("check")
diff --git a/xmake/platforms/iphoneos/xmake.lua b/xmake/platforms/iphoneos/xmake.lua
index 4ac3afd42..32d561898 100644
--- a/xmake/platforms/iphoneos/xmake.lua
+++ b/xmake/platforms/iphoneos/xmake.lua
@@ -35,7 +35,7 @@ platform("iphoneos")
set_archs("armv7", "armv7s", "arm64", "i386", "x86_64")
-- set formats
- set_formats {static = {"lib", ".a"}, object = {"", ".o"}, shared = {"lib", ".dylib"}, symbol = {"", ".sym"}}
+ set_formats {static = "lib$(name).a", object = "$(name).o", shared = "lib$(name).dylib", symbol = "$(name).sym"}
-- on check
on_check("check")
diff --git a/xmake/platforms/linux/xmake.lua b/xmake/platforms/linux/xmake.lua
index 1a7a232f8..33c9f9814 100644
--- a/xmake/platforms/linux/xmake.lua
+++ b/xmake/platforms/linux/xmake.lua
@@ -35,7 +35,7 @@ platform("linux")
set_archs("i386", "x86_64")
-- set formats
- set_formats {static = {"lib", ".a"}, object = {"", ".o"}, shared = {"lib", ".so"}, symbol = {"", ".sym"}}
+ set_formats {static = "lib$(name).a", object = "$(name).o", shared = "lib$(name).so", symbol = "$(name).sym"}
-- set installdir
set_installdir("/usr/local")
diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua
index 7c6a897d8..203d551ad 100644
--- a/xmake/platforms/macosx/xmake.lua
+++ b/xmake/platforms/macosx/xmake.lua
@@ -35,7 +35,7 @@ platform("macosx")
set_archs("i386", "x86_64")
-- set formats
- set_formats {static = {"lib", ".a"}, object = {"", ".o"}, shared = {"lib", ".dylib"}, symbol = {"", ".sym"}}
+ set_formats {static = "lib$(name).a", object = "$(name).o", shared = "lib$(name).dylib", symbol = "$(name).sym"}
-- set installdir
set_installdir("/usr/local")
diff --git a/xmake/platforms/mingw/xmake.lua b/xmake/platforms/mingw/xmake.lua
index 7b1968da2..da19c2fbb 100644
--- a/xmake/platforms/mingw/xmake.lua
+++ b/xmake/platforms/mingw/xmake.lua
@@ -35,7 +35,7 @@ platform("mingw")
set_archs("i386", "x86_64")
-- set formats
- set_formats {static = {"lib", ".a"}, object = {"", ".o"}, shared = {"", ".dll"}, binary = {"", ".exe"},symbol = {"", ".pdb"}}
+ set_formats {static = "lib$(name).a", object = "$(name).o", shared = "$(name).dll", binary = "$(name).exe", symbol = "$(name).pdb"}
-- on check
on_check("check")
diff --git a/xmake/platforms/watchos/xmake.lua b/xmake/platforms/watchos/xmake.lua
index c94232ec4..c22deb3d5 100644
--- a/xmake/platforms/watchos/xmake.lua
+++ b/xmake/platforms/watchos/xmake.lua
@@ -35,7 +35,7 @@ platform("watchos")
set_archs("armv7k", "i386")
-- set formats
- set_formats {static = {"lib", ".a"}, object = {"", ".o"}, shared = {"lib", ".dylib"}, symbol = {"", ".sym"}}
+ set_formats {static = "lib$(name).a", object = "$(name).o", shared = "lib$(name).dylib", symbol = "$(name).sym"}
-- on check
on_check("check")
diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua
index 0ca6d2b86..910f8aadb 100644
--- a/xmake/platforms/windows/xmake.lua
+++ b/xmake/platforms/windows/xmake.lua
@@ -37,6 +37,9 @@ platform("windows")
-- set environment
set_environment("environment")
+ -- set formats
+ set_formats {static = "$(name).lib", object = "$(name).obj", shared = "$(name).dll", binary = "$(name).exe", symbol = "$(name).pdb"}
+
-- on check
on_check("check")
@@ -47,15 +50,7 @@ platform("windows")
import("core.project.config")
-- init flags for architecture
- local arch = config.get("arch")
-
- -- init the file formats
- _g.formats = {}
- _g.formats.static = {"", ".lib"}
- _g.formats.object = {"", ".obj"}
- _g.formats.shared = {"", ".dll"}
- _g.formats.binary = {"", ".exe"}
- _g.formats.symbol = {"", ".pdb"}
+ local arch = config.get("arch")
-- init flags for asm
local as = config.get("as")