summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-04-21 11:21:50 +0800
committerruki <[email protected]>2016-04-21 11:21:50 +0800
commit6f8d1fe8d6451d403e6c2ec72b630bb500b10b4d (patch)
tree63dbdf458f9c2b200fe6e1ff2c5e751a50e10e04
parent655f4fc9f27d19bb02eb6f131412f88db42f4253 (diff)
reimpl platform and it's menu
-rwxr-xr-xxmake/actions/clean/xmake.lua22
-rwxr-xr-xxmake/actions/config/xmake.lua18
-rwxr-xr-xxmake/actions/create/xmake.lua2
-rwxr-xr-xxmake/actions/global/xmake.lua4
-rwxr-xr-xxmake/actions/install/xmake.lua2
-rwxr-xr-xxmake/actions/lua/xmake.lua2
-rwxr-xr-xxmake/actions/package/xmake.lua10
-rwxr-xr-xxmake/actions/run/xmake.lua2
-rwxr-xr-xxmake/actions/uninstall/xmake.lua2
-rw-r--r--xmake/core/platform/menu.lua99
-rw-r--r--xmake/core/platform/platform.lua352
-rw-r--r--xmake/core/platform/platforms/android/android.lua120
-rw-r--r--xmake/core/platform/platforms/android/prober.lua269
-rw-r--r--xmake/core/platform/platforms/iphoneos/iphoneos.lua141
-rw-r--r--xmake/core/platform/platforms/iphoneos/prober.lua310
-rw-r--r--xmake/core/platform/platforms/iphonesimulator/iphonesimulator.lua138
-rw-r--r--xmake/core/platform/platforms/iphonesimulator/prober.lua308
-rw-r--r--xmake/core/platform/platforms/linux/linux.lua103
-rw-r--r--xmake/core/platform/platforms/linux/prober.lua198
-rw-r--r--xmake/core/platform/platforms/macosx/macosx.lua140
-rw-r--r--xmake/core/platform/platforms/macosx/prober.lua307
-rw-r--r--xmake/core/platform/platforms/mingw/mingw.lua93
-rw-r--r--xmake/core/platform/platforms/mingw/prober.lua207
-rw-r--r--xmake/core/platform/platforms/watchos/prober.lua310
-rw-r--r--xmake/core/platform/platforms/watchos/watchos.lua141
-rw-r--r--xmake/core/platform/platforms/watchsimulator/prober.lua308
-rw-r--r--xmake/core/platform/platforms/watchsimulator/watchsimulator.lua138
-rw-r--r--xmake/core/platform/platforms/windows/prober.lua299
-rw-r--r--xmake/core/platform/platforms/windows/windows.lua144
-rw-r--r--xmake/core/sandbox/modules/import/core/platform/menu.lua41
-rw-r--r--xmake/core/sandbox/modules/import/core/platform/platform.lua30
-rw-r--r--xmake/core/sandbox/modules/insert.lua26
-rwxr-xr-xxmake/platforms/macosx/xmake.lua127
33 files changed, 463 insertions, 3950 deletions
diff --git a/xmake/actions/clean/xmake.lua b/xmake/actions/clean/xmake.lua
index 41ef2fbc0..f0fdf3516 100755
--- a/xmake/actions/clean/xmake.lua
+++ b/xmake/actions/clean/xmake.lua
@@ -1,3 +1,25 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2015 - 2016, ruki All rights reserved.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
-- define task
task("clean")
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index 57ab7062a..98b0f213e 100755
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file config.lua
+-- @file xmake.lua
--
-- define task
@@ -51,12 +51,12 @@ task("config")
-- show the description of all platforms
, function ()
- -- import platform menu
- import("core.platform.menu")
+ -- import platform
+ import("core.platform.platform")
-- make description
local description = {}
- for i, plat in ipairs(menu.plats()) do
+ for i, plat in ipairs(platform.plats()) do
description[i] = " - " .. plat
end
@@ -68,14 +68,14 @@ task("config")
-- show the description of all architectures
, function ()
- -- import platform menu
- import("core.platform.menu")
+ -- import platform
+ import("core.platform.platform")
-- make description
local description = {}
- for i, plat in ipairs(menu.plats()) do
+ for i, plat in ipairs(platform.plats()) do
description[i] = " - " .. plat .. ":"
- for _, arch in ipairs(menu.archs(plat)) do
+ for _, arch in ipairs(platform.archs(plat)) do
description[i] = description[i] .. " " .. arch
end
end
@@ -148,7 +148,7 @@ task("config")
import("core.platform.menu")
-- get config menu options
- return menu.options_config()
+ return menu.options("config")
end
, {'o', "buildir", "kv", "build", "Set the build directory." }
diff --git a/xmake/actions/create/xmake.lua b/xmake/actions/create/xmake.lua
index b0c2bfddb..5f95779f1 100755
--- a/xmake/actions/create/xmake.lua
+++ b/xmake/actions/create/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file create.lua
+-- @file xmake.lua
--
-- define task
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua
index 9f5123fb2..fd53c94cf 100755
--- a/xmake/actions/global/xmake.lua
+++ b/xmake/actions/global/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file global.lua
+-- @file xmake.lua
--
-- define task
@@ -57,7 +57,7 @@ task("global")
import("core.platform.menu")
-- get global menu options
- return menu.options_global()
+ return menu.options("global")
end
}
diff --git a/xmake/actions/install/xmake.lua b/xmake/actions/install/xmake.lua
index db11df04a..f3c194760 100755
--- a/xmake/actions/install/xmake.lua
+++ b/xmake/actions/install/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file install.lua
+-- @file xmake.lua
--
-- define task
diff --git a/xmake/actions/lua/xmake.lua b/xmake/actions/lua/xmake.lua
index dc34eda56..bc8da9c70 100755
--- a/xmake/actions/lua/xmake.lua
+++ b/xmake/actions/lua/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file lua.lua
+-- @file xmake.lua
--
-- define task
diff --git a/xmake/actions/package/xmake.lua b/xmake/actions/package/xmake.lua
index 7bc4b59dc..618c70c52 100755
--- a/xmake/actions/package/xmake.lua
+++ b/xmake/actions/package/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file package.lua
+-- @file xmake.lua
--
-- define task
@@ -46,14 +46,14 @@ task("package")
-- show the description of all architectures
, function ()
- -- import platform menu
- import("core.platform.menu")
+ -- import platform
+ import("core.platform.platform")
-- make description
local description = {}
- for i, plat in ipairs(menu.plats()) do
+ for i, plat in ipairs(platform.plats()) do
description[i] = " - " .. plat .. ":"
- for _, arch in ipairs(menu.archs(plat)) do
+ for _, arch in ipairs(platform.archs(plat)) do
description[i] = description[i] .. " " .. arch
end
end
diff --git a/xmake/actions/run/xmake.lua b/xmake/actions/run/xmake.lua
index 6353c8511..d161c8dbc 100755
--- a/xmake/actions/run/xmake.lua
+++ b/xmake/actions/run/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file run.lua
+-- @file xmake.lua
--
-- define task
diff --git a/xmake/actions/uninstall/xmake.lua b/xmake/actions/uninstall/xmake.lua
index 992cf3a91..c871f1b3b 100755
--- a/xmake/actions/uninstall/xmake.lua
+++ b/xmake/actions/uninstall/xmake.lua
@@ -17,7 +17,7 @@
-- Copyright (C) 2015 - 2016, ruki All rights reserved.
--
-- @author ruki
--- @file uninstall.lua
+-- @file xmake.lua
--
-- define task
diff --git a/xmake/core/platform/menu.lua b/xmake/core/platform/menu.lua
new file mode 100644
index 000000000..2c42ee91f
--- /dev/null
+++ b/xmake/core/platform/menu.lua
@@ -0,0 +1,99 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2015 - 2016, ruki All rights reserved.
+--
+-- @author ruki
+-- @file menu.lua
+--
+
+-- define module
+local menu = menu or {}
+
+-- load modules
+local os = require("base/os")
+local path = require("base/path")
+local utils = require("base/utils")
+local table = require("base/table")
+local platform = require("platform/platform")
+
+-- get the option menu for action: xmake config or global
+function menu.options(action)
+
+ -- check
+ assert(action)
+
+ -- get all platforms
+ local plats = platform.plats()
+ assert(plats)
+
+ -- load and merge all platform options
+ local exist = {}
+ local results = {}
+ for _, plat in ipairs(plats) do
+
+ -- load platform
+ local instance, errors = platform.load(plat)
+ if not instance then
+ return nil, errors
+ end
+
+ -- get menu
+ local menu = instance:menu()
+ if menu then
+
+ -- get the options for this action
+ local options = menu[action]
+ if options then
+
+ -- exists options?
+ local exists = false
+ for _, option in ipairs(options) do
+ local name = option[2]
+ if name and not exist[name] then
+ exists = true
+ break
+ end
+ end
+
+ -- merge it and remove repeat if exists options
+ if exists then
+
+ -- get the platform option
+ for _, option in ipairs(options) do
+
+ -- merge it and remove repeat
+ local name = option[2]
+ if name then
+ if not exist[name] then
+ table.insert(results, option)
+ exist[name] = true
+ end
+ else
+ table.insert(results, option)
+ end
+ end
+ end
+ end
+ end
+ end
+
+ -- ok?
+ return results
+end
+
+-- return module
+return menu
diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua
index 1d454178d..ee16dc4d3 100644
--- a/xmake/core/platform/platform.lua
+++ b/xmake/core/platform/platform.lua
@@ -20,189 +20,179 @@
-- @file platform.lua
--
--- define module: platform
-local platform = platform or {}
+-- define module
+local platform = platform or {}
+local _instance = _instance or {}
-- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local config = require("project/config")
-local global = require("project/global")
+local os = require("base/os")
+local path = require("base/path")
+local utils = require("base/utils")
+local table = require("base/table")
+local interpreter = require("base/interpreter")
+local config = require("project/config")
+local global = require("project/global")
--- the directories of platforms
-function platform._directories()
+-- get the platform os
+function _instance:os()
- return { path.join(global.directory(), "platforms")
- , path.join(xmake._CORE_DIR, "platform/platforms")
- }
+ -- get it
+ return self._INFO.os
end
--- load the given platform from the given directory
-function platform._load_from(dir, plat)
+-- get the platform menu
+function _instance:menu()
- -- the platform file path
- local filepath = path.join(dir, plat, plat .. ".lua")
- if os.isfile(filepath) then
+ -- get it
+ return self._INFO.menu
+end
- -- load script
- local script = loadfile(filepath)
- if script then
+-- get the platform hosts
+function _instance:hosts()
- -- load module
- local module = script()
- if module then
+ -- get it
+ return self._INFO.hosts
+end
- -- save directory
- module._DIRECTORY = path.directory(filepath)
- assert(module._DIRECTORY)
+-- get the platform archs
+function _instance:archs()
- -- ok
- return module
- end
- end
- end
+ -- get it
+ return self._INFO.archs
end
--- load the given platform
-function platform._load(plat)
+-- the directories of platform
+function platform._directories()
- -- check
- assert(plat)
+ -- the directories
+ return { path.join(config.directory(), "platforms")
+ , path.join(global.directory(), "platforms")
+ , path.join(xmake._PROGRAM_DIR, "platforms")
+ }
+end
- -- the module
- platform._MODULES = platform._MODULES or {}
- local module = platform._MODULES[plat]
+-- the interpreter
+function platform._interpreter()
- -- return it directory if ok
- if module then return module end
+ -- the interpreter has been initialized? return it directly
+ if platform._INTERPRETER then
+ return platform._INTERPRETER
+ end
- -- load module
- local dirs = platform._directories()
- for _, dir in ipairs(dirs) do
+ -- init interpreter
+ local interp = interpreter.new()
+ assert(interp)
+
+ -- register api: platform()
+ interp:api_register_scope("platform")
- module = platform._load_from(dir, plat)
- if module then
- break
- end
+ -- register api: set_platform_os()
+ interp:api_register_set_values("platform", "platform", "os")
- end
+ -- register api: set_platform_hosts()
+ interp:api_register_set_values("platform", "platform", "hosts")
- -- cache it if ok
- if module then
- platform._MODULES[plat] = module
- end
+ -- register api: set_platform_archs()
+ interp:api_register_set_values("platform", "platform", "archs")
- -- ok?
- return module
-end
+ -- register api: set_platform_menu()
+ interp:api_register_set_values("platform", "platform", "menu")
--- get the current platform module
-function platform.module()
+ -- register api: on_platform_load()
+ interp:api_register_on_script("platform", "platform", "load")
- -- get the platform
- local plat = config.get("plat")
- if plat then
- -- load it
- return platform._load(plat)
- end
+ -- save interpreter
+ platform._INTERPRETER = interp
+
+ -- ok?
+ return interp
end
--- get the current platform module directory
-function platform.directory()
+-- load the given platform
+function platform.load(plat)
- -- load it
- local module = platform.module()
- if module then
- return module._DIRECTORY
+ -- get platform name
+ plat = plat or config.get("plat")
+ if not plat then
+ return nil, string.format("unknown platform!")
end
-end
--- load the configure of the given platform
-function platform.load(plat)
+ -- get it directly from cache dirst
+ platform._PLATFORMS = platform._PLATFORMS or {}
+ if platform._PLATFORMS[plat] then
+ return platform._PLATFORMS[plat]
+ end
- -- check
- assert(plat)
+ -- find the platform script path
+ local scriptpath = nil
+ for _, dir in ipairs(platform._directories()) do
- -- the configure
- platform._CONFIGS = platform._CONFIGS or {}
- local configs = platform._CONFIGS[plat]
+ -- find this directory
+ scriptpath = path.join(path.join(dir, plat), "xmake.lua")
+ if os.isfile(scriptpath) then
+ break
+ end
+ end
- -- return it directly if exists
- if configs then
- return configs
+ -- not exists?
+ if not scriptpath or not os.isfile(scriptpath) then
+ return nil, string.format("the platform %s not found!", plat)
end
-- load platform
- local module = platform._load(plat)
- if module then
-
- -- init configure
- platform._CONFIGS[plat]= {}
- configs = platform._CONFIGS[plat]
-
- -- make configure
- module.make(configs)
+ local results, errors = platform._interpreter():load(scriptpath, "platform", true, false)
+ if not results and os.isfile(scriptpath) then
+ -- failed
+ return nil, errors
end
- -- ok?
- return configs
-end
-
--- get the platform os
-function platform.os()
+ -- check the platform name
+ if not results[plat] then
+ return nil, string.format("the platform %s not found!", plat)
+ end
- -- get module
- local module = platform.module()
- if not module then return end
+ -- new an instance
+ local instance = table.inherit(_instance)
- -- ok?
- return module._OS
-end
+ -- save name and info
+ instance._NAME = plat
+ instance._INFO = results[plat]
--- get the given configure
-function platform.get(name)
+ -- save instance to the cache
+ platform._PLATFORMS[plat] = instance
- -- check
- assert(platform._CONFIGS)
+ -- ok
+ return instance
- -- get the current platform configure
- local configs = platform.load(config.get("plat"))
- if configs then
- -- get it
- return configs[name]
- end
end
--- get the given tool
-function platform.tool(name)
-
- -- check
- assert(name)
+-- get the platform os
+function platform.os(plat)
- -- get tools
- local tools = platform.get("tools")
- if tools then
- return tools[name]
+ -- load the platform
+ local instance = platform.load(plat)
+ if not instance then
+ return
end
+ -- get it
+ return instance:os()
end
--- get the given format
-function platform.format(kind)
-
- -- check
- assert(kind)
+-- get the platform archs
+function platform.archs(plat)
- -- get formats
- local formats = platform.get("formats")
- if formats then
- return formats[kind]
+ -- load the platform
+ local instance = platform.load(plat)
+ if not instance then
+ return
end
+ -- get it
+ return instance:archs()
end
--- list all platforms
+-- get the all platforms
function platform.plats()
-- return it directly if exists
@@ -210,104 +200,28 @@ function platform.plats()
return platform._PLATS
end
- -- make list
- local list = {}
- local dirs = platform._directories()
+ -- get all platforms
+ local plats = {}
+ local dirs = platform._directories()
for _, dir in ipairs(dirs) do
-- get the platform list
- local plats = os.match(path.join(dir, "*"), true)
- if plats then
- for _, v in ipairs(plats) do
- table.insert(list, path.basename(v))
+ local platpathes = os.match(path.join(dir, "*"), true)
+ if platpathes then
+ for _, platpath in ipairs(platpathes) do
+ if os.isfile(path.join(platpath, "xmake.lua")) then
+ table.insert(plats, path.basename(platpath))
+ end
end
end
-
end
- -- save it
- platform._PLATS = list
+ -- save them
+ platform._PLATS = plats
-- ok
- return list
-end
-
--- list all architectures
-function platform.archs(plat)
-
- -- check
- assert(plat)
-
- -- load all platform configs
- local archs = {}
- local module = platform._load(plat)
- if module and module._ARCHS then
- for _, arch in ipairs(module._ARCHS) do
- table.insert(archs, arch)
- end
- end
-
- -- ok
- return archs
-end
-
--- get the option menu for action: xmake config or global
-function platform.menu(action)
-
- -- check
- assert(action)
-
- -- get all platforms
- local plats = platform.plats()
- assert(plats)
-
- -- load and merge all platform menus
- local menus = {}
- local exist = {}
- for _, plat in ipairs(plats) do
-
- -- load platform
- local module = platform._load(plat)
- if module and module.menu then
-
- -- get the platform menu
- local menu = module.menu(action)
- if menu then
-
- -- exists options?
- local exists = false
- for _, option in ipairs(menu) do
- local name = option[2]
- if name and not exist[name] then
- exists = true
- break
- end
- end
-
- -- merge it and remove repeat if exists options
- if exists then
- -- get the platform menu option
- for _, option in ipairs(menu) do
-
- -- merge it and remove repeat
- local name = option[2]
- if name then
- if not exist[name] then
- table.insert(menus, option)
- exist[name] = true
- end
- else
- table.insert(menus, option)
- end
- end
- end
- end
- end
- end
-
- -- get all platform menus
- return menus
+ return plats
end
--- return module: platform
+-- return module
return platform
diff --git a/xmake/core/platform/platforms/android/android.lua b/xmake/core/platform/platforms/android/android.lua
deleted file mode 100644
index 961d83dcc..000000000
--- a/xmake/core/platform/platforms/android/android.lua
+++ /dev/null
@@ -1,120 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file android.lua
---
-
--- define module: android
-local android = android or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-android._HOST = xmake._HOST
-
--- init os
-android._OS = "android"
-
--- init architectures
-android._ARCHS = {"armv5te", "armv6", "armv7-a", "armv8-a", "arm64-v8a"}
-
--- make configure
-function android.make(configs)
-
- -- init the file formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"lib", ".so"}
-
- -- init the toolchains
- configs.tools = {}
- configs.tools.make = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.as = config.get("as")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
-
- -- init flags
- local arch = config.get("arch")
- if arch:startswith("arm64") then
- configs.cxflags = {}
- configs.asflags = {}
- configs.ldflags = {"-llog"}
- configs.shflags = {"-llog"}
- else
- configs.cxflags = { "-march=" .. arch, "-mthumb"}
- configs.asflags = { "-march=" .. arch, "-mthumb"}
- configs.ldflags = { "-march=" .. arch, "-llog", "-mthumb"}
- configs.shflags = { "-march=" .. arch, "-llog", "-mthumb"}
- end
-
- -- add flags for the sdk directory of ndk
- local ndk = config.get("ndk")
- local ndk_sdkver = config.get("ndk_sdkver")
- if ndk and ndk_sdkver then
- local ndk_sdkdir = path.translate(string.format("%s/platforms/android-%d", ndk, ndk_sdkver))
- if arch:startswith("arm64") then
- table.insert(configs.cxflags, string.format("--sysroot=%s/arch-arm64", ndk_sdkdir))
- table.insert(configs.asflags, string.format("--sysroot=%s/arch-arm64", ndk_sdkdir))
- table.insert(configs.ldflags, string.format("--sysroot=%s/arch-arm64", ndk_sdkdir))
- table.insert(configs.shflags, string.format("--sysroot=%s/arch-arm64", ndk_sdkdir))
- else
- table.insert(configs.cxflags, string.format("--sysroot=%s/arch-arm", ndk_sdkdir))
- table.insert(configs.asflags, string.format("--sysroot=%s/arch-arm", ndk_sdkdir))
- table.insert(configs.ldflags, string.format("--sysroot=%s/arch-arm", ndk_sdkdir))
- table.insert(configs.shflags, string.format("--sysroot=%s/arch-arm", ndk_sdkdir))
- end
- end
-
-end
-
--- get the option menu for action: xmake config or global
-function android.menu(action)
-
- -- init config option menu
- 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
- { {}
- , {nil, "ndk", "kv", nil, "The NDK Directory" }
- , {nil, "ndk_sdkver", "kv", "auto", "The SDK Version for NDK" }
- , }
-
- -- get the option menu
- if action == "config" then
- return android._MENU_CONFIG
- elseif action == "global" then
- return android._MENU_GLOBAL
- end
-end
-
--- return module: android
-return android
diff --git a/xmake/core/platform/platforms/android/prober.lua b/xmake/core/platform/platforms/android/prober.lua
deleted file mode 100644
index 8a37630fe..000000000
--- a/xmake/core/platform/platforms/android/prober.lua
+++ /dev/null
@@ -1,269 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", "armv7-a")
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the sdk version for ndk
-function prober._probe_ndk_sdkver(configs)
-
- -- ok?
- local ndk_sdkver = configs.get("ndk_sdkver")
- if ndk_sdkver then return true end
-
- -- get the ndk
- local ndk = configs.get("ndk")
- if ndk then
-
- -- match all sdk directories
- local sdkdirs = os.match(ndk .. "/platforms/android-*", true)
- if sdkdirs then
-
- -- get the max version
- local version_maxn = 0
- for _, sdkdir in ipairs(sdkdirs) do
- local filename = path.filename(sdkdir)
- local version, count = filename:gsub("android%-", "")
- if count > 0 then
- version = tonumber(version)
- if version > version_maxn then version_maxn = version end
- end
- end
-
- -- save the version
- if version_maxn > 0 then ndk_sdkver = version_maxn end
- end
- end
-
- -- probe ok? update it
- if type(ndk_sdkver) == "number" and ndk_sdkver > 0 then
-
- -- save it
- configs.set("ndk_sdkver", ndk_sdkver)
-
- -- trace
- utils.printf("checking for the SDK version of NDK ... %s", string.format("android-%d", ndk_sdkver))
- else
-
- -- trace
- utils.printf("checking for the SDK version of NDK ... no")
- end
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolpath(configs, kind, cross, name, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- attempt to get it from the given cross toolchains
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to get it from the ndk
- if not toolpath then
- local ndk = configs.get("ndk")
- if ndk then
-
- -- match all toolchains
- local arch = configs.get("arch")
- if arch and arch:startswith("arm64") then
- toolchains = os.match(string.format("%s/toolchains/aarch64-linux-android-**/prebuilt/*/bin/%s%s", ndk, cross, name))
- else
- toolchains = os.match(string.format("%s/toolchains/arm-linux-androideabi-**/prebuilt/*/bin/%s%s", ndk, cross, name))
- end
-
- -- probe the tool path
- if toolchains then
- for _, filepath in ipairs(toolchains) do
- toolpath = tool.check(cross .. name, path.directory(filepath))
- if toolpath then break end
- end
- end
- end
- end
-
- -- probe ok? update it
- if toolpath then configs.set(kind, toolpath) end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- failed?
- if not toolpath and not configs.get("ndk") then
- utils.error("checking for the NDK directory ... no")
- utils.error(" - xmake config --ndk=xxx")
- utils.error("or - xmake global --ndk=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- init prefix
- local prefix = "arm-linux-androideabi-"
- local arch = configs.get("arch")
- if arch and arch:startswith("arm64") then
- prefix = "aarch64-linux-android-"
- end
-
- -- done
- if not prober._probe_toolpath(configs, "cc", prefix, "gcc", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", prefix, "g++", "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", prefix, "gcc", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", prefix, "g++", "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", prefix, "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", prefix, "g++", "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", prefix, "swiftc", "the swift compiler") then return false end
-
- -- ok
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_ndk_sdkver
- , prober._probe_toolchains}
- , nil
- , config)
-
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_make
- , prober._probe_ccache
- , prober._probe_ndk_sdkver}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/iphoneos/iphoneos.lua b/xmake/core/platform/platforms/iphoneos/iphoneos.lua
deleted file mode 100644
index 0336cc0b2..000000000
--- a/xmake/core/platform/platforms/iphoneos/iphoneos.lua
+++ /dev/null
@@ -1,141 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file iphoneos.lua
---
-
--- define module: iphoneos
-local iphoneos = iphoneos or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-iphoneos._HOST = "macosx"
-
--- init os
-iphoneos._OS = "ios"
-
--- init architectures
-iphoneos._ARCHS = {"armv7", "armv7s", "arm64"}
-
--- make configure
-function iphoneos.make(configs)
-
- -- 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 = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.mm = config.get("mm")
- configs.tools.mxx = config.get("mxx")
- configs.tools.as = config.get("as")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
- configs.tools.lipo = config.get("lipo")
-
- -- init target minimal version
- local target_minver = config.get("target_minver")
- assert(target_minver)
-
- -- init flags for architecture
- local archflags = nil
- local arch = config.get("arch")
- if arch then archflags = "-arch " .. arch end
- configs.cxflags = { archflags, "-miphoneos-version-min=" .. target_minver }
- configs.mxflags = { archflags, "-miphoneos-version-min=" .. target_minver }
- configs.asflags = { archflags, "-miphoneos-version-min=" .. target_minver }
- configs.ldflags = { archflags, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-miphoneos-version-min=" .. target_minver }
- configs.shflags = { archflags, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-miphoneos-version-min=" .. target_minver }
- if arch then
- configs.scflags = { string.format("-target %s-apple-ios%s", arch, target_minver) }
- end
-
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- if xcode_dir and xcode_sdkver then
-
- -- init flags
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. xcode_sdkver .. ".sdk"
- table.insert(configs.cxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.asflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.mxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.ldflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.shflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.scflags, "-sdk " .. xcode_sdkdir)
-
- -- save swift link directory
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos")
- end
-
-end
-
--- get the option menu for action: xmake config or global
-function iphoneos.menu(action)
-
- -- init config option menu
- iphoneos._MENU_CONFIG = iphoneos._MENU_CONFIG or
- { {}
- , {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mxx", "kv", nil, "The Objc++ Compiler" }
- , {nil, "mflags", "kv", nil, "The Objc Compiler Flags" }
- , {nil, "mxflags", "kv", nil, "The Objc/c++ Compiler Flags" }
- , {nil, "mxxflags", "kv", nil, "The Objc++ Compiler Flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "The SDK Version for Xcode" }
- , {nil, "target_minver", "kv", "auto", "The Target Minimal Version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- init global option menu
- iphoneos._MENU_GLOBAL = iphoneos._MENU_GLOBAL or
- { {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- get the option menu
- if action == "config" then
- return iphoneos._MENU_CONFIG
- elseif action == "global" then
- return iphoneos._MENU_GLOBAL
- end
-end
-
-
--- return module: iphoneos
-return iphoneos
diff --git a/xmake/core/platform/platforms/iphoneos/prober.lua b/xmake/core/platform/platforms/iphoneos/prober.lua
deleted file mode 100644
index 683954525..000000000
--- a/xmake/core/platform/platforms/iphoneos/prober.lua
+++ /dev/null
@@ -1,310 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", "armv7")
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the xcode application directory
-function prober._probe_xcode(configs)
-
- -- get the xcode directory
- local xcode_dir = configs.get("xcode_dir")
-
- -- ok?
- if xcode_dir then return true end
-
- -- clear it first
- xcode_dir = nil
-
- -- attempt to get the default directory
- if not xcode_dir then
- if os.isdir("/Applications/Xcode.app") then
- xcode_dir = "/Applications/Xcode.app"
- end
- end
-
- -- attempt to match the other directories
- if not xcode_dir then
- local dirs = os.match("/Applications/Xcode*.app", true)
- if dirs and table.getn(dirs) ~= 0 then
- xcode_dir = dirs[1]
- end
- end
-
- -- probe ok? update it
- if xcode_dir then
- -- save it
- configs.set("xcode_dir", xcode_dir)
-
- -- trace
- utils.printf("checking for the Xcode application directory ... %s", xcode_dir)
- else
- -- failed
- utils.error("checking for the Xcode application directory ... no")
- utils.error(" - xmake config --xcode_dir=xxx")
- utils.error("or - xmake global --xcode_dir=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the xcode sdk version
-function prober._probe_xcode_sdkver(configs)
-
- -- get the xcode sdk version
- local xcode_sdkver = configs.get("xcode_sdkver")
-
- -- ok?
- if xcode_sdkver then return true end
-
- -- clear it first
- xcode_sdkver = nil
-
- -- attempt to match the directory
- if not xcode_sdkver then
- local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk", true)
- if dirs then
- for _, dir in ipairs(dirs) do
- xcode_sdkver = string.match(dir, "%d+%.%d+")
- if xcode_sdkver then break end
- end
- end
- end
-
- -- probe ok? update it
- if xcode_sdkver then
-
- -- save it
- configs.set("xcode_sdkver", xcode_sdkver)
-
- -- trace
- utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver)
- else
- -- failed
- utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat"))
- utils.error(" - xmake config --xcode_sdkver=xxx")
- utils.error("or - xmake global --xcode_sdkver=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the target minimal version
-function prober._probe_target_minver(configs)
-
- -- get the target minimal version
- local target_minver = configs.get("target_minver")
-
- -- ok?
- if target_minver then return true end
-
- -- init the default target minimal version
- configs.set("target_minver", "7.0")
-
- -- trace
- utils.printf("checking for the target minimal version ... %s", configs.get("target_minver"))
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, cross, names, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- done
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- for _, name in ipairs(table.wrap(names)) do
-
- -- attempt to get it from the given cross toolchains
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to run it directly
- if not toolpath then
- toolpath = tool.check(cross .. name)
- end
-
- -- probe ok?
- if toolpath then
-
- -- update config
- configs.set(kind, toolpath)
-
- -- end
- break
- end
-
- end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- done
- if not prober._probe_toolpath(configs, "cc", "xcrun -sdk iphoneos ", "clang", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "mm", "xcrun -sdk iphoneos ", "clang", "the objc compiler") then return false end
- if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the objc++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", xmake._CORE_DIR .. "/tools/gas-preprocessor.pl xcrun -sdk iphoneos ", "clang", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", "xcrun -sdk iphoneos ", "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", "xcrun -sdk iphoneos ", {"clang++", "clang"}, "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", "xcrun -sdk iphoneos ", "swiftc", "the swift compiler") then return false end
- if not prober._probe_toolpath(configs, "lipo", "xcrun -sdk iphoneos ", "lipo", "the universal files creater") then return false end
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_xcode
- , prober._probe_xcode_sdkver
- , prober._probe_target_minver
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_toolchains}
- , nil
- , config)
-
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_xcode
- , prober._probe_make
- , prober._probe_ccache}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/iphonesimulator/iphonesimulator.lua b/xmake/core/platform/platforms/iphonesimulator/iphonesimulator.lua
deleted file mode 100644
index 3b2bd1ff8..000000000
--- a/xmake/core/platform/platforms/iphonesimulator/iphonesimulator.lua
+++ /dev/null
@@ -1,138 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file iphonesimulator.lua
---
-
--- define module: iphonesimulator
-local iphonesimulator = iphonesimulator or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-iphonesimulator._HOST = "macosx"
-
--- init os
-iphonesimulator._OS = "ios"
-
--- init architectures
-iphonesimulator._ARCHS = {"i386", "x86_64"}
-
--- make configure
-function iphonesimulator.make(configs)
-
- -- 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 = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.mm = config.get("mm")
- configs.tools.mxx = config.get("mxx")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
-
- -- init target minimal version
- local target_minver = config.get("target_minver")
- assert(target_minver)
-
- -- init flags for architecture
- local archflags = nil
- local arch = config.get("arch")
- if arch then archflags = "-arch " .. arch end
- configs.cxflags = { archflags, "-mios-simulator-version-min=" .. target_minver }
- configs.mxflags = { archflags, "-mios-simulator-version-min=" .. target_minver }
- configs.asflags = { archflags, "-mios-simulator-version-min=" .. target_minver }
- configs.ldflags = { archflags, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- configs.shflags = { archflags, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- if arch then
- configs.scflags = { string.format("-target %s-apple-ios%s", arch, target_minver) }
- end
-
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- if xcode_dir and xcode_sdkver then
-
- -- init flags
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" .. xcode_sdkver .. ".sdk"
- table.insert(configs.cxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.asflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.mxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.ldflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.shflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.scflags, "-sdk " .. xcode_sdkdir)
-
- -- save swift link directory
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator")
- end
-end
-
--- get the option menu for action: xmake config or global
-function iphonesimulator.menu(action)
-
- -- init config option menu
- iphonesimulator._MENU_CONFIG = iphonesimulator._MENU_CONFIG or
- { {}
- , {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mxx", "kv", nil, "The Objc++ Compiler" }
- , {nil, "mflags", "kv", nil, "The Objc Compiler Flags" }
- , {nil, "mxflags", "kv", nil, "The Objc/c++ Compiler Flags" }
- , {nil, "mxxflags", "kv", nil, "The Objc++ Compiler Flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "The SDK Version for Xcode" }
- , {nil, "target_minver", "kv", "auto", "The Target Minimal Version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- init global option menu
- iphonesimulator._MENU_GLOBAL = iphonesimulator._MENU_GLOBAL or
- { {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- get the option menu
- if action == "config" then
- return iphonesimulator._MENU_CONFIG
- elseif action == "global" then
- return iphonesimulator._MENU_GLOBAL
- end
-end
-
-
--- return module: iphonesimulator
-return iphonesimulator
diff --git a/xmake/core/platform/platforms/iphonesimulator/prober.lua b/xmake/core/platform/platforms/iphonesimulator/prober.lua
deleted file mode 100644
index 71eb921fa..000000000
--- a/xmake/core/platform/platforms/iphonesimulator/prober.lua
+++ /dev/null
@@ -1,308 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", "x86_64")
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the xcode application directory
-function prober._probe_xcode(configs)
-
- -- get the xcode directory
- local xcode_dir = configs.get("xcode_dir")
-
- -- ok?
- if xcode_dir then return true end
-
- -- clear it first
- xcode_dir = nil
-
- -- attempt to get the default directory
- if not xcode_dir then
- if os.isdir("/Applications/Xcode.app") then
- xcode_dir = "/Applications/Xcode.app"
- end
- end
-
- -- attempt to match the other directories
- if not xcode_dir then
- local dirs = os.match("/Applications/Xcode*.app", true)
- if dirs and table.getn(dirs) ~= 0 then
- xcode_dir = dirs[1]
- end
- end
-
- -- probe ok? update it
- if xcode_dir then
- -- save it
- configs.set("xcode_dir", xcode_dir)
-
- -- trace
- utils.printf("checking for the Xcode application directory ... %s", xcode_dir)
- else
- -- failed
- utils.error("checking for the Xcode application directory ... no")
- utils.error(" - xmake config --xcode_dir=xxx")
- utils.error("or - xmake global --xcode_dir=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the xcode sdk version
-function prober._probe_xcode_sdkver(configs)
-
- -- get the xcode sdk version
- local xcode_sdkver = configs.get("xcode_sdkver")
-
- -- ok?
- if xcode_sdkver then return true end
-
- -- clear it first
- xcode_sdkver = nil
-
- -- attempt to match the directory
- if not xcode_sdkver then
- local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk", true)
- if dirs then
- for _, dir in ipairs(dirs) do
- xcode_sdkver = string.match(dir, "%d+%.%d+")
- if xcode_sdkver then break end
- end
- end
- end
-
- -- probe ok? update it
- if xcode_sdkver then
-
- -- save it
- configs.set("xcode_sdkver", xcode_sdkver)
-
- -- trace
- utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver)
- else
- -- failed
- utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat"))
- utils.error(" - xmake config --xcode_sdkver=xxx")
- utils.error("or - xmake global --xcode_sdkver=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the target minimal version
-function prober._probe_target_minver(configs)
-
- -- get the target minimal version
- local target_minver = configs.get("target_minver")
-
- -- ok?
- if target_minver then return true end
-
- -- init the default target minimal version
- configs.set("target_minver", "7.0")
-
- -- trace
- utils.printf("checking for the target minimal version ... %s", configs.get("target_minver"))
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, cross, names, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- done
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- for _, name in ipairs(table.wrap(names)) do
-
- -- attempt to get it from the given cross toolchains
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to run it directly
- if not toolpath then
- toolpath = tool.check(cross .. name)
- end
-
- -- probe ok?
- if toolpath then
-
- -- update config
- configs.set(kind, toolpath)
-
- -- end
- break
- end
-
- end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- done
- if not prober._probe_toolpath(configs, "cc", "xcrun -sdk iphonesimulator ", "clang", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "mm", "xcrun -sdk iphonesimulator ", "clang", "the objc compiler") then return false end
- if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the objc++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", "xcrun -sdk iphonesimulator ", "clang", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", "xcrun -sdk iphonesimulator ", "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", "xcrun -sdk iphonesimulator ", {"clang++", "clang"}, "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", "xcrun -sdk iphonesimulator ", "swiftc", "the swift compiler") then return false end
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_xcode
- , prober._probe_xcode_sdkver
- , prober._probe_target_minver
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_toolchains}
- , nil
- , config)
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_xcode
- , prober._probe_make
- , prober._probe_ccache}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/linux/linux.lua b/xmake/core/platform/platforms/linux/linux.lua
deleted file mode 100644
index d70224351..000000000
--- a/xmake/core/platform/platforms/linux/linux.lua
+++ /dev/null
@@ -1,103 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file linux.lua
---
-
--- define module: linux
-local linux = linux or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-linux._HOST = "linux"
-
--- init os
-linux._OS = "linux"
-
--- init architectures
-linux._ARCHS = {"i386", "x86_64"}
-
--- make configure
-function linux.make(configs)
-
- -- init the file formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"lib", ".so"}
-
- -- init the toolchains
- configs.tools = {}
- configs.tools.make = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.mm = config.get("mm")
- configs.tools.mxx = config.get("mxx")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
-
- -- cross toolchains?
- if config.get("cross") then return end
-
- -- init flags for architecture
- local archflags = nil
- local arch = config.get("arch")
- if arch then
- if arch == "x86_64" then archflags = "-m64"
- elseif arch == "i386" then archflags = "-m32"
- else archflags = "-arch " .. arch
- end
- end
- configs.cxflags = { archflags }
- configs.mxflags = { archflags }
- configs.asflags = { archflags }
- configs.ldflags = { archflags }
- configs.shflags = { archflags }
-
- -- init linkdirs and includedirs
- configs.linkdirs = {"/usr/lib", "/usr/local/lib"}
- configs.includedirs = {"/usr/include", "/usr/local/include"}
-
-end
-
--- get the option menu for action: xmake config or global
-function linux.menu(action)
-
- -- init config option menu
- linux._MENU_CONFIG = linux._MENU_CONFIG or {}
-
- -- init global option menu
- linux._MENU_GLOBAL = linux._MENU_GLOBAL or {}
-
- -- get the option menu
- if action == "config" then
- return linux._MENU_CONFIG
- elseif action == "global" then
- return linux._MENU_GLOBAL
- end
-end
-
--- return module: linux
-return linux
diff --git a/xmake/core/platform/platforms/linux/prober.lua b/xmake/core/platform/platforms/linux/prober.lua
deleted file mode 100644
index 55af51a8f..000000000
--- a/xmake/core/platform/platforms/linux/prober.lua
+++ /dev/null
@@ -1,198 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- if configs.get("cross") then
- configs.set("arch", "none")
- else
- configs.set("arch", xmake._ARCH)
- end
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, cross, names, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- done
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- for _, name in ipairs(table.wrap(names)) do
-
- -- attempt to get it from the given cross toolchains
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to run it directly
- if not toolpath then
- toolpath = tool.check(cross .. name)
- end
-
- -- probe ok?
- if toolpath then
-
- -- update config
- configs.set(kind, toolpath)
-
- -- end
- break
- end
-
- end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- done
- if not prober._probe_toolpath(configs, "cc", "", "gcc", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", "", {"g++", "gcc"}, "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", "", "gcc", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", "", {"g++", "gcc"}, "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", "", "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", "", {"g++", "gcc"}, "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", "", "swiftc", "the swift compiler") then return false end
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_toolchains}
- , nil
- , config)
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_make
- , prober._probe_ccache}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/macosx/macosx.lua b/xmake/core/platform/platforms/macosx/macosx.lua
deleted file mode 100644
index 31a9f0296..000000000
--- a/xmake/core/platform/platforms/macosx/macosx.lua
+++ /dev/null
@@ -1,140 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file macosx.lua
---
-
--- define module: macosx
-local macosx = macosx or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-macosx._HOST = "macosx"
-
--- init os
-macosx._OS = "macosx"
-
--- init architectures
-macosx._ARCHS = {"i386", "x86_64"}
-
--- make configure
-function macosx.make(configs)
-
- -- 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 = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.mm = config.get("mm")
- configs.tools.mxx = config.get("mxx")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
-
- -- init target minimal version
- local target_minver = config.get("target_minver")
- assert(target_minver)
-
- -- init flags for architecture
- local archflags = nil
- local arch = config.get("arch")
- if arch then archflags = "-arch " .. arch end
- configs.cxflags = { archflags, "-fpascal-strings", "-fmessage-length=0" }
- configs.mxflags = { archflags, "-fpascal-strings", "-fmessage-length=0" }
- configs.asflags = { archflags }
- configs.ldflags = { archflags, "-mmacosx-version-min=" .. target_minver, "-stdlib=libc++", "-lz" }
- configs.shflags = { archflags, "-mmacosx-version-min=" .. target_minver, "-stdlib=libc++", "-lz" }
- if arch then
- configs.scflags = { string.format("-target %s-apple-macosx%s", arch, target_minver) }
- end
-
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- if xcode_dir and xcode_sdkver then
-
- -- init flags
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" .. xcode_sdkver .. ".sdk"
- table.insert(configs.cxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.asflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.mxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.ldflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.shflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.scflags, "-sdk " .. xcode_sdkdir)
-
- -- save swift link directory
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx")
- end
-
- -- init linkdirs
- configs.linkdirs = {"/usr/lib", "/usr/local/lib"}
-
- -- init includedirs
- --
- -- @note
- -- cannot use configs.includedirs because the swift/objc compiler will compile code failed
- table.insert(configs.cxflags, "-I/usr/include")
- table.insert(configs.cxflags, "-I/usr/local/include")
-
-end
-
--- get the option menu for action: xmake config or global
-function macosx.menu(action)
-
- -- init config option menu
- macosx._MENU_CONFIG = macosx._MENU_CONFIG or
- { {}
- , {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mxx", "kv", nil, "The Objc++ Compiler" }
- , {nil, "mflags", "kv", nil, "The Objc Compiler Flags" }
- , {nil, "mxflags", "kv", nil, "The Objc/c++ Compiler Flags" }
- , {nil, "mxxflags", "kv", nil, "The Objc++ Compiler Flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "The SDK Version for Xcode" }
- , {nil, "target_minver", "kv", "auto", "The Target Minimal Version" }
- , }
-
- -- init global option menu
- 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
- elseif action == "global" then
- return macosx._MENU_GLOBAL
- end
-end
-
--- return module: macosx
-return macosx
diff --git a/xmake/core/platform/platforms/macosx/prober.lua b/xmake/core/platform/platforms/macosx/prober.lua
deleted file mode 100644
index 42352d8de..000000000
--- a/xmake/core/platform/platforms/macosx/prober.lua
+++ /dev/null
@@ -1,307 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", xmake._ARCH)
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the xcode application directory
-function prober._probe_xcode(configs)
-
- -- get the xcode directory
- local xcode_dir = configs.get("xcode_dir")
-
- -- ok?
- if xcode_dir then return true end
-
- -- clear it first
- xcode_dir = nil
-
- -- attempt to get the default directory
- if not xcode_dir then
- if os.isdir("/Applications/Xcode.app") then
- xcode_dir = "/Applications/Xcode.app"
- end
- end
-
- -- attempt to match the other directories
- if not xcode_dir then
- local dirs = os.match("/Applications/Xcode*.app", true)
- if dirs and table.getn(dirs) ~= 0 then
- xcode_dir = dirs[1]
- end
- end
-
- -- probe ok? update it
- if xcode_dir then
- -- save it
- configs.set("xcode_dir", xcode_dir)
-
- -- trace
- utils.printf("checking for the Xcode application directory ... %s", xcode_dir)
- else
- -- failed
- utils.error("checking for the Xcode application directory ... no")
- utils.error(" - xmake config --xcode_dir=xxx")
- utils.error("or - xmake global --xcode_dir=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the xcode sdk version
-function prober._probe_xcode_sdkver(configs)
-
- -- get the xcode sdk version
- local xcode_sdkver = configs.get("xcode_sdkver")
-
- -- ok?
- if xcode_sdkver then return true end
-
- -- clear it first
- xcode_sdkver = nil
-
- -- attempt to match the directory
- if not xcode_sdkver then
- local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX*.sdk", true)
- if dirs then
- for _, dir in ipairs(dirs) do
- xcode_sdkver = string.match(dir, "%d+%.%d+")
- if xcode_sdkver then break end
- end
- end
- end
-
- -- probe ok? update it
- if xcode_sdkver then
-
- -- save it
- configs.set("xcode_sdkver", xcode_sdkver)
-
- -- trace
- utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver)
- else
- -- failed
- utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat"))
- utils.error(" - xmake config --xcode_sdkver=xxx")
- utils.error("or - xmake global --xcode_sdkver=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the target minimal version
-function prober._probe_target_minver(configs)
-
- -- get the target minimal version
- local target_minver = configs.get("target_minver")
-
- -- ok?
- if target_minver then return true end
-
- -- init the default target minimal version
- configs.set("target_minver", "10.9")
-
- -- trace
- utils.printf("checking for the target minimal version ... %s", configs.get("target_minver"))
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, cross, names, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- done
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- for _, name in ipairs(table.wrap(names)) do
-
- -- attempt to get it from the given cross toolchains
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to run it directly
- if not toolpath then
- toolpath = tool.check(cross .. name)
- end
-
- -- probe ok?
- if toolpath then
-
- -- update config
- configs.set(kind, toolpath)
-
- -- end
- break
- end
-
- end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- done
- if not prober._probe_toolpath(configs, "cc", "xcrun -sdk macosx ", "clang", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk macosx ", {"clang++", "clang"}, "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "mm", "xcrun -sdk macosx ", "clang", "the objc compiler") then return false end
- if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk macosx ", {"clang++", "clang"}, "the objc++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", "xcrun -sdk macosx ", "clang", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", "xcrun -sdk macosx ", {"clang++", "clang"}, "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", "xcrun -sdk macosx ", "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", "xcrun -sdk macosx ", {"clang++", "clang"}, "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", "xcrun -sdk macosx ", "swiftc", "the swift compiler") then return false end
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_xcode
- , prober._probe_xcode_sdkver
- , prober._probe_target_minver
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_toolchains}
- , nil
- , config)
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_xcode
- , prober._probe_ccache}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/mingw/mingw.lua b/xmake/core/platform/platforms/mingw/mingw.lua
deleted file mode 100644
index ce263bae6..000000000
--- a/xmake/core/platform/platforms/mingw/mingw.lua
+++ /dev/null
@@ -1,93 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file mingw.lua
---
-
--- define module: mingw
-local mingw = mingw or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-mingw._HOST = xmake._HOST
-
--- init os
-mingw._OS = "windows"
-
--- init architectures
-mingw._ARCHS = {"i386", "x86_64"}
-
--- make configure
-function mingw.make(configs)
-
- -- init the file formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"lib", ".so"}
-
- -- init the toolchains
- configs.tools = {}
- configs.tools.make = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
-
- -- init flags for architecture
- local archflags = nil
- local arch = config.get("arch")
- if arch then
- if arch == "x86_64" then archflags = "-m64"
- elseif arch == "i386" then archflags = "-m32"
- else archflags = "-arch " .. arch
- end
- end
- configs.cxflags = { archflags }
- configs.asflags = { archflags }
- configs.ldflags = { archflags }
- configs.shflags = { archflags }
-
-end
-
--- get the option menu for action: xmake config or global
-function mingw.menu(action)
-
- -- init config option menu
- mingw._MENU_CONFIG = mingw._MENU_CONFIG or {}
-
- -- init global option menu
- mingw._MENU_GLOBAL = mingw._MENU_GLOBAL or {}
-
- -- get the option menu
- if action == "config" then
- return mingw._MENU_CONFIG
- elseif action == "global" then
- return mingw._MENU_GLOBAL
- end
-end
-
--- return module: mingw
-return mingw
diff --git a/xmake/core/platform/platforms/mingw/prober.lua b/xmake/core/platform/platforms/mingw/prober.lua
deleted file mode 100644
index 307a16f60..000000000
--- a/xmake/core/platform/platforms/mingw/prober.lua
+++ /dev/null
@@ -1,207 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", "i386")
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, cross, names, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- done
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- for _, name in ipairs(table.wrap(names)) do
-
- -- attempt to get it from the given cross toolchains
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to run it directly
- if not toolpath then
- toolpath = tool.check(cross .. name)
- end
-
- -- probe ok?
- if toolpath then
-
- -- update config
- configs.set(kind, toolpath)
-
- -- end
- break
- end
-
- end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- init the default cross from the current host and architecture
- local cross = ""
- local arch = configs.get("arch")
- if arch then
- if xmake._HOST == "macosx" and arch == "i386" then
- cross = "i386-mingw32-"
- elseif arch == "i386" then
- cross = "i686-w64-mingw32-"
- elseif arch == "x86_64" then
- cross = "x86_64-w64-mingw32-"
- end
- end
-
- -- done
- if not prober._probe_toolpath(configs, "cc", cross, "gcc", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", cross, {"g++", "gcc"}, "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", cross, "gcc", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", cross, {"g++", "gcc"}, "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", cross, "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", cross, {"g++", "gcc"}, "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", cross, "swiftc", "the swift compiler") then return false end
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_toolchains}
- , nil
- , config)
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_make
- , prober._probe_ccache}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/watchos/prober.lua b/xmake/core/platform/platforms/watchos/prober.lua
deleted file mode 100644
index 1fd7332eb..000000000
--- a/xmake/core/platform/platforms/watchos/prober.lua
+++ /dev/null
@@ -1,310 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", "armv7")
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the xcode application directory
-function prober._probe_xcode(configs)
-
- -- get the xcode directory
- local xcode_dir = configs.get("xcode_dir")
-
- -- ok?
- if xcode_dir then return true end
-
- -- clear it first
- xcode_dir = nil
-
- -- attempt to get the default directory
- if not xcode_dir then
- if os.isdir("/Applications/Xcode.app") then
- xcode_dir = "/Applications/Xcode.app"
- end
- end
-
- -- attempt to match the other directories
- if not xcode_dir then
- local dirs = os.match("/Applications/Xcode*.app", true)
- if dirs and table.getn(dirs) ~= 0 then
- xcode_dir = dirs[1]
- end
- end
-
- -- probe ok? update it
- if xcode_dir then
- -- save it
- configs.set("xcode_dir", xcode_dir)
-
- -- trace
- utils.printf("checking for the Xcode application directory ... %s", xcode_dir)
- else
- -- failed
- utils.error("checking for the Xcode application directory ... no")
- utils.error(" - xmake config --xcode_dir=xxx")
- utils.error("or - xmake global --xcode_dir=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the xcode sdk version
-function prober._probe_xcode_sdkver(configs)
-
- -- get the xcode sdk version
- local xcode_sdkver = configs.get("xcode_sdkver")
-
- -- ok?
- if xcode_sdkver then return true end
-
- -- clear it first
- xcode_sdkver = nil
-
- -- attempt to match the directory
- if not xcode_sdkver then
- local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS*.sdk", true)
- if dirs then
- for _, dir in ipairs(dirs) do
- xcode_sdkver = string.match(dir, "%d+%.%d+")
- if xcode_sdkver then break end
- end
- end
- end
-
- -- probe ok? update it
- if xcode_sdkver then
-
- -- save it
- configs.set("xcode_sdkver", xcode_sdkver)
-
- -- trace
- utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver)
- else
- -- failed
- utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat"))
- utils.error(" - xmake config --xcode_sdkver=xxx")
- utils.error("or - xmake global --xcode_sdkver=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the target minimal version
-function prober._probe_target_minver(configs)
-
- -- get the target minimal version
- local target_minver = configs.get("target_minver")
-
- -- ok?
- if target_minver then return true end
-
- -- init the default target minimal version
- configs.set("target_minver", "7.0")
-
- -- trace
- utils.printf("checking for the target minimal version ... %s", configs.get("target_minver"))
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, cross, names, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- done
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- for _, name in ipairs(table.wrap(names)) do
-
- -- attempt to get it from the given cross toolchains
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to run it directly
- if not toolpath then
- toolpath = tool.check(cross .. name)
- end
-
- -- probe ok?
- if toolpath then
-
- -- update config
- configs.set(kind, toolpath)
-
- -- end
- break
- end
-
- end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- done
- if not prober._probe_toolpath(configs, "cc", "xcrun -sdk watchos ", "clang", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk watchos ", {"clang++", "clang"}, "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "mm", "xcrun -sdk watchos ", "clang", "the objc compiler") then return false end
- if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk watchos ", {"clang++", "clang"}, "the objc++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", xmake._CORE_DIR .. "/tools/gas-preprocessor.pl xcrun -sdk watchos ", "clang", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", "xcrun -sdk watchos ", {"clang++", "clang"}, "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", "xcrun -sdk watchos ", "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", "xcrun -sdk watchos ", {"clang++", "clang"}, "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", "xcrun -sdk watchos ", "swiftc", "the swift compiler") then return false end
- if not prober._probe_toolpath(configs, "lipo", "xcrun -sdk watchos ", "lipo", "the universal files creater") then return false end
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_xcode
- , prober._probe_xcode_sdkver
- , prober._probe_target_minver
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_toolchains}
- , nil
- , config)
-
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_xcode
- , prober._probe_make
- , prober._probe_ccache}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/watchos/watchos.lua b/xmake/core/platform/platforms/watchos/watchos.lua
deleted file mode 100644
index 3f04d6082..000000000
--- a/xmake/core/platform/platforms/watchos/watchos.lua
+++ /dev/null
@@ -1,141 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file watchos.lua
---
-
--- define module: watchos
-local watchos = watchos or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-watchos._HOST = "macosx"
-
--- init os
-watchos._OS = "ios"
-
--- init architectures
-watchos._ARCHS = {"armv7", "armv7s", "arm64"}
-
--- make configure
-function watchos.make(configs)
-
- -- 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 = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.mm = config.get("mm")
- configs.tools.mxx = config.get("mxx")
- configs.tools.as = config.get("as")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
- configs.tools.lipo = config.get("lipo")
-
- -- init target minimal version
- local target_minver = config.get("target_minver")
- assert(target_minver)
-
- -- init flags for architecture
- local archflags = nil
- local arch = config.get("arch")
- if arch then archflags = "-arch " .. arch end
- configs.cxflags = { archflags, "-mwatchos-version-min=" .. target_minver }
- configs.mxflags = { archflags, "-mwatchos-version-min=" .. target_minver }
- configs.asflags = { archflags, "-mwatchos-version-min=" .. target_minver }
- configs.ldflags = { archflags, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-version-min=" .. target_minver }
- configs.shflags = { archflags, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-version-min=" .. target_minver }
- if arch then
- configs.scflags = { string.format("-target %s-apple-ios%s", arch, target_minver) }
- end
-
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- if xcode_dir and xcode_sdkver then
-
- -- init flags
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS" .. xcode_sdkver .. ".sdk"
- table.insert(configs.cxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.asflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.mxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.ldflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.shflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.scflags, "-sdk " .. xcode_sdkdir)
-
- -- save swift link directory
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos")
- end
-
-end
-
--- get the option menu for action: xmake config or global
-function watchos.menu(action)
-
- -- init config option menu
- watchos._MENU_CONFIG = watchos._MENU_CONFIG or
- { {}
- , {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mxx", "kv", nil, "The Objc++ Compiler" }
- , {nil, "mflags", "kv", nil, "The Objc Compiler Flags" }
- , {nil, "mxflags", "kv", nil, "The Objc/c++ Compiler Flags" }
- , {nil, "mxxflags", "kv", nil, "The Objc++ Compiler Flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "The SDK Version for Xcode" }
- , {nil, "target_minver", "kv", "auto", "The Target Minimal Version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- init global option menu
- watchos._MENU_GLOBAL = watchos._MENU_GLOBAL or
- { {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- get the option menu
- if action == "config" then
- return watchos._MENU_CONFIG
- elseif action == "global" then
- return watchos._MENU_GLOBAL
- end
-end
-
-
--- return module: watchos
-return watchos
diff --git a/xmake/core/platform/platforms/watchsimulator/prober.lua b/xmake/core/platform/platforms/watchsimulator/prober.lua
deleted file mode 100644
index abdec157d..000000000
--- a/xmake/core/platform/platforms/watchsimulator/prober.lua
+++ /dev/null
@@ -1,308 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local tool = require("tool/tool")
-local config = require("project/config")
-local global = require("project/global")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", "x86_64")
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the xcode application directory
-function prober._probe_xcode(configs)
-
- -- get the xcode directory
- local xcode_dir = configs.get("xcode_dir")
-
- -- ok?
- if xcode_dir then return true end
-
- -- clear it first
- xcode_dir = nil
-
- -- attempt to get the default directory
- if not xcode_dir then
- if os.isdir("/Applications/Xcode.app") then
- xcode_dir = "/Applications/Xcode.app"
- end
- end
-
- -- attempt to match the other directories
- if not xcode_dir then
- local dirs = os.match("/Applications/Xcode*.app", true)
- if dirs and table.getn(dirs) ~= 0 then
- xcode_dir = dirs[1]
- end
- end
-
- -- probe ok? update it
- if xcode_dir then
- -- save it
- configs.set("xcode_dir", xcode_dir)
-
- -- trace
- utils.printf("checking for the Xcode application directory ... %s", xcode_dir)
- else
- -- failed
- utils.error("checking for the Xcode application directory ... no")
- utils.error(" - xmake config --xcode_dir=xxx")
- utils.error("or - xmake global --xcode_dir=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the xcode sdk version
-function prober._probe_xcode_sdkver(configs)
-
- -- get the xcode sdk version
- local xcode_sdkver = configs.get("xcode_sdkver")
-
- -- ok?
- if xcode_sdkver then return true end
-
- -- clear it first
- xcode_sdkver = nil
-
- -- attempt to match the directory
- if not xcode_sdkver then
- local dirs = os.match(configs.get("xcode_dir") .. "/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator*.sdk", true)
- if dirs then
- for _, dir in ipairs(dirs) do
- xcode_sdkver = string.match(dir, "%d+%.%d+")
- if xcode_sdkver then break end
- end
- end
- end
-
- -- probe ok? update it
- if xcode_sdkver then
-
- -- save it
- configs.set("xcode_sdkver", xcode_sdkver)
-
- -- trace
- utils.printf("checking for the Xcode SDK version for %s ... %s", configs.get("plat"), xcode_sdkver)
- else
- -- failed
- utils.error("checking for the Xcode SDK version for %s ... no", configs.get("plat"))
- utils.error(" - xmake config --xcode_sdkver=xxx")
- utils.error("or - xmake global --xcode_sdkver=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the target minimal version
-function prober._probe_target_minver(configs)
-
- -- get the target minimal version
- local target_minver = configs.get("target_minver")
-
- -- ok?
- if target_minver then return true end
-
- -- init the default target minimal version
- configs.set("target_minver", "7.0")
-
- -- trace
- utils.printf("checking for the target minimal version ... %s", configs.get("target_minver"))
-
- -- ok
- return true
-end
-
--- probe the make
-function prober._probe_make(configs)
-
- -- ok?
- local make = configs.get("make")
- if make then return true end
-
- -- probe the make path
- make = tool.check("make", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if make then configs.set("make", make) end
-
- -- trace
- utils.printf("checking for the make ... %s", utils.ifelse(make, make, "no"))
-
- -- ok
- return true
-end
-
--- probe the ccache
-function prober._probe_ccache(configs)
-
- -- ok?
- local ccache_enable = configs.get("ccache")
- if ccache_enable and configs.get("__ccache") then return true end
-
- -- disable?
- if type(ccache_enable) == "boolean" and not ccache_enable then
- configs.set("__ccache", nil)
- return true
- end
-
- -- probe the ccache path
- local ccache_path = tool.check("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
-
- -- probe ok? update it
- if ccache_path then
- configs.set("ccache", true)
- configs.set("__ccache", ccache_path)
- else
- configs.set("ccache", false)
- end
-
- -- trace
- utils.printf("checking for the ccache ... %s", utils.ifelse(ccache_path, ccache_path, "no"))
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, cross, names, description)
-
- -- check
- assert(kind)
-
- -- get the cross
- cross = configs.get("cross") or cross
-
- -- done
- local toolpath = nil
- local toolchains = configs.get("toolchains")
- for _, name in ipairs(table.wrap(names)) do
-
- -- attempt to get it from the given cross toolchains
- if toolchains then
- toolpath = tool.check(cross .. (configs.get(kind) or name), toolchains)
- end
-
- -- attempt to get it directly from the configure
- if not toolpath then
- toolpath = configs.get(kind)
- end
-
- -- attempt to run it directly
- if not toolpath then
- toolpath = tool.check(cross .. name)
- end
-
- -- probe ok?
- if toolpath then
-
- -- update config
- configs.set(kind, toolpath)
-
- -- end
- break
- end
-
- end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- done
- if not prober._probe_toolpath(configs, "cc", "xcrun -sdk watchsimulator ", "clang", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "mm", "xcrun -sdk watchsimulator ", "clang", "the objc compiler") then return false end
- if not prober._probe_toolpath(configs, "mxx", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the objc++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", "xcrun -sdk watchsimulator ", "clang", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", "xcrun -sdk watchsimulator ", "ar", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", "xcrun -sdk watchsimulator ", {"clang++", "clang"}, "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "sc", "xcrun -sdk watchsimulator ", "swiftc", "the swift compiler") then return false end
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_xcode
- , prober._probe_xcode_sdkver
- , prober._probe_target_minver
- , prober._probe_make
- , prober._probe_ccache
- , prober._probe_toolchains}
- , nil
- , config)
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_xcode
- , prober._probe_make
- , prober._probe_ccache}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/watchsimulator/watchsimulator.lua b/xmake/core/platform/platforms/watchsimulator/watchsimulator.lua
deleted file mode 100644
index c0b29e120..000000000
--- a/xmake/core/platform/platforms/watchsimulator/watchsimulator.lua
+++ /dev/null
@@ -1,138 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file watchsimulator.lua
---
-
--- define module: watchsimulator
-local watchsimulator = watchsimulator or {}
-
--- load modules
-local config = require("project/config")
-
--- init host
-watchsimulator._HOST = "macosx"
-
--- init os
-watchsimulator._OS = "ios"
-
--- init architectures
-watchsimulator._ARCHS = {"i386", "x86_64"}
-
--- make configure
-function watchsimulator.make(configs)
-
- -- 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 = config.get("make")
- configs.tools.ccache = config.get("__ccache")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.mm = config.get("mm")
- configs.tools.mxx = config.get("mxx")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.ex = config.get("ar")
- configs.tools.sc = config.get("sc")
-
- -- init target minimal version
- local target_minver = config.get("target_minver")
- assert(target_minver)
-
- -- init flags for architecture
- local archflags = nil
- local arch = config.get("arch")
- if arch then archflags = "-arch " .. arch end
- configs.cxflags = { archflags, "-mios-simulator-version-min=" .. target_minver }
- configs.mxflags = { archflags, "-mios-simulator-version-min=" .. target_minver }
- configs.asflags = { archflags, "-mios-simulator-version-min=" .. target_minver }
- configs.ldflags = { archflags, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- configs.shflags = { archflags, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- if arch then
- configs.scflags = { string.format("-target %s-apple-ios%s", arch, target_minver) }
- end
-
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- if xcode_dir and xcode_sdkver then
-
- -- init flags
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator" .. xcode_sdkver .. ".sdk"
- table.insert(configs.cxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.asflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.mxflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.ldflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.shflags, "-isysroot " .. xcode_sdkdir)
- table.insert(configs.scflags, "-sdk " .. xcode_sdkdir)
-
- -- save swift link directory
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchsimulator")
- end
-end
-
--- get the option menu for action: xmake config or global
-function watchsimulator.menu(action)
-
- -- init config option menu
- watchsimulator._MENU_CONFIG = watchsimulator._MENU_CONFIG or
- { {}
- , {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mxx", "kv", nil, "The Objc++ Compiler" }
- , {nil, "mflags", "kv", nil, "The Objc Compiler Flags" }
- , {nil, "mxflags", "kv", nil, "The Objc/c++ Compiler Flags" }
- , {nil, "mxxflags", "kv", nil, "The Objc++ Compiler Flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "The SDK Version for Xcode" }
- , {nil, "target_minver", "kv", "auto", "The Target Minimal Version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- init global option menu
- watchsimulator._MENU_GLOBAL = watchsimulator._MENU_GLOBAL or
- { {}
- , {nil, "xcode_dir", "kv", "auto", "The Xcode Application Directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- , }
-
- -- get the option menu
- if action == "config" then
- return watchsimulator._MENU_CONFIG
- elseif action == "global" then
- return watchsimulator._MENU_GLOBAL
- end
-end
-
-
--- return module: watchsimulator
-return watchsimulator
diff --git a/xmake/core/platform/platforms/windows/prober.lua b/xmake/core/platform/platforms/windows/prober.lua
deleted file mode 100644
index 46e41b149..000000000
--- a/xmake/core/platform/platforms/windows/prober.lua
+++ /dev/null
@@ -1,299 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file prober.lua
---
-
--- load modules
-local io = require("base/io")
-local os = require("base/os")
-local path = require("base/path")
-local utils = require("base/utils")
-local string = require("base/string")
-local config = require("project/config")
-local global = require("project/global")
-local platform = require("platform/platform")
-
--- define module: prober
-local prober = prober or {}
-
--- probe the architecture
-function prober._probe_arch(configs)
-
- -- get the architecture
- local arch = configs.get("arch")
-
- -- ok?
- if arch then return true end
-
- -- init the default architecture
- configs.set("arch", "x86")
-
- -- trace
- utils.printf("checking for the architecture ... %s", configs.get("arch"))
-
- -- ok
- return true
-end
-
--- probe the vs version
-function prober._probe_vs_version(configs)
-
- -- get the vs version
- local vs = configs.get("vs")
-
- -- ok?
- if vs then return true end
-
- -- clear it first
- vs = nil
-
- -- make the map table
- local map =
- {
- VS140COMNTOOLS = "2015"
- , VS120COMNTOOLS = "2013"
- , VS110COMNTOOLS = "2012"
- , VS100COMNTOOLS = "2010"
- , VS90COMNTOOLS = "2008"
- , VS80COMNTOOLS = "2005"
- , VS71COMNTOOLS = "2003"
- , VS70COMNTOOLS = "7.0"
- , VS60COMNTOOLS = "6.0"
- , VS50COMNTOOLS = "5.0"
- , VS42COMNTOOLS = "4.2"
- }
-
- -- attempt to get it from the envirnoment variable
- if not vs then
- for k, v in pairs(map) do
- if os.getenv(k) then
- vs = v
- break
- end
- end
- end
-
- -- probe ok? update it
- if vs then
- -- save it
- configs.set("vs", vs)
-
- -- trace
- utils.printf("checking for the Microsoft Visual Studio version ... %s", vs)
- else
- -- failed
- utils.error("checking for the Microsoft Visual Studio version ... no")
- utils.error(" - xmake config --vs=xxx")
- utils.error("or - xmake global --vs=xxx")
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the vs path
-function prober._probe_vs_path(configs)
-
- -- ok?
- if configs.get("__vsenv_path") then return true end
-
- -- get the vs version
- local vs = configs.get("vs")
- assert(vs)
-
- -- make the map table
- local map =
- {
- ["2015"] = "VS140COMNTOOLS"
- , ["2013"] = "VS120COMNTOOLS"
- , ["2012"] = "VS110COMNTOOLS"
- , ["2010"] = "VS100COMNTOOLS"
- , ["2008"] = "VS90COMNTOOLS"
- , ["2005"] = "VS80COMNTOOLS"
- , ["2003"] = "VS71COMNTOOLS"
- , ["7.0"] = "VS70COMNTOOLS"
- , ["6.0"] = "VS60COMNTOOLS"
- , ["5.0"] = "VS50COMNTOOLS"
- , ["4.2"] = "VS42COMNTOOLS"
- }
-
- -- attempt to get the vs directory from the envirnoment variable
- local vsdir = map[vs]
- if vsdir then
- vsdir = os.getenv(vsdir)
- end
- if vsdir then
- vsdir = vsdir .. "\\..\\.."
- end
- if not os.isdir(vsdir) then
- -- error
- utils.error("not found %s", vsdir)
- return false
- end
-
- -- the vcvarsall.bat path
- local vcvarsall = vsdir .. "\\VC\\vcvarsall.bat"
- if not os.isfile(vcvarsall) then
- -- error
- utils.error("not found %s", vcvarsall)
- return false
- end
-
- -- get the temporary directory
- local tmpdir = os.tmpdir()
- assert(tmpdir)
-
- -- make the call(vcvarsall.bat) file
- local callpath = tmpdir .. "\\call_vcvarsall.bat"
- local callfile = io.open(callpath, "w")
- assert(callfile)
-
- -- make call scripts
- callfile:write("@echo off\n")
- callfile:write(string.format("call \"%s\" %s > nul\n", vcvarsall, configs.get("arch")))
- callfile:write("echo return \n")
- callfile:write("echo { \n")
- callfile:write("echo path = \"%path%\"\n")
- callfile:write("echo , lib = \"%lib%\"\n")
- callfile:write("echo , libpath = \"%libpath%\"\n")
- callfile:write("echo , include = \"%include%\"\n")
- callfile:write("echo , devenvdir = \"%devenvdir%\"\n")
- callfile:write("echo , vsinstalldir = \"%vsinstalldir%\"\n")
- callfile:write("echo , vcinstalldir = \"%vcinstalldir%\"\n")
- callfile:write("echo } \n")
-
- -- close the file
- callfile:close()
-
- -- execute the call(vsvars32.bat) file and get all envirnoment variables
- local cmd = io.popen(callpath)
- local results = cmd:read("*all")
- cmd:close()
-
- -- translate '\' => '\\'
- results = results:gsub("\\", "\\\\")
-
- -- get all envirnoment variables
- local variables = assert(loadstring(results))()
- if not variables or not variables.path then
- return false
- end
-
- -- save the variables
- for k, v in pairs(variables) do
- configs.set("__vsenv_" .. k, v)
- end
-
- -- ok
- return true
-end
-
--- probe the tool path
-function prober._probe_toolpath(configs, kind, name, description)
-
- -- check
- assert(kind)
-
- -- attempt to get it directly from the configure
- local toolpath = configs.get(kind)
- if toolpath then return true end
-
- -- make cmd
- local cmd = string.format("%s > %s 2>&1", name, xmake._NULDEV)
- if kind == "ld" then
- cmd = string.format("%s nul > %s 2>&1", name, xmake._NULDEV)
- end
-
- -- attempt to run it directly first
- if not toolpath and os.execute(cmd) ~= 1 then
- toolpath = name
- end
-
- -- probe ok? update it
- if toolpath then configs.set(kind, toolpath) end
-
- -- trace
- if toolpath then
- utils.printf("checking for %s (%s) ... %s", description, kind, path.filename(toolpath))
- else
- utils.printf("checking for %s (%s) ... no", description, kind)
- end
-
- -- failed?
- if not toolpath and (kind == "cc" or kind == "ld" or kind == "make") then
- return false
- end
-
- -- ok
- return true
-end
-
--- probe the toolchains
-function prober._probe_toolchains(configs)
-
- -- the windows module
- local windows = platform.module()
- assert(windows)
-
- -- enter envirnoment
- windows.enter()
-
- -- done
- if not prober._probe_toolpath(configs, "cc", "cl.exe", "the c compiler") then return false end
- if not prober._probe_toolpath(configs, "cxx", "cl.exe", "the c++ compiler") then return false end
- if not prober._probe_toolpath(configs, "as", "ml.exe", "the assember") then return false end
- if not prober._probe_toolpath(configs, "ld", "link.exe", "the linker") then return false end
- if not prober._probe_toolpath(configs, "ar", "link.exe -lib", "the static library linker") then return false end
- if not prober._probe_toolpath(configs, "sh", "link.exe -dll", "the shared library linker") then return false end
- if not prober._probe_toolpath(configs, "ex", "lib.exe", "the library extractor") then return false end
- if not prober._probe_toolpath(configs, "make", "nmake.exe", "the make") then return false end
-
- -- leave envirnoment
- windows.leave()
-
- -- ok
- return true
-end
-
--- probe the project configure
-function prober.config()
-
- -- call all probe functions
- return utils.call( { prober._probe_arch
- , prober._probe_vs_version
- , prober._probe_vs_path
- , prober._probe_toolchains}
- , nil
- , config)
-end
-
--- probe the global configure
-function prober.global()
-
- -- call all probe functions
- return utils.call( { prober._probe_vs_version
- , prober._probe_vs_path}
- , nil
- , global)
-end
-
--- return module: prober
-return prober
diff --git a/xmake/core/platform/platforms/windows/windows.lua b/xmake/core/platform/platforms/windows/windows.lua
deleted file mode 100644
index 20bfa3046..000000000
--- a/xmake/core/platform/platforms/windows/windows.lua
+++ /dev/null
@@ -1,144 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file windows.lua
---
-
--- define module: windows
-local windows = windows or {}
-
--- load modules
-local os = require("base/os")
-local config = require("project/config")
-
--- init host
-windows._HOST = "windows"
-
--- init os
-windows._OS = "windows"
-
--- init architectures
-windows._ARCHS = {"x86", "x64", "amd64", "x86_amd64"}
-
--- enter the given environment
-function windows._enter(name)
-
- -- check
- assert(name)
-
- -- get the pathes for the vs environment
- local old = nil
- local new = config.get("__vsenv_" .. name)
- if new then
-
- -- get the current pathes
- old = os.getenv(name) or ""
-
- -- append the current pathes
- new = new .. ";" .. old
-
- -- update the pathes for the environment
- os.setenv(name, new)
- end
-
- -- return the previous environment
- return old;
-end
-
--- leave the given environment
-function windows._leave(name, old)
-
- -- check
- assert(name)
-
- -- restore the previous environment
- if old then
- os.setenv(name, old)
- end
-end
-
--- enter environment
-function windows.enter()
-
- -- enter the vs environment
- windows._pathes = windows._enter("path")
- windows._libs = windows._enter("lib")
- windows._includes = windows._enter("include")
- windows._libpathes = windows._enter("libpath")
-
-end
-
--- leave environment
-function windows.leave()
-
- -- leave the vs environment
- windows._leave("path", windows._pathes)
- windows._leave("lib", windows._libs)
- windows._leave("include", windows._includes)
- windows._leave("libpath", windows._libpathes)
-
-end
--- make configure
-function windows.make(configs)
-
- -- init the file formats
- configs.formats = {}
- configs.formats.static = {"", ".lib"}
- configs.formats.object = {"", ".obj"}
- configs.formats.shared = {"", ".dll"}
- configs.formats.binary = {"", ".exe"}
-
- -- init the toolchains
- configs.tools = {}
- configs.tools.make = config.get("make")
- configs.tools.cc = config.get("cc")
- configs.tools.cxx = config.get("cxx")
- configs.tools.ld = config.get("ld")
- configs.tools.ar = config.get("ar")
- configs.tools.sh = config.get("sh")
- configs.tools.as = config.get("as")
- configs.tools.ex = config.get("ex")
-end
-
--- get the option menu for action: xmake config or global
-function windows.menu(action)
-
- -- init config option menu
- windows._MENU_CONFIG = windows._MENU_CONFIG or
- { {}
- , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" }
- , }
-
- -- init global option menu
- windows._MENU_GLOBAL = windows._MENU_GLOBAL or
- { {}
- , {nil, "vs", "kv", "auto", "The Microsoft Visual Studio" }
- , }
-
- -- get the option menu
- if action == "config" then
- return windows._MENU_CONFIG
- elseif action == "global" then
- return windows._MENU_GLOBAL
- end
-end
-
-
--- return module: windows
-return windows
diff --git a/xmake/core/sandbox/modules/import/core/platform/menu.lua b/xmake/core/sandbox/modules/import/core/platform/menu.lua
index 0d3e5883e..df6aaf5c0 100644
--- a/xmake/core/sandbox/modules/import/core/platform/menu.lua
+++ b/xmake/core/sandbox/modules/import/core/platform/menu.lua
@@ -24,43 +24,22 @@
local sandbox_core_platform_menu = sandbox_core_platform_menu or {}
-- load modules
-local platform = require("platform/platform")
+local menu = require("platform/menu")
+local raise = require("sandbox/modules/raise")
--- get the all platforms
-function sandbox_core_platform_menu.plats()
+-- get the platform menu options for the given action: config or global
+function sandbox_core_platform_menu.options(action)
-- get it
- local plats = platform.plats()
- assert(plats)
+ local options, errors = menu.options(action)
+ if not options then
+ raise(errors)
+ end
- -- ok
- return plats
+ -- ok?
+ return options
end
--- get the all architectures for the given platform
-function sandbox_core_platform_menu.archs(plat)
-
- -- get it
- local archs = platform.archs(plat)
- assert(archs)
-
- -- ok
- return archs
-end
-
--- get the platform menu options for global
-function sandbox_core_platform_menu.options_global()
-
- -- get it
- return platform.menu("global")
-end
-
--- get the platform menu options for config
-function sandbox_core_platform_menu.options_config()
-
- -- get it
- return platform.menu("config")
-end
-- return module
return sandbox_core_platform_menu
diff --git a/xmake/core/sandbox/modules/import/core/platform/platform.lua b/xmake/core/sandbox/modules/import/core/platform/platform.lua
index 05718b0b3..00f22a3f8 100644
--- a/xmake/core/sandbox/modules/import/core/platform/platform.lua
+++ b/xmake/core/sandbox/modules/import/core/platform/platform.lua
@@ -30,14 +30,34 @@ local raise = require("sandbox/modules/raise")
-- load the current platform
function sandbox_core_platform_platform.load(plat)
- -- check
- assert(plat)
-
-- load the platform configure
- if not platform.load(plat) then
- raise("load platform: %s failed!", plat)
+ local ok, errors = platform.load(plat)
+ if not ok then
+ raise(errors)
end
end
+-- get the all platforms
+function sandbox_core_platform_platform.plats()
+
+ -- get it
+ local plats = platform.plats()
+ assert(plats)
+
+ -- ok
+ return plats
+end
+
+-- get the all architectures for the given platform
+function sandbox_core_platform_platform.archs(plat)
+
+ -- get it
+ local archs = platform.archs(plat)
+ assert(archs)
+
+ -- ok
+ return archs
+end
+
-- return module
return sandbox_core_platform_platform
diff --git a/xmake/core/sandbox/modules/insert.lua b/xmake/core/sandbox/modules/insert.lua
new file mode 100644
index 000000000..08d72fa23
--- /dev/null
+++ b/xmake/core/sandbox/modules/insert.lua
@@ -0,0 +1,26 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2015 - 2016, ruki All rights reserved.
+--
+-- @author ruki
+-- @file insert.lua
+--
+
+-- return module
+return require("sandbox/modules/table").insert
+
+
diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua
new file mode 100755
index 000000000..922ca3165
--- /dev/null
+++ b/xmake/platforms/macosx/xmake.lua
@@ -0,0 +1,127 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2015 - 2016, ruki All rights reserved.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+-- define platform
+platform("macosx")
+
+ -- set os
+ set_platform_os("macosx")
+
+ -- set hosts
+ set_platform_hosts("macosx")
+
+ -- set archs
+ set_platform_archs("i386", "x86_64")
+
+ -- set checker
+-- set_platform_checker("checker")
+
+ -- on load
+ on_platform_load(function ()
+
+ -- imports
+ import("core.project.config")
+
+ -- init the file formats
+ _g.formats = {}
+ _g.formats.static = {"lib", ".a"}
+ _g.formats.object = {"", ".o"}
+ _g.formats.shared = {"lib", ".dylib"}
+
+ -- init the tools
+ _g.tools = {}
+ _g.tools.make = config.get("make")
+ _g.tools.ccache = config.get("__ccache")
+ _g.tools.cc = config.get("cc")
+ _g.tools.cxx = config.get("cxx")
+ _g.tools.mm = config.get("mm")
+ _g.tools.mxx = config.get("mxx")
+ _g.tools.ld = config.get("ld")
+ _g.tools.ar = config.get("ar")
+ _g.tools.sh = config.get("sh")
+ _g.tools.ex = config.get("ar")
+ _g.tools.sc = config.get("sc")
+
+ -- init flags for architecture
+ local arch = config.get("arch")
+ local target_minver = config.get("target_minver")
+ _g.cxflags = { "-arch " .. arch, "-fpascal-strings", "-fmessage-length=0" }
+ _g.mxflags = { "-arch " .. arch, "-fpascal-strings", "-fmessage-length=0" }
+ _g.asflags = { "-arch " .. arch }
+ _g.ldflags = { "-arch " .. arch, "-mmacosx-version-min=" .. target_minver, "-stdlib=libc++", "-lz" }
+ _g.shflags = { "-arch " .. arch, "-mmacosx-version-min=" .. target_minver, "-stdlib=libc++", "-lz" }
+ _g.scflags = { format("-target %s-apple-macosx%s", arch, target_minver) }
+
+ -- init flags for the xcode sdk directory
+ local xcode_dir = config.get("xcode_dir")
+ local xcode_sdkver = config.get("xcode_sdkver")
+ local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" .. xcode_sdkver .. ".sdk"
+ insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.scflags, "-sdk " .. xcode_sdkdir)
+
+ -- init includedirs
+ --
+ -- @note
+ -- cannot use _g.includedirs because the swift/objc compiler will compile code failed
+ insert(_g.cxflags, "-I/usr/include")
+ insert(_g.cxflags, "-I/usr/local/include")
+
+ -- init linkdirs
+ _g.linkdirs = {"/usr/lib", "/usr/local/lib"}
+
+ -- save swift link directory for tools
+ config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx")
+
+ end)
+
+ -- set menu
+ set_platform_menu({
+ config =
+ {
+ {}
+ , {nil, "mm", "kv", nil, "the objc compiler" }
+ , {nil, "mxx", "kv", nil, "the objc++ compiler" }
+ , {nil, "mflags", "kv", nil, "the objc compiler flags" }
+ , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
+ , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
+ , {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
+ , {nil, "target_minver", "kv", "auto", "the target minimal version" }
+ }
+
+ , global =
+ {
+ {}
+ , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
+ }
+ })
+
+
+
+
+
+