summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-24 17:56:10 +0800
committerruki <[email protected]>2017-02-24 17:56:10 +0800
commit0d364e3ba71ea2805c274247c4eb4f34d9bf7c10 (patch)
treeb853ee444e92443e0592c3561b3256e3d0ed823b
parent009c17b89cd33cf7915f82d0d994233238a6bc4c (diff)
map some dlang flags
-rwxr-xr-xxmake/languages/dlang/xmake.lua4
-rw-r--r--xmake/platforms/linux/load.lua6
-rw-r--r--xmake/platforms/macosx/load.lua6
-rwxr-xr-xxmake/platforms/windows/xmake.lua6
-rwxr-xr-xxmake/tools/dmd.lua77
-rwxr-xr-xxmake/tools/gdc.lua35
6 files changed, 126 insertions, 8 deletions
diff --git a/xmake/languages/dlang/xmake.lua b/xmake/languages/dlang/xmake.lua
index 938ba5c94..efc8f9d4c 100755
--- a/xmake/languages/dlang/xmake.lua
+++ b/xmake/languages/dlang/xmake.lua
@@ -53,12 +53,8 @@ language("dlang")
, "target.warnings"
, "target.optimize:check"
, "target.vectorexts:check"
- , "target.defines"
- , "target.undefines"
, "target.includedirs"
, "platform.includedirs"
- , "platform.defines"
- , "platform.undefines"
}
, binary =
{
diff --git a/xmake/platforms/linux/load.lua b/xmake/platforms/linux/load.lua
index caf20d6ba..185b5c8a5 100644
--- a/xmake/platforms/linux/load.lua
+++ b/xmake/platforms/linux/load.lua
@@ -74,8 +74,10 @@ function main()
_g["go-ldflags"] = {}
-- init flags for dlang
- _g["dc-shflags"] = {}
- _g["dc-ldflags"] = {}
+ local dc_archs = { i386 = "-m32", x86_64 = "-m64" }
+ _g.dcflags = { dc_archs[arch] or "" }
+ _g["dc-shflags"] = { dc_archs[arch] or "" }
+ _g["dc-ldflags"] = { dc_archs[arch] or "" }
-- init flags for rust
_g["rc-shflags"] = {}
diff --git a/xmake/platforms/macosx/load.lua b/xmake/platforms/macosx/load.lua
index d03a416f1..43a685870 100644
--- a/xmake/platforms/macosx/load.lua
+++ b/xmake/platforms/macosx/load.lua
@@ -64,8 +64,10 @@ function main()
_g["go-ldflags"] = {}
-- init flags for dlang
- _g["dc-shflags"] = {}
- _g["dc-ldflags"] = {}
+ local dc_archs = { i386 = "-m32", x86_64 = "-m64" }
+ _g.dcflags = { dc_archs[arch] or "" }
+ _g["dc-shflags"] = { dc_archs[arch] or "" }
+ _g["dc-ldflags"] = { dc_archs[arch] or "" }
-- init flags for rust
_g["rc-shflags"] = {}
diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua
index 764f44412..4f5325069 100755
--- a/xmake/platforms/windows/xmake.lua
+++ b/xmake/platforms/windows/xmake.lua
@@ -51,6 +51,12 @@ platform("windows")
_g.formats.binary = {"", ".exe"}
_g.formats.symbol = {"", ".pdb"}
+ -- init flags for dlang
+ local dc_archs = { x86 = "-m32", x64 = "-m64", amd64 = "-m64", x86_amd64 = "-m64" }
+ _g.dcflags = { dc_archs[arch] or "" }
+ _g["dc-shflags"] = { dc_archs[arch] or "" }
+ _g["dc-ldflags"] = { dc_archs[arch] or "" }
+
-- ok
return _g
end)
diff --git a/xmake/tools/dmd.lua b/xmake/tools/dmd.lua
index e71a0f51c..fec9e9e70 100755
--- a/xmake/tools/dmd.lua
+++ b/xmake/tools/dmd.lua
@@ -61,6 +61,83 @@ function get(name)
return _g[name]
end
+-- make the optimize flag
+function nf_optimize(level)
+
+ -- the maps
+ local maps =
+ {
+ none = ""
+ , fast = "-O"
+ , faster = "-O -release"
+ , fastest = "-O -release -inline -boundscheck=off"
+ , smallest = "-O -release -boundscheck=off"
+ , aggressive = "-O -release -inline -boundscheck=off"
+ }
+
+ -- make it
+ return maps[level] or ""
+end
+
+-- make the strip flag
+function nf_strip(level)
+
+ -- the maps
+ local maps =
+ {
+ debug = "-L-S"
+ , all = "-L-s"
+ }
+
+ -- make it
+ return maps[level] or ""
+end
+
+-- make the symbol flag
+function nf_symbol(level)
+
+ -- the maps
+ local maps =
+ {
+ debug = "-g -debug"
+ , hidden = ""
+ }
+
+ -- make it
+ return maps[level] or ""
+end
+
+-- make the warning flag
+function nf_warning(level)
+
+ -- the maps
+ local maps =
+ {
+ none = "-d"
+ , less = "-w"
+ , more = "-w -wi"
+ , all = "-w -wi"
+ , error = "-de"
+ }
+
+ -- make it
+ return maps[level] or ""
+end
+
+-- make the vector extension flag
+function nf_vectorext(extension)
+
+ -- the maps
+ local maps =
+ {
+ avx = "-mcpu=avx"
+ , avx2 = "-mcpu=avx"
+ }
+
+ -- make it
+ return maps[extension] or ""
+end
+
-- make the includedir flag
function nf_includedir(dir)
diff --git a/xmake/tools/gdc.lua b/xmake/tools/gdc.lua
new file mode 100755
index 000000000..64b36c2b9
--- /dev/null
+++ b/xmake/tools/gdc.lua
@@ -0,0 +1,35 @@
+--!The Make-like Build Utility based on Lua
+--
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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 - 2017, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file gdc.lua
+--
+
+-- inherit dmd
+inherit("dmd")
+
+-- init it
+function init(shellname, kind)
+
+ -- init super
+ _super.init(shellname or "gdc", kind)
+end
+
+