summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-15 13:38:18 +0800
committerruki <[email protected]>2015-06-15 13:38:18 +0800
commit2ff2b14ec02d4d2ec77d26213412c1b82473bf8d (patch)
treedcf30572925e452e37d3f57371218913ea342105
parent7345d435c1c09f6a1d2ccd329174f99f150ec9b0 (diff)
add defines to config.h if ok
-rw-r--r--tests/console/xmake.lua8
-rw-r--r--xmake/scripts/base/compiler.lua8
-rw-r--r--xmake/scripts/base/project.lua20
3 files changed, 18 insertions, 18 deletions
diff --git a/tests/console/xmake.lua b/tests/console/xmake.lua
index 3d20cc516..9f45c4cce 100644
--- a/tests/console/xmake.lua
+++ b/tests/console/xmake.lua
@@ -30,13 +30,13 @@ end
add_option("option1")
set_option_enable(true)
set_option_showmenu(true)
- add_option_defines_h("OPTION1_ENABLE")
+ add_option_defines_h_if_ok("OPTION1_ENABLE")
set_option_description("The option for definition and need not check.")
add_option("option2")
set_option_enable(false)
set_option_showmenu(true)
- add_option_defines_h("OPTION2_ENABLE")
+ add_option_defines_h_if_ok("OPTION2_ENABLE")
add_option_cincludes("stdio.h", "hello1.h")
add_option_includedirs("src/hello1")
set_option_description("The option for finding includes.")
@@ -44,7 +44,7 @@ add_option("option2")
add_option("option3")
set_option_enable(false)
set_option_showmenu(true)
- add_option_defines_h("OPTION3_ENABLE")
+ add_option_defines_h_if_ok("OPTION3_ENABLE")
add_option_links("hello1")
add_option_linkdirs("$(buildir)")
set_option_description("The option for finding links.")
@@ -52,7 +52,7 @@ add_option("option3")
add_option("option4")
set_option_enable(false)
set_option_showmenu(true)
- add_option_defines_h("OPTION4_ENABLE")
+ add_option_defines_h_if_ok("OPTION4_ENABLE")
set_option_description("The option for finding interfaces.")
if not plats("windows") then
add_option_links("z", "sqlite3")
diff --git a/xmake/scripts/base/compiler.lua b/xmake/scripts/base/compiler.lua
index 0b58533e2..da1d46d2f 100644
--- a/xmake/scripts/base/compiler.lua
+++ b/xmake/scripts/base/compiler.lua
@@ -314,16 +314,16 @@ function compiler._addflags_from_option(module, flags, flagnames, opt)
end
-- append the defines flags
- if opt.defines and module.flag_define then
- local defines = utils.wrap(opt.defines)
+ if opt.defines_if_ok and module.flag_define then
+ local defines = utils.wrap(opt.defines_if_ok)
for _, define in ipairs(defines) do
table.join2(flags, module:flag_define(define))
end
end
-- append the undefines flags
- if opt.undefines and module.flag_undefine then
- local undefines = utils.wrap(opt.undefines)
+ if opt.undefines_if_ok and module.flag_undefine then
+ local undefines = utils.wrap(opt.undefines_if_ok)
for _, undefine in ipairs(undefines) do
table.join2(flags, module:flag_undefine(undefine))
end
diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua
index fdad33506..2cf101f79 100644
--- a/xmake/scripts/base/project.lua
+++ b/xmake/scripts/base/project.lua
@@ -294,11 +294,11 @@ function project._makeconf_for_target(target_name, target)
-- make the defines
local defines = {}
- if target.defines_h then table.join2(defines, target.defines_h) end
+ if target.defines_h_if_ok then table.join2(defines, target.defines_h_if_ok) end
-- make the undefines
local undefines = {}
- if target.undefines_h then table.join2(undefines, target.undefines_h) end
+ if target.undefines_h_if_ok then table.join2(undefines, target.undefines_h_if_ok) end
-- the options
if target.options then
@@ -310,10 +310,10 @@ function project._makeconf_for_target(target_name, target)
if nil ~= opt then
-- get the option defines
- if opt.defines_h then table.join2(defines, opt.defines_h) end
+ if opt.defines_h_if_ok then table.join2(defines, opt.defines_h_if_ok) end
-- get the option undefines
- if opt.undefines_h then table.join2(undefines, opt.undefines_h) end
+ if opt.undefines_h_if_ok then table.join2(undefines, opt.undefines_h_if_ok) end
end
end
@@ -716,11 +716,11 @@ function project._load_options(file)
, "cxxflags"
, "ldflags"
, "defines"
+ , "defines_if_ok"
+ , "defines_h_if_ok"
, "undefines"
- , "defines_h"
- , "defines_h_if_have_cfuncs"
- , "undefines_h"
- , "undefines_h_if_have_cfuncs"}
+ , "undefines_if_ok"
+ , "undefines_h_if_ok"}
for _, interface in ipairs(interfaces) do
newenv["add_option_" .. interface] = function (...) return project._api_add_values(newenv._OPTION, interface, ...) end
@@ -811,8 +811,8 @@ function project._load_targets(file)
, "options"
, "defines"
, "undefines"
- , "defines_h"
- , "undefines_h"
+ , "defines_h_if_ok"
+ , "undefines_h_if_ok"
, "languages"
, "vectorexts"}
for _, interface in ipairs(interfaces) do