diff options
| author | ruki <[email protected]> | 2015-06-04 15:46:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-04 15:46:43 +0800 |
| commit | 6c5fbedfe26db54b0bbb95fa9154ed759c7ad98f (patch) | |
| tree | c7a1d2ba8ee4076e7576df79a53c1dfaadf7f14b /xmake/scripts | |
| parent | 83295bd3a1b27f844759aeadbbdc23f51e2f2d89 (diff) | |
rebuild compiler and linker
Diffstat (limited to 'xmake/scripts')
15 files changed, 233 insertions, 235 deletions
diff --git a/xmake/scripts/platform/android/android.lua b/xmake/scripts/platform/android/android.lua index ba180d87d..b8e91a09f 100644 --- a/xmake/scripts/platform/android/android.lua +++ b/xmake/scripts/platform/android/android.lua @@ -17,44 +17,44 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _android.lua +-- @file android.lua -- --- define module: _android -local _android = _android or {} +-- define module: android +local android = android or {} -- load modules local config = require("base/config") -- init host -_android._HOST = xmake._HOST +android._HOST = xmake._HOST -- init architectures -_android._ARCHS = {"armv5te", "armv6", "armv7-a"} +android._ARCHS = {"armv5te", "armv6", "armv7-a"} -- make configure -function _android.make(configs) +function android.make(configs) - -- init the file name format - configs.format = {} - configs.format.static = {"lib", ".a"} - configs.format.object = {"", ".o"} - configs.format.shared = {"lib", ".so"} + -- init the file formats + configs.formats = {} + configs.formats.static = {"lib", ".a"} + configs.formats.object = {"", ".o"} + configs.formats.shared = {"lib", ".so"} end -- get the option menu for action: xmake config or global -function _android.menu(action) +function android.menu(action) -- init config option menu - _android._MENU_CONFIG = _android._MENU_CONFIG or + android._MENU_CONFIG = android._MENU_CONFIG or { {} , {nil, "ndk", "kv", nil, "The NDK Directory" } , {nil, "ndk_sdkver", "kv", "auto", "The SDK Version for NDK" } , } -- init global option menu - _android._MENU_GLOBAL = _android._MENU_GLOBAL or + android._MENU_GLOBAL = android._MENU_GLOBAL or { {} , {nil, "ndk", "kv", nil, "The NDK Directory" } , {nil, "ndk_sdkver", "kv", "auto", "The SDK Version for NDK" } @@ -62,11 +62,11 @@ function _android.menu(action) -- get the option menu if action == "config" then - return _android._MENU_CONFIG + return android._MENU_CONFIG elseif action == "global" then - return _android._MENU_GLOBAL + return android._MENU_GLOBAL end end --- return module: _android -return _android +-- return module: android +return android diff --git a/xmake/scripts/platform/android/prober.lua b/xmake/scripts/platform/android/prober.lua index 28ccc3e9f..67078f244 100644 --- a/xmake/scripts/platform/android/prober.lua +++ b/xmake/scripts/platform/android/prober.lua @@ -17,7 +17,7 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _prober.lua +-- @file prober.lua -- -- load modules @@ -26,11 +26,11 @@ local path = require("base/path") local utils = require("base/utils") local string = require("base/string") --- define module: _prober -local _prober = _prober or {} +-- define module: prober +local prober = prober or {} -- probe the architecture -function _prober._probe_arch(configs) +function prober._probe_arch(configs) -- get the architecture local arch = configs.arch @@ -46,12 +46,12 @@ function _prober._probe_arch(configs) end -- probe the configure -function _prober.done(configs, is_global) +function prober.done(configs, is_global) -- probe the architecture - if not _prober._probe_arch(configs) then return end + if not prober._probe_arch(configs) then return end end --- return module: _prober -return _prober +-- return module: prober +return prober diff --git a/xmake/scripts/platform/iphoneos/iphoneos.lua b/xmake/scripts/platform/iphoneos/iphoneos.lua index 872f7c2e1..7c6567416 100644 --- a/xmake/scripts/platform/iphoneos/iphoneos.lua +++ b/xmake/scripts/platform/iphoneos/iphoneos.lua @@ -17,42 +17,40 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _iphoneos.lua +-- @file iphoneos.lua -- --- define module: _iphoneos -local _iphoneos = _iphoneos or {} +-- define module: iphoneos +local iphoneos = iphoneos or {} -- load modules local config = require("base/config") -- init host -_iphoneos._HOST = "macosx" +iphoneos._HOST = "macosx" -- init architectures -_iphoneos._ARCHS = {"armv7", "armv7s", "arm64"} +iphoneos._ARCHS = {"armv7", "armv7s", "arm64"} -- make configure -function _iphoneos.make(configs) +function iphoneos.make(configs) - -- init the file name format - configs.format = {} - configs.format.static = {"lib", ".a"} - configs.format.object = {"", ".o"} - configs.format.shared = {"lib", ".dylib"} - - -- init the compiler - configs.compiler = {} - configs.compiler.cc = config.get("cc") or "xcrun -sdk iphoneos clang" - configs.compiler.cxx = config.get("cxx") or "xcrun -sdk iphoneos clang++" - configs.compiler.mm = config.get("mm") or configs.compiler.cc - configs.compiler.mxx = config.get("mxx") or configs.compiler.cxx + -- init the file formats + configs.formats = {} + configs.formats.static = {"lib", ".a"} + configs.formats.object = {"", ".o"} + configs.formats.shared = {"lib", ".dylib"} - -- init the linker - configs.linker = {} - configs.linker.binary = config.get("ld") or "xcrun -sdk iphoneos clang++" - configs.linker.static = config.get("ar") or "xcrun -sdk iphoneos ar" - configs.linker.shared = config.get("sh") or "xcrun -sdk iphoneos clang++" + -- init the toolchains + configs.tools = {} + configs.tools.make = "make" + configs.tools.cc = config.get("cc") or "xcrun -sdk iphoneos clang" + configs.tools.cxx = config.get("cxx") or "xcrun -sdk iphoneos clang++" + configs.tools.mm = config.get("mm") or configs.tools.cc + configs.tools.mxx = config.get("mxx") or configs.tools.cxx + configs.tools.ld = config.get("ld") or "xcrun -sdk iphoneos clang++" + configs.tools.ar = config.get("ar") or "xcrun -sdk iphoneos ar" + configs.tools.sh = config.get("sh") or "xcrun -sdk iphoneos clang++" -- init xcode sdk directory configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. config.get("xcode_sdkver") .. ".sdk" @@ -60,10 +58,10 @@ function _iphoneos.make(configs) end -- get the option menu for action: xmake config or global -function _iphoneos.menu(action) +function iphoneos.menu(action) -- init config option menu - _iphoneos._MENU_CONFIG = _iphoneos._MENU_CONFIG or + iphoneos._MENU_CONFIG = iphoneos._MENU_CONFIG or { {} , {nil, "mm", "kv", nil, "The Objc Compiler" } , {nil, "mxx", "kv", nil, "The Objc++ Compiler" } @@ -80,7 +78,7 @@ function _iphoneos.menu(action) , } -- init global option menu - _iphoneos._MENU_GLOBAL = _iphoneos._MENU_GLOBAL or + iphoneos._MENU_GLOBAL = iphoneos._MENU_GLOBAL or { {} , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" } , {} @@ -91,12 +89,12 @@ function _iphoneos.menu(action) -- get the option menu if action == "config" then - return _iphoneos._MENU_CONFIG + return iphoneos._MENU_CONFIG elseif action == "global" then - return _iphoneos._MENU_GLOBAL + return iphoneos._MENU_GLOBAL end end --- return module: _iphoneos -return _iphoneos +-- return module: iphoneos +return iphoneos diff --git a/xmake/scripts/platform/iphoneos/prober.lua b/xmake/scripts/platform/iphoneos/prober.lua index f28d0a672..d8a1c5330 100644 --- a/xmake/scripts/platform/iphoneos/prober.lua +++ b/xmake/scripts/platform/iphoneos/prober.lua @@ -17,7 +17,7 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _prober.lua +-- @file prober.lua -- -- load modules @@ -26,11 +26,11 @@ local path = require("base/path") local utils = require("base/utils") local string = require("base/string") --- define module: _prober -local _prober = _prober or {} +-- define module: prober +local prober = prober or {} -- probe the architecture -function _prober._probe_arch(configs) +function prober._probe_arch(configs) -- get the architecture local arch = configs.arch @@ -46,7 +46,7 @@ function _prober._probe_arch(configs) end -- probe the xcode application directory -function _prober._probe_xcode(configs) +function prober._probe_xcode(configs) -- get the xcode directory local xcode_dir = configs.xcode_dir @@ -88,7 +88,7 @@ function _prober._probe_xcode(configs) end -- probe the xcode sdk version -function _prober._probe_xcode_sdkver(configs) +function prober._probe_xcode_sdkver(configs) -- get the xcode sdk version local xcode_sdkver = configs.xcode_sdkver @@ -126,18 +126,18 @@ function _prober._probe_xcode_sdkver(configs) end -- probe the configure -function _prober.done(configs, is_global) +function prober.done(configs, is_global) -- probe the architecture - if not _prober._probe_arch(configs) then return end + if not prober._probe_arch(configs) then return end -- probe the xcode application directory - if not _prober._probe_xcode(configs) then return end + if not prober._probe_xcode(configs) then return end -- probe the xcode sdk version - if not is_global and not _prober._probe_xcode_sdkver(configs) then return end + if not is_global and not prober._probe_xcode_sdkver(configs) then return end end --- return module: _prober -return _prober +-- return module: prober +return prober diff --git a/xmake/scripts/platform/iphonesimulator/iphonesimulator.lua b/xmake/scripts/platform/iphonesimulator/iphonesimulator.lua index 4a814691d..a7b0a99ff 100644 --- a/xmake/scripts/platform/iphonesimulator/iphonesimulator.lua +++ b/xmake/scripts/platform/iphonesimulator/iphonesimulator.lua @@ -17,42 +17,40 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _iphonesimulator.lua +-- @file iphonesimulator.lua -- --- define module: _iphonesimulator -local _iphonesimulator = _iphonesimulator or {} +-- define module: iphonesimulator +local iphonesimulator = iphonesimulator or {} -- load modules local config = require("base/config") -- init host -_iphonesimulator._HOST = "macosx" +iphonesimulator._HOST = "macosx" -- init architectures -_iphonesimulator._ARCHS = {"x86", "x64"} +iphonesimulator._ARCHS = {"x86", "x64"} -- make configure -function _iphonesimulator.make(configs) +function iphonesimulator.make(configs) - -- init the file name format - configs.format = {} - configs.format.static = {"lib", ".a"} - configs.format.object = {"", ".o"} - configs.format.shared = {"lib", ".dylib"} - - -- init the compiler - configs.compiler = {} - configs.compiler.cc = config.get("cc") or "xcrun -sdk iphonesimulator clang" - configs.compiler.cxx = config.get("cxx") or "xcrun -sdk iphonesimulator clang++" - configs.compiler.mm = config.get("mm") or configs.compiler.cc - configs.compiler.mxx = config.get("mxx") or configs.compiler.cxx - - -- init the linker - configs.linker = {} - configs.linker.binary = config.get("ld") or "xcrun -sdk iphonesimulator clang++" - configs.linker.static = config.get("ar") or "xcrun -sdk iphonesimulator ar" - configs.linker.shared = config.get("sh") or "xcrun -sdk iphonesimulator clang++" + -- init the file formats + configs.formats = {} + configs.formats.static = {"lib", ".a"} + configs.formats.object = {"", ".o"} + configs.formats.shared = {"lib", ".dylib"} + + -- init the toolchains + configs.tools = {} + configs.tools.make = "make" + configs.tools.cc = config.get("cc") or "xcrun -sdk iphonesimulator clang" + configs.tools.cxx = config.get("cxx") or "xcrun -sdk iphonesimulator clang++" + configs.tools.mm = config.get("mm") or configs.tools.cc + configs.tools.mxx = config.get("mxx") or configs.tools.cxx + configs.tools.ld = config.get("ld") or "xcrun -sdk iphonesimulator clang++" + configs.tools.ar = config.get("ar") or "xcrun -sdk iphonesimulator ar" + configs.tools.sh = config.get("sh") or "xcrun -sdk iphonesimulator clang++" -- init xcode sdk directory configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" .. config.get("xcode_sdkver") .. ".sdk" @@ -60,10 +58,10 @@ function _iphonesimulator.make(configs) end -- get the option menu for action: xmake config or global -function _iphonesimulator.menu(action) +function iphonesimulator.menu(action) -- init config option menu - _iphonesimulator._MENU_CONFIG = _iphonesimulator._MENU_CONFIG or + iphonesimulator._MENU_CONFIG = iphonesimulator._MENU_CONFIG or { {} , {nil, "mm", "kv", nil, "The Objc Compiler" } , {nil, "mxx", "kv", nil, "The Objc++ Compiler" } @@ -80,7 +78,7 @@ function _iphonesimulator.menu(action) , } -- init global option menu - _iphonesimulator._MENU_GLOBAL = _iphonesimulator._MENU_GLOBAL or + iphonesimulator._MENU_GLOBAL = iphonesimulator._MENU_GLOBAL or { {} , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" } , {} @@ -91,12 +89,12 @@ function _iphonesimulator.menu(action) -- get the option menu if action == "config" then - return _iphonesimulator._MENU_CONFIG + return iphonesimulator._MENU_CONFIG elseif action == "global" then - return _iphonesimulator._MENU_GLOBAL + return iphonesimulator._MENU_GLOBAL end end --- return module: _iphonesimulator -return _iphonesimulator +-- return module: iphonesimulator +return iphonesimulator diff --git a/xmake/scripts/platform/iphonesimulator/prober.lua b/xmake/scripts/platform/iphonesimulator/prober.lua index eeb485b86..5b2321e4e 100644 --- a/xmake/scripts/platform/iphonesimulator/prober.lua +++ b/xmake/scripts/platform/iphonesimulator/prober.lua @@ -17,7 +17,7 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _prober.lua +-- @file prober.lua -- -- load modules @@ -26,11 +26,11 @@ local path = require("base/path") local utils = require("base/utils") local string = require("base/string") --- define module: _prober -local _prober = _prober or {} +-- define module: prober +local prober = prober or {} -- probe the architecture -function _prober._probe_arch(configs) +function prober._probe_arch(configs) -- get the architecture local arch = configs.arch @@ -46,7 +46,7 @@ function _prober._probe_arch(configs) end -- probe the xcode application directory -function _prober._probe_xcode(configs) +function prober._probe_xcode(configs) -- get the xcode directory local xcode_dir = configs.xcode_dir @@ -88,7 +88,7 @@ function _prober._probe_xcode(configs) end -- probe the xcode sdk version -function _prober._probe_xcode_sdkver(configs) +function prober._probe_xcode_sdkver(configs) -- get the xcode sdk version local xcode_sdkver = configs.xcode_sdkver @@ -126,18 +126,18 @@ function _prober._probe_xcode_sdkver(configs) end -- probe the configure -function _prober.done(configs, is_global) +function prober.done(configs, is_global) -- probe the architecture - if not _prober._probe_arch(configs) then return end + if not prober._probe_arch(configs) then return end -- probe the xcode application directory - if not _prober._probe_xcode(configs) then return end + if not prober._probe_xcode(configs) then return end -- probe the xcode sdk version - if not is_global and not _prober._probe_xcode_sdkver(configs) then return end + if not is_global and not prober._probe_xcode_sdkver(configs) then return end end --- return module: _prober -return _prober +-- return module: prober +return prober diff --git a/xmake/scripts/platform/linux/linux.lua b/xmake/scripts/platform/linux/linux.lua index 57d436eb5..3cc436d39 100644 --- a/xmake/scripts/platform/linux/linux.lua +++ b/xmake/scripts/platform/linux/linux.lua @@ -17,51 +17,51 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _linux.lua +-- @file linux.lua -- --- define module: _linux -local _linux = _linux or {} +-- define module: linux +local linux = linux or {} -- load modules local config = require("base/config") -- init host -_linux._HOST = "linux" +linux._HOST = "linux" -- init architectures -_linux._ARCHS = {"x86", "x64"} +linux._ARCHS = {"x86", "x64"} -- make configure -function _linux.make(configs) +function linux.make(configs) - -- init the file name format - configs.format = {} - configs.format.static = {"lib", ".a"} - configs.format.object = {"", ".o"} - configs.format.shared = {"lib", ".so"} + -- init the file formats + configs.formats = {} + configs.formats.static = {"lib", ".a"} + configs.formats.object = {"", ".o"} + configs.formats.shared = {"lib", ".so"} end -- get the option menu for action: xmake config or global -function _linux.menu(action) +function linux.menu(action) -- init config option menu - _linux._MENU_CONFIG = _linux._MENU_CONFIG or + linux._MENU_CONFIG = linux._MENU_CONFIG or { {} , {nil, "ar", "kv", nil, "The Library Creator" } , {nil, "arflags", "kv", nil, "The Library Creator Flags" } } -- init global option menu - _linux._MENU_GLOBAL = _linux._MENU_GLOBAL or {} + linux._MENU_GLOBAL = linux._MENU_GLOBAL or {} -- get the option menu if action == "config" then - return _linux._MENU_CONFIG + return linux._MENU_CONFIG elseif action == "global" then - return _linux._MENU_GLOBAL + return linux._MENU_GLOBAL end end --- return module: _linux -return _linux +-- return module: linux +return linux diff --git a/xmake/scripts/platform/linux/prober.lua b/xmake/scripts/platform/linux/prober.lua index 717bd71fe..f8418ff12 100644 --- a/xmake/scripts/platform/linux/prober.lua +++ b/xmake/scripts/platform/linux/prober.lua @@ -17,7 +17,7 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _prober.lua +-- @file prober.lua -- -- load modules @@ -26,11 +26,11 @@ local path = require("base/path") local utils = require("base/utils") local string = require("base/string") --- define module: _prober -local _prober = _prober or {} +-- define module: prober +local prober = prober or {} -- probe the architecture -function _prober._probe_arch(configs) +function prober._probe_arch(configs) -- get the architecture local arch = configs.arch @@ -46,12 +46,12 @@ function _prober._probe_arch(configs) end -- probe the configure -function _prober.done(configs, is_global) +function prober.done(configs, is_global) -- probe the architecture - if not _prober._probe_arch(configs) then return end + if not prober._probe_arch(configs) then return end end --- return module: _prober -return _prober +-- return module: prober +return prober diff --git a/xmake/scripts/platform/macosx/macosx.lua b/xmake/scripts/platform/macosx/macosx.lua index bad818081..9483f2f24 100644 --- a/xmake/scripts/platform/macosx/macosx.lua +++ b/xmake/scripts/platform/macosx/macosx.lua @@ -17,23 +17,23 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _macosx.lua +-- @file macosx.lua -- --- define module: _macosx -local _macosx = _macosx or {} +-- define module: macosx +local macosx = macosx or {} -- load modules local config = require("base/config") -- init host -_macosx._HOST = "macosx" +macosx._HOST = "macosx" -- init architectures -_macosx._ARCHS = {"x86", "x64"} +macosx._ARCHS = {"x86", "x64"} -- make configure -function _macosx.make(configs) +function macosx.make(configs) -- init the file formats configs.formats = {} @@ -57,10 +57,10 @@ function _macosx.make(configs) end -- get the option menu for action: xmake config or global -function _macosx.menu(action) +function macosx.menu(action) -- init config option menu - _macosx._MENU_CONFIG = _macosx._MENU_CONFIG or + macosx._MENU_CONFIG = macosx._MENU_CONFIG or { {} , {nil, "mm", "kv", nil, "The Objc Compiler" } , {nil, "mxx", "kv", nil, "The Objc++ Compiler" } @@ -73,18 +73,18 @@ function _macosx.menu(action) , } -- init global option menu - _macosx._MENU_GLOBAL = _macosx._MENU_GLOBAL or + macosx._MENU_GLOBAL = macosx._MENU_GLOBAL or { {} , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" } , } -- get the option menu if action == "config" then - return _macosx._MENU_CONFIG + return macosx._MENU_CONFIG elseif action == "global" then - return _macosx._MENU_GLOBAL + return macosx._MENU_GLOBAL end end --- return module: _macosx -return _macosx +-- return module: macosx +return macosx diff --git a/xmake/scripts/platform/macosx/prober.lua b/xmake/scripts/platform/macosx/prober.lua index 9e722d4d0..0c6aa4a67 100644 --- a/xmake/scripts/platform/macosx/prober.lua +++ b/xmake/scripts/platform/macosx/prober.lua @@ -17,7 +17,7 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _prober.lua +-- @file prober.lua -- -- load modules @@ -26,11 +26,11 @@ local path = require("base/path") local utils = require("base/utils") local string = require("base/string") --- define module: _prober -local _prober = _prober or {} +-- define module: prober +local prober = prober or {} -- probe the architecture -function _prober._probe_arch(configs) +function prober._probe_arch(configs) -- get the architecture local arch = configs.arch @@ -46,7 +46,7 @@ function _prober._probe_arch(configs) end -- probe the xcode application directory -function _prober._probe_xcode(configs) +function prober._probe_xcode(configs) -- get the xcode directory local xcode_dir = configs.xcode_dir @@ -88,7 +88,7 @@ function _prober._probe_xcode(configs) end -- probe the xcode sdk version -function _prober._probe_xcode_sdkver(configs) +function prober._probe_xcode_sdkver(configs) -- get the xcode sdk version local xcode_sdkver = configs.xcode_sdkver @@ -126,18 +126,18 @@ function _prober._probe_xcode_sdkver(configs) end -- probe the configure -function _prober.done(configs, is_global) +function prober.done(configs, is_global) -- probe the architecture - if not _prober._probe_arch(configs) then return end + if not prober._probe_arch(configs) then return end -- probe the xcode application directory - if not _prober._probe_xcode(configs) then return end + if not prober._probe_xcode(configs) then return end -- probe the xcode sdk version - if not is_global and not _prober._probe_xcode_sdkver(configs) then return end + if not is_global and not prober._probe_xcode_sdkver(configs) then return end end --- return module: _prober -return _prober +-- return module: prober +return prober diff --git a/xmake/scripts/platform/windows/windows.lua b/xmake/scripts/platform/msvc/msvc.lua index 5a7b48c72..332b2b5f7 100644 --- a/xmake/scripts/platform/windows/windows.lua +++ b/xmake/scripts/platform/msvc/msvc.lua @@ -17,23 +17,23 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _windows.lua +-- @file msvc.lua -- --- define module: _windows -local _windows = _windows or {} +-- define module: msvc +local msvc = msvc or {} -- load modules local config = require("base/config") -- init host -_windows._HOST = "windows" +msvc._HOST = "windows" -- init architectures -_windows._ARCHS = {"x86", "x64"} +msvc._ARCHS = {"x86", "x64"} -- make configure -function _windows.make(configs) +function msvc.make(configs) -- init the file formats configs.formats = {} @@ -43,45 +43,39 @@ function _windows.make(configs) configs.formats.binary = {"", ".exe"} -- init the toolchains - configs.tools = {} + configs.tools = {} configs.tools.make = "nmake" - - -- init the compiler - configs.compiler = {} - configs.compiler.cc = config.get("cc") or "cl.exe" - configs.compiler.cxx = config.get("cxx") or "cl.exe" - - -- init the linker - configs.linker = {} - configs.linker.binary = config.get("ld") or "link.exe" - configs.linker.static = config.get("ar") or "link.exe" - configs.linker.shared = config.get("sh") or "link.exe" + configs.tools.cc = config.get("cc") or "cl" + configs.tools.cxx = config.get("cxx") or "cl" + configs.tools.ld = config.get("ld") or "link" + configs.tools.ar = config.get("ar") or "link" + configs.tools.sh = config.get("sh") or "link" end -- get the option menu for action: xmake config or global -function _windows.menu(action) +function msvc.menu(action) -- init config option menu - _windows._MENU_CONFIG = _windows._MENU_CONFIG or + msvc._MENU_CONFIG = msvc._MENU_CONFIG or { {} , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" } , } -- init global option menu - _windows._MENU_GLOBAL = _windows._MENU_GLOBAL or + msvc._MENU_GLOBAL = msvc._MENU_GLOBAL or { {} , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" } , } -- get the option menu if action == "config" then - return _windows._MENU_CONFIG + return msvc._MENU_CONFIG elseif action == "global" then - return _windows._MENU_GLOBAL + return msvc._MENU_GLOBAL end end --- return module: _windows -return _windows +-- return module: msvc +return msvc diff --git a/xmake/scripts/platform/windows/prober.lua b/xmake/scripts/platform/msvc/prober.lua index 0eb5d0157..b5d2947af 100644 --- a/xmake/scripts/platform/windows/prober.lua +++ b/xmake/scripts/platform/msvc/prober.lua @@ -17,7 +17,7 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _prober.lua +-- @file prober.lua -- -- load modules @@ -26,11 +26,11 @@ local path = require("base/path") local utils = require("base/utils") local string = require("base/string") --- define module: _prober -local _prober = _prober or {} +-- define module: prober +local prober = prober or {} -- probe the architecture -function _prober._probe_arch(configs) +function prober._probe_arch(configs) -- get the architecture local arch = configs.arch @@ -46,7 +46,7 @@ function _prober._probe_arch(configs) end -- probe the vs version -function _prober._probe_vs_version(configs) +function prober._probe_vs_version(configs) -- get the vs version local vs = configs.vs @@ -98,7 +98,7 @@ function _prober._probe_vs_version(configs) end -- probe the vs path -function _prober._probe_vs_path(configs) +function prober._probe_vs_path(configs) -- ok? if configs.__vsenv_path then return true end @@ -186,18 +186,18 @@ function _prober._probe_vs_path(configs) end -- probe the configure -function _prober.done(configs, is_global) +function prober.done(configs, is_global) -- probe the architecture - if not _prober._probe_arch(configs) then return end + if not prober._probe_arch(configs) then return end -- probe the vs version - if not _prober._probe_vs_version(configs) then return end + if not prober._probe_vs_version(configs) then return end -- probe the vs path - if not _prober._probe_vs_path(configs) then return end + if not prober._probe_vs_path(configs) then return end end --- return module: _prober -return _prober +-- return module: prober +return prober diff --git a/xmake/scripts/compiler/_msvc.lua b/xmake/scripts/platform/msvc/tools/cl.lua index aa1968f7e..a8ab807a7 100644 --- a/xmake/scripts/compiler/_msvc.lua +++ b/xmake/scripts/platform/msvc/tools/cl.lua @@ -17,11 +17,11 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _msvc.lua +-- @file cl.lua -- --- define module: _msvc -local _msvc = _msvc or {} +-- define module: cl +local cl = cl or {} -- load modules local utils = require("base/utils") @@ -29,47 +29,50 @@ local string = require("base/string") local config = require("base/config") -- init the compiler -function _msvc._init(configs) - - -- the architecture - local arch = config.get("arch") - assert(arch) +function cl.init(name) -- init cflags - configs.cflags = "-nologo" + cl.cflags = "-nologo" -- init cxxflags - configs.cxxflags = "-nologo" + cl.cxxflags = "-nologo" end -- make the compiler command -function _msvc._make(configs, srcfile, objfile, flags) +function cl.command_compile(srcfile, objfile, flags) -- make it - return string.format("%s -c %s -Fo%s %s", configs.name, flags, objfile, srcfile) + return string.format("cl.exe -c %s -Fo%s %s", flags, objfile, srcfile) end -- make the define flag -function _msvc._make_define(configs, define) +function cl.flag_define(define) -- make it return "-D" .. define end -- make the includedir flag -function _msvc._make_includedir(configs, includedir) +function cl.flag_includedir(includedir) -- make it return "-I" .. includedir end -- map gcc flag to the current compiler flag -function _msvc._mapflag(configs, flag) +function cl.flag_map(flag) -- ok return flag end --- return module: _msvc -return _msvc +-- the main function +function cl.main(...) + + -- ok + return true +end + +-- return module: cl +return cl diff --git a/xmake/scripts/linker/_msvc.lua b/xmake/scripts/platform/msvc/tools/link.lua index 94ee00349..52528ca6c 100644 --- a/xmake/scripts/linker/_msvc.lua +++ b/xmake/scripts/platform/msvc/tools/link.lua @@ -17,20 +17,19 @@ -- Copyright (C) 2009 - 2015, ruki All rights reserved. -- -- @author ruki --- @file _msvc.lua +-- @file link.lua -- --- define module: _msvc -local _msvc = _msvc or {} +-- define module: link +local link = link or {} -- load modules -local rule = require("base/rule") local utils = require("base/utils") local string = require("base/string") local config = require("base/config") --- init the linker -function _msvc._init(configs) +-- init the compiler +function link.init(name) -- the architecture local arch = config.get("arch") @@ -43,43 +42,49 @@ function _msvc._init(configs) end -- init ldflags - configs.ldflags = "-nologo -dynamicbase -nxcompat -manifest -manifestuac:\"level='asInvoker' uiAccess='false'\" " .. flags_arch + link.ldflags = "-nologo -dynamicbase -nxcompat -manifest -manifestuac:\"level='asInvoker' uiAccess='false'\" " .. flags_arch -- init arflags - configs.arflags = "-lib -nologo " .. flags_arch + link.arflags = "-lib -nologo " .. flags_arch -- init shflags - configs.shflags = "-dll -nologo " .. flags_arch - + link.shflags = "-dll -nologo " .. flags_arch end --- make the command -function _msvc._make(configs, objfiles, targetfile, flags) +-- make the linker command +function link.command_link(objfiles, targetfile, flags) -- make it - return string.format("%s %s -out:%s %s", configs.name, flags, targetfile, objfiles) + return string.format("link.exe %s -out:%s %s", flags, targetfile, objfiles) end -- make the link flag -function _msvc._make_link(configs, link) +function link.flag_link(link) -- make it return link .. ".lib" end -- make the linkdir flag -function _msvc._make_linkdir(configs, linkdir) +function link.flag_linkdir(linkdir) -- make it return "-libpath:" .. linkdir end --- map gcc flag to the current linker flag -function _msvc._mapflag(configs, flag) +-- map gcc flag to the current compiler flag +function link.flag_map(flag) -- ok return flag end --- return module: _msvc -return _msvc +-- the main function +function link.main(...) + + -- ok + return true +end + +-- return module: link +return link diff --git a/xmake/scripts/platform/windows/tools/nmake.lua b/xmake/scripts/platform/msvc/tools/nmake.lua index 6d6b21258..6d6b21258 100644 --- a/xmake/scripts/platform/windows/tools/nmake.lua +++ b/xmake/scripts/platform/msvc/tools/nmake.lua |
