summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/ldc2.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-07-31 17:45:29 +0800
committerGitHub <[email protected]>2020-07-31 17:45:29 +0800
commit02ffe167ede48cc1c7cfc012c6f1b6b8f12a2f07 (patch)
tree2e658c8b128d6bbd45a81bc41049002b996d7eee /xmake/modules/core/tools/ldc2.lua
parentdeeef0bf58b2cc3a4389c782d7705ddf7c932f56 (diff)
parentc05b341f43ab99a6670773d524197411be81b5ea (diff)
Merge pull request #910 from xmake-io/dlang
Improve ldc2 and gdc support for dlang
Diffstat (limited to 'xmake/modules/core/tools/ldc2.lua')
-rw-r--r--xmake/modules/core/tools/ldc2.lua30
1 files changed, 21 insertions, 9 deletions
diff --git a/xmake/modules/core/tools/ldc2.lua b/xmake/modules/core/tools/ldc2.lua
index 9cf9fd48b..d564281c4 100644
--- a/xmake/modules/core/tools/ldc2.lua
+++ b/xmake/modules/core/tools/ldc2.lua
@@ -11,28 +11,40 @@
-- 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
+-- @author ruki, BarrOff
-- @file ldc2.lua
--
--- inherit dmd
+-- imports
inherit("dmd")
-- init it
function init(self)
-
- -- init super
- _super.init(self)
+
+ -- init arflags
+ self:set("dcarflags", "-lib")
-- init shflags
- self:set("dcshflags", "-shared")
+ self:set("dcshflags", "-shared", "--relocation-model=pic")
- -- init cxflags for the kind: shared
- self:set("shared.dcflags", "")
+ -- init dcflags for the kind: shared
+ self:set("shared.dcflags", "--relocation-model=pic")
end
+-- make the optimize flag
+function nf_optimize(self, level)
+ local maps =
+ {
+ fast = "-O"
+ , faster = "-O --release"
+ , fastest = "-O --release --boundscheck=off"
+ , smallest = "-O --release --boundscheck=off"
+ , aggressive = "-O --release --boundscheck=off"
+ }
+ return maps[level]
+end