diff options
| author | ruki <[email protected]> | 2021-10-02 23:29:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-10-02 23:29:03 +0800 |
| commit | e80a41789b0de5f2249c15d57486fd3a4b40ff99 (patch) | |
| tree | f3a893345c8da889236e68775dc3de92f1a092e9 /xmake/includes | |
| parent | d4789ff5e968294bf2e9831209d0cf61b61c9d43 (diff) | |
save and restore scope
Diffstat (limited to 'xmake/includes')
| -rw-r--r-- | xmake/includes/check_cflags.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_cfuncs.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_cincludes.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_csnippets.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_ctypes.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_cxxflags.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_cxxfuncs.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_cxxincludes.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_cxxsnippets.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_cxxtypes.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_features.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_links.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_macros.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/check_syslinks.lua | 4 | ||||
| -rw-r--r-- | xmake/includes/find_and_add_packages.lua | 2 |
15 files changed, 58 insertions, 0 deletions
diff --git a/xmake/includes/check_cflags.lua b/xmake/includes/check_cflags.lua index 85c9ef3c7..ef3f7866b 100644 --- a/xmake/includes/check_cflags.lua +++ b/xmake/includes/check_cflags.lua @@ -28,6 +28,7 @@ function check_cflags(definition, flags, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_defines(definition) on_check(function (option) @@ -37,6 +38,7 @@ function check_cflags(definition, flags, opt) end end) option_end() + restore_scope() add_options(optname) end @@ -54,6 +56,7 @@ function configvar_check_cflags(definition, flags, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) if opt.default == nil then set_configvar(defname, defval or 1, {quote = opt.quote}) @@ -65,6 +68,7 @@ function configvar_check_cflags(definition, flags, opt) end end) option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_cfuncs.lua b/xmake/includes/check_cfuncs.lua index 42d173a18..1a64cb250 100644 --- a/xmake/includes/check_cfuncs.lua +++ b/xmake/includes/check_cfuncs.lua @@ -34,6 +34,7 @@ function check_cfuncs(definition, funcs, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_cfuncs(funcs) add_defines(definition) @@ -59,6 +60,7 @@ function check_cfuncs(definition, funcs, opt) set_warnings(opt.warnings) end option_end() + restore_scope() add_options(optname) end @@ -75,6 +77,7 @@ function configvar_check_cfuncs(definition, funcs, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_cfuncs(funcs) if opt.default == nil then @@ -102,6 +105,7 @@ function configvar_check_cfuncs(definition, funcs, opt) set_warnings(opt.warnings) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_cincludes.lua b/xmake/includes/check_cincludes.lua index f9d69aad5..dc0308a65 100644 --- a/xmake/includes/check_cincludes.lua +++ b/xmake/includes/check_cincludes.lua @@ -28,6 +28,7 @@ function check_cincludes(definition, includes, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_cincludes(includes) if opt.includedirs then @@ -35,6 +36,7 @@ function check_cincludes(definition, includes, opt) end add_defines(definition) option_end() + restore_scope() add_options(optname) end @@ -50,6 +52,7 @@ function configvar_check_cincludes(definition, includes, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_cincludes(includes) if opt.includedirs then @@ -59,6 +62,7 @@ function configvar_check_cincludes(definition, includes, opt) set_configvar(defname, defval or 1, {quote = opt.quote}) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_csnippets.lua b/xmake/includes/check_csnippets.lua index 95aa0b2d5..9d2370ee0 100644 --- a/xmake/includes/check_csnippets.lua +++ b/xmake/includes/check_csnippets.lua @@ -29,6 +29,7 @@ function check_csnippets(definition, snippets, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_csnippets(definition, snippets, {tryrun = opt.tryrun, output = opt.output}) if not opt.output then @@ -69,6 +70,7 @@ function check_csnippets(definition, snippets, opt) end) end option_end() + restore_scope() add_options(optname) end @@ -86,6 +88,7 @@ function configvar_check_csnippets(definition, snippets, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_csnippets(definition, snippets, {tryrun = opt.tryrun, output = opt.output}) if opt.default == nil then @@ -120,6 +123,7 @@ function configvar_check_csnippets(definition, snippets, opt) end) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_ctypes.lua b/xmake/includes/check_ctypes.lua index e0c3caa47..b3f59b04e 100644 --- a/xmake/includes/check_ctypes.lua +++ b/xmake/includes/check_ctypes.lua @@ -28,6 +28,7 @@ function check_ctypes(definition, types, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_ctypes(types) add_defines(definition) @@ -47,6 +48,7 @@ function check_ctypes(definition, types, opt) add_cincludes(opt.includes) end option_end() + restore_scope() add_options(optname) end @@ -63,6 +65,7 @@ function configvar_check_ctypes(definition, types, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_ctypes(types) if opt.default == nil then @@ -84,6 +87,7 @@ function configvar_check_ctypes(definition, types, opt) add_cincludes(opt.includes) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_cxxflags.lua b/xmake/includes/check_cxxflags.lua index 9a0880697..38ea5172e 100644 --- a/xmake/includes/check_cxxflags.lua +++ b/xmake/includes/check_cxxflags.lua @@ -28,6 +28,7 @@ function check_cxxflags(definition, flags, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_defines(definition) on_check(function (option) @@ -37,6 +38,7 @@ function check_cxxflags(definition, flags, opt) end end) option_end() + restore_scope() add_options(optname) end @@ -54,6 +56,7 @@ function configvar_check_cxxflags(definition, flags, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) if opt.default == nil then set_configvar(defname, defval or 1, {quote = opt.quote}) @@ -65,6 +68,7 @@ function configvar_check_cxxflags(definition, flags, opt) end end) option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_cxxfuncs.lua b/xmake/includes/check_cxxfuncs.lua index 3a64075dc..1488f7312 100644 --- a/xmake/includes/check_cxxfuncs.lua +++ b/xmake/includes/check_cxxfuncs.lua @@ -34,6 +34,7 @@ function check_cxxfuncs(definition, funcs, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_cxxfuncs(funcs) add_defines(definition) @@ -59,6 +60,7 @@ function check_cxxfuncs(definition, funcs, opt) set_warnings(opt.warnings) end option_end() + restore_scope() add_options(optname) end @@ -75,6 +77,7 @@ function configvar_check_cxxfuncs(definition, funcs, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_cxxfuncs(funcs) if opt.default == nil then @@ -102,6 +105,7 @@ function configvar_check_cxxfuncs(definition, funcs, opt) set_warnings(opt.warnings) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_cxxincludes.lua b/xmake/includes/check_cxxincludes.lua index a779ffd15..45cb2d2c0 100644 --- a/xmake/includes/check_cxxincludes.lua +++ b/xmake/includes/check_cxxincludes.lua @@ -28,10 +28,12 @@ function check_cxxincludes(definition, includes, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_cxxincludes(includes) add_defines(definition) option_end() + restore_scope() add_options(optname) end @@ -47,12 +49,14 @@ function configvar_check_cxxincludes(definition, includes, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_cxxincludes(includes) if opt.default == nil then set_configvar(defname, defval or 1, {quote = opt.quote}) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_cxxsnippets.lua b/xmake/includes/check_cxxsnippets.lua index b46c650ff..daa71780c 100644 --- a/xmake/includes/check_cxxsnippets.lua +++ b/xmake/includes/check_cxxsnippets.lua @@ -29,6 +29,7 @@ function check_cxxsnippets(definition, snippets, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_cxxsnippets(definition, snippets, {tryrun = opt.tryrun, output = opt.output}) if not opt.output then @@ -69,6 +70,7 @@ function check_cxxsnippets(definition, snippets, opt) end) end option_end() + restore_scope() add_options(optname) end @@ -86,6 +88,7 @@ function configvar_check_cxxsnippets(definition, snippets, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_cxxsnippets(definition, snippets, {tryrun = opt.tryrun, output = opt.output}) if opt.default == nil then @@ -120,6 +123,7 @@ function configvar_check_cxxsnippets(definition, snippets, opt) end) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_cxxtypes.lua b/xmake/includes/check_cxxtypes.lua index e53caae6e..f5b8c677a 100644 --- a/xmake/includes/check_cxxtypes.lua +++ b/xmake/includes/check_cxxtypes.lua @@ -28,6 +28,7 @@ function check_cxxtypes(definition, types, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_cxxtypes(types) add_defines(definition) @@ -47,6 +48,7 @@ function check_cxxtypes(definition, types, opt) add_cxxincludes(opt.includes) end option_end() + restore_scope() add_options(optname) end @@ -63,6 +65,7 @@ function configvar_check_cxxtypes(definition, types, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_cxxtypes(types) if opt.default == nil then @@ -84,6 +87,7 @@ function configvar_check_cxxtypes(definition, types, opt) add_cxxincludes(opt.includes) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_features.lua b/xmake/includes/check_features.lua index 7c02be173..3e8fb47be 100644 --- a/xmake/includes/check_features.lua +++ b/xmake/includes/check_features.lua @@ -28,6 +28,7 @@ function check_features(definition, features, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_features(features) add_defines(definition) @@ -44,6 +45,7 @@ function check_features(definition, features, opt) add_cxxflags(opt.cxxflags) end option_end() + restore_scope() add_options(optname) end @@ -59,6 +61,7 @@ function configvar_check_features(definition, features, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_features(features) if opt.default == nil then @@ -77,6 +80,7 @@ function configvar_check_features(definition, features, opt) add_cxxflags(opt.cxxflags) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_links.lua b/xmake/includes/check_links.lua index 06b8cb38c..54891361e 100644 --- a/xmake/includes/check_links.lua +++ b/xmake/includes/check_links.lua @@ -28,10 +28,12 @@ function check_links(definition, links, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_links(links) add_defines(definition) option_end() + restore_scope() add_options(optname) end @@ -47,12 +49,14 @@ function configvar_check_links(definition, links, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_links(links) if opt.default == nil then set_configvar(defname, defval or 1, {quote = opt.quote}) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_macros.lua b/xmake/includes/check_macros.lua index ec4beddce..0ed879c95 100644 --- a/xmake/includes/check_macros.lua +++ b/xmake/includes/check_macros.lua @@ -30,6 +30,7 @@ function check_macros(definition, macros, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local snippets = {} + save_scope() option(optname) for _, macro in ipairs(macros) do if macro:find(' ', 1, true) then @@ -67,6 +68,7 @@ function check_macros(definition, macros, opt) add_cxxflags(opt.cxxflags) end option_end() + restore_scope() add_options(optname) end @@ -81,6 +83,7 @@ function configvar_check_macros(definition, macros, opt) local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) local snippets = {} + save_scope() option(optname) for _, macro in ipairs(macros) do if macro:find(' ', 1, true) then @@ -120,6 +123,7 @@ function configvar_check_macros(definition, macros, opt) add_cxxflags(opt.cxxflags) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/check_syslinks.lua b/xmake/includes/check_syslinks.lua index 133e24dcd..8df32a1b8 100644 --- a/xmake/includes/check_syslinks.lua +++ b/xmake/includes/check_syslinks.lua @@ -28,10 +28,12 @@ function check_syslinks(definition, links, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) + save_scope() option(optname) add_syslinks(links) add_defines(definition) option_end() + restore_scope() add_options(optname) end @@ -47,12 +49,14 @@ function configvar_check_syslinks(definition, links, opt) opt = opt or {} local optname = "__" .. (opt.name or definition) local defname, defval = unpack(definition:split('=')) + save_scope() option(optname) add_syslinks(links) if opt.default == nil then set_configvar(defname, defval or 1, {quote = opt.quote}) end option_end() + restore_scope() if opt.default == nil then add_options(optname) else diff --git a/xmake/includes/find_and_add_packages.lua b/xmake/includes/find_and_add_packages.lua index 21aa2f783..4bcdd76f9 100644 --- a/xmake/includes/find_and_add_packages.lua +++ b/xmake/includes/find_and_add_packages.lua @@ -33,11 +33,13 @@ function find_and_add_packages(...) for _, name in ipairs({...}) do local optname = "__" .. name + save_scope() option(optname) before_check(function (option) option:add(find_packages(name)) end) option_end() + restore_scope() add_options(optname) end end |
