From 3aab30fc254ae7e9bd138aff2bb263af0d447017 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 27 May 2015 09:32:01 +0800 Subject: add prober to all platforms --- xmake/scripts/platform/linux/_linux.lua | 10 ++++-- xmake/scripts/platform/linux/_prober.lua | 57 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 xmake/scripts/platform/linux/_prober.lua (limited to 'xmake/scripts/platform/linux') diff --git a/xmake/scripts/platform/linux/_linux.lua b/xmake/scripts/platform/linux/_linux.lua index 4b70986c4..b933d563b 100644 --- a/xmake/scripts/platform/linux/_linux.lua +++ b/xmake/scripts/platform/linux/_linux.lua @@ -23,11 +23,17 @@ -- define module: _linux local _linux = _linux or {} +-- load modules +local config = require("base/config") + -- init host -_linux._HOST = "linux" +_linux._HOST = "linux" -- init architectures -_linux._ARCHS = {"x86", "x64"} +_linux._ARCHS = {"x86", "x64"} + +-- init prober +_linux._PROBER = require("platform/linux/_prober") -- make configure function _linux.make(configs) diff --git a/xmake/scripts/platform/linux/_prober.lua b/xmake/scripts/platform/linux/_prober.lua new file mode 100644 index 000000000..cbfcc3710 --- /dev/null +++ b/xmake/scripts/platform/linux/_prober.lua @@ -0,0 +1,57 @@ +--!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 http://www.gnu.org/licenses/ +-- +-- Copyright (C) 2009 - 2015, 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") + +-- define module: _prober +local _prober = _prober or {} + +-- probe the architecture +function _prober._probe_arch(configs) + + -- get the architecture + local arch = configs.arch + + -- ok? + if arch and arch ~= "auto" then return true end + + -- init the default architecture + configs.arch = xmake._ARCH + + -- ok + return true +end + +-- probe the configure and update the values with "auto" +function _prober.done(configs) + + -- probe the architecture + if not _prober._probe_arch(configs) then return end + +end + +-- return module: _prober +return _prober -- cgit v1.3.1