summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/core/tools/icc.lua31
-rw-r--r--xmake/modules/core/tools/icl.lua31
-rw-r--r--xmake/modules/core/tools/icpc.lua28
-rw-r--r--xmake/modules/detect/sdks/find_intel.lua135
-rw-r--r--xmake/modules/detect/tools/find_icc.lua52
-rw-r--r--xmake/modules/detect/tools/find_icl.lua56
-rw-r--r--xmake/modules/detect/tools/find_icpc.lua52
-rw-r--r--xmake/modules/detect/tools/icc/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/icl/has_flags.lua23
-rw-r--r--xmake/modules/detect/tools/icpc/has_flags.lua23
10 files changed, 454 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/icc.lua b/xmake/modules/core/tools/icc.lua
new file mode 100644
index 000000000..9a0eabac1
--- /dev/null
+++ b/xmake/modules/core/tools/icc.lua
@@ -0,0 +1,31 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file icc.lua
+--
+
+-- inherit gcc
+inherit("gcc")
+
+-- init it
+function init(self)
+ _super.init(self)
+end
+
+-- TODO
+-- inherit gcc.lua and override some interfaces in gcc.lua
+-- ...
diff --git a/xmake/modules/core/tools/icl.lua b/xmake/modules/core/tools/icl.lua
new file mode 100644
index 000000000..bd2bd5e14
--- /dev/null
+++ b/xmake/modules/core/tools/icl.lua
@@ -0,0 +1,31 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file icl.lua
+--
+
+-- inherit cl
+inherit("cl")
+
+-- init it
+function init(self)
+
+end
+
+-- TODO
+-- inherit cl.lua and override some interfaces in cl.lua
+-- ...
diff --git a/xmake/modules/core/tools/icpc.lua b/xmake/modules/core/tools/icpc.lua
new file mode 100644
index 000000000..6639bfcfe
--- /dev/null
+++ b/xmake/modules/core/tools/icpc.lua
@@ -0,0 +1,28 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file icpc.lua
+--
+
+-- inherit gcc
+inherit("gcc")
+
+-- init it
+function init(self)
+ _super.init(self)
+end
+
diff --git a/xmake/modules/detect/sdks/find_intel.lua b/xmake/modules/detect/sdks/find_intel.lua
new file mode 100644
index 000000000..f6edfaafd
--- /dev/null
+++ b/xmake/modules/detect/sdks/find_intel.lua
@@ -0,0 +1,135 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_intel.lua
+--
+
+-- imports
+import("lib.detect.find_file")
+import("lib.detect.find_tool")
+
+-- init vc variables
+local iclvars = {"path",
+ "lib",
+ "libpath",
+ "include",
+ "DevEnvdir",
+ "VSInstallDir",
+ "VCInstallDir",
+ "WindowsSdkDir",
+ "WindowsLibPath",
+ "WindowsSDKVersion",
+ "WindowsSdkBinPath",
+ "UniversalCRTSdkDir",
+ "UCRTVersion"}
+
+-- load iclvars_bat environment variables
+function _load_iclvars(iclvars_bat, arch, opt)
+
+ -- make the geniclvars.bat
+ opt = opt or {}
+ local geniclvars_bat = os.tmpfile() .. "_geniclvars.bat"
+ local geniclvars_dat = os.tmpfile() .. "_geniclvars.txt"
+ local file = io.open(geniclvars_bat, "w")
+ file:print("@echo off")
+ file:print("call \"%s\" -arch %s > nul", iclvars_bat, arch)
+ for idx, var in ipairs(iclvars) do
+ file:print("echo " .. var .. " = %%" .. var .. "%% %s %s", idx == 1 and ">" or ">>", geniclvars_dat)
+ end
+ file:close()
+
+ -- run geniclvars.bat
+ os.run(geniclvars_bat)
+
+ -- load all envirnoment variables
+ local variables = {}
+ for _, line in ipairs((io.readfile(geniclvars_dat) or ""):split("\n")) do
+ local p = line:find('=', 1, true)
+ if p then
+ local name = line:sub(1, p - 1):trim()
+ local value = line:sub(p + 1):trim()
+ variables[name] = value
+ end
+ end
+ if not variables.path then
+ return
+ end
+
+ -- remove some empty entries
+ for _, name in ipairs(iclvars) do
+ if variables[name] and #variables[name]:trim() == 0 then
+ variables[name] = nil
+ end
+ end
+
+ -- fix bin path for ia32
+ if variables.path and arch == "ia32" then
+ variables.path = variables.path:gsub("windows\\bin\\intel64;", "windows\\bin\\intel64_ia32;")
+ end
+
+ -- convert path/lib/include to PATH/LIB/INCLUDE
+ variables.PATH = variables.path
+ variables.LIB = variables.lib
+ variables.LIBPATH = variables.libpath
+ variables.INCLUDE = variables.include
+ variables.path = nil
+ variables.lib = nil
+ variables.include = nil
+ variables.libpath = nil
+ return variables
+end
+
+-- find intel envirnoment on windows
+function _find_intel_on_windows(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find iclvars_bat.bat
+ local paths = {"$(env ICPP_COMPILER20)"}
+ local iclvars_bat = find_file("bin/iclvars.bat", paths)
+ if iclvars_bat then
+
+ -- load iclvars_bat
+ local iclvars_x86 = _load_iclvars(iclvars_bat, "ia32", opt)
+ local iclvars_x64 = _load_iclvars(iclvars_bat, "intel64", opt)
+
+ -- save results
+ return {iclvars_bat = iclvars_bat, iclvars = {x86 = iclvars_x86, x64 = iclvars_x64}}
+ end
+end
+
+-- find intel envirnoment on linux
+function _find_intel_on_linux(opt)
+
+ -- attempt to find the sdk directory
+ local paths = {"/opt/intel/bin", "/usr/local/bin", "/usr/bin"}
+ local icc = find_file("icc", paths)
+ if icc then
+ local sdkdir = path.directory(path.directory(icc))
+ return {sdkdir = sdkdir, bindir = path.directory(icc), path.join(sdkdir, "include"), libdir = path.join(sdkdir, "lib")}
+ end
+end
+
+-- find intel environment
+function main(opt)
+ if is_host("windows") then
+ return _find_intel_on_windows(opt)
+ else
+ return _find_intel_on_linux(opt)
+ end
+end
diff --git a/xmake/modules/detect/tools/find_icc.lua b/xmake/modules/detect/tools/find_icc.lua
new file mode 100644
index 000000000..789a16a9e
--- /dev/null
+++ b/xmake/modules/detect/tools/find_icc.lua
@@ -0,0 +1,52 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_icc.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find icc
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local icc = find_icc()
+-- local icc, version, hintname = find_icc({program = "icc", version = true})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "icc", opt)
+
+ -- find program version
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
diff --git a/xmake/modules/detect/tools/find_icl.lua b/xmake/modules/detect/tools/find_icl.lua
new file mode 100644
index 000000000..ac0008c0e
--- /dev/null
+++ b/xmake/modules/detect/tools/find_icl.lua
@@ -0,0 +1,56 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_icl.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find icl
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local icl = find_icl()
+-- local icl, version, hintname = find_icl({program = "icl", version = true})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+ opt.check = opt.check or function (program) os.runv(program, {"/help"}, {envs = opt.envs}) end
+
+ -- find program
+ local program = find_program(opt.program or "icl.exe", opt)
+
+ -- find program version
+ local version = nil
+ if program and opt and opt.version then
+ opt.command = opt.command or function () local _, info = os.iorunv(program, {"/help"}, {envs = opt.envs}); return info end
+ opt.parse = opt.parse or function (output) return output:match("Version (%d+%.?%d*%.?%d*.-)%s") end
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
+
diff --git a/xmake/modules/detect/tools/find_icpc.lua b/xmake/modules/detect/tools/find_icpc.lua
new file mode 100644
index 000000000..6c806cad6
--- /dev/null
+++ b/xmake/modules/detect/tools/find_icpc.lua
@@ -0,0 +1,52 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_icpc.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find icpc
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local icpc = find_icpc()
+-- local icpc, version, hintname = find_icpc({program = "icpc", version = true})
+--
+-- @endcode
+--
+function main(opt)
+
+ -- init options
+ opt = opt or {}
+
+ -- find program
+ local program = find_program(opt.program or "icpc", opt)
+
+ -- find program version
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
diff --git a/xmake/modules/detect/tools/icc/has_flags.lua b/xmake/modules/detect/tools/icc/has_flags.lua
new file mode 100644
index 000000000..6ac2ce551
--- /dev/null
+++ b/xmake/modules/detect/tools/icc/has_flags.lua
@@ -0,0 +1,23 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file has_flags.lua
+--
+
+-- imports
+inherit("detect.tools.gcc.has_flags")
+
diff --git a/xmake/modules/detect/tools/icl/has_flags.lua b/xmake/modules/detect/tools/icl/has_flags.lua
new file mode 100644
index 000000000..81573039e
--- /dev/null
+++ b/xmake/modules/detect/tools/icl/has_flags.lua
@@ -0,0 +1,23 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file has_flags.lua
+--
+
+-- imports
+inherit("detect.tools.cl.has_flags")
+
diff --git a/xmake/modules/detect/tools/icpc/has_flags.lua b/xmake/modules/detect/tools/icpc/has_flags.lua
new file mode 100644
index 000000000..50d4f59d9
--- /dev/null
+++ b/xmake/modules/detect/tools/icpc/has_flags.lua
@@ -0,0 +1,23 @@
+--!A cross-platform build utility based on Lua
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+-- Copyright (C) 2015-2020, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file has_flags.lua
+--
+
+-- imports
+inherit("detect.tools.gxx.has_flags")
+