summaryrefslogtreecommitdiff
path: root/xmake/rules/mode/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-04-13 22:39:50 +0800
committerruki <[email protected]>2018-04-13 09:59:00 +0800
commitd8a540a7e74e224d0a19dec874628a69766bcd98 (patch)
tree9e35ccf811eca836899f0a423de1f22e73f3eca7 /xmake/rules/mode/xmake.lua
parentf2c934d1370eed2e674a94c4f678a3cf3da812f0 (diff)
add debug and release rules
Diffstat (limited to 'xmake/rules/mode/xmake.lua')
-rw-r--r--xmake/rules/mode/xmake.lua57
1 files changed, 57 insertions, 0 deletions
diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua
new file mode 100644
index 000000000..6511667c5
--- /dev/null
+++ b/xmake/rules/mode/xmake.lua
@@ -0,0 +1,57 @@
+--!A cross-platform 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 - 2018, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+-- define rule: debug mode
+rule("mode:debug")
+ on_load(function (target)
+
+ -- is debug mode now? xmake f -m debug
+ if val("mode") == "debug" then
+
+ -- enable the debug symbols
+ target:set("symbols", "debug")
+
+ -- disable optimization
+ target:set("optimize", "none")
+ end
+ end)
+
+-- define rule: release mode
+rule("mode:release")
+ on_load(function (target)
+
+ -- is release mode now? xmake f -m release
+ if val("mode") == "release" then
+
+ -- set the symbols visibility: hidden
+ target:set("symbols", "hidden")
+
+ -- enable fastest optimization
+ target:set("optimize", "fastest")
+
+ -- strip all symbols
+ target:set("strip", "all")
+ end
+ end)
+