diff options
| author | ruki <[email protected]> | 2021-03-06 00:56:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-03-06 00:56:31 +0800 |
| commit | 5a7702689c2ca00d77fb922c3c03ab0c7778ffad (patch) | |
| tree | e3d0e233ed1f5a82c7ab21c80523f8d44c2c5c0d | |
| parent | 0a3430a9e0a613de7cdac9e8d75335683744ab95 (diff) | |
switch to on_config
| -rw-r--r-- | xmake/rules/mode/xmake.lua | 26 | ||||
| -rw-r--r-- | xmake/rules/qt/env/xmake.lua | 9 | ||||
| -rw-r--r-- | xmake/rules/qt/moc/xmake.lua | 7 | ||||
| -rw-r--r-- | xmake/rules/qt/qrc/xmake.lua | 10 | ||||
| -rw-r--r-- | xmake/rules/qt/ui/xmake.lua | 10 | ||||
| -rw-r--r-- | xmake/rules/qt/xmake.lua | 36 | ||||
| -rw-r--r-- | xmake/rules/utils/compiler_runtime/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/utils/inherit_links/xmake.lua | 2 |
8 files changed, 38 insertions, 64 deletions
diff --git a/xmake/rules/mode/xmake.lua b/xmake/rules/mode/xmake.lua index 932e47ae2..d68d8e42c 100644 --- a/xmake/rules/mode/xmake.lua +++ b/xmake/rules/mode/xmake.lua @@ -20,7 +20,7 @@ -- define rule: debug mode rule("mode.debug") - after_load(function (target) + on_config(function (target) -- is debug mode now? xmake f -m debug if is_mode("debug") then @@ -39,7 +39,7 @@ rule("mode.debug") -- define rule: release mode rule("mode.release") - after_load(function (target) + on_config(function (target) -- is release mode now? xmake f -m release if is_mode("release") then @@ -70,7 +70,7 @@ rule("mode.release") -- define rule: release with debug symbols mode rule("mode.releasedbg") - after_load(function (target) + on_config(function (target) -- is releasedbg mode now? xmake f -m releasedbg if is_mode("releasedbg") then @@ -101,7 +101,7 @@ rule("mode.releasedbg") -- define rule: release with minsize mode rule("mode.minsizerel") - after_load(function (target) + on_config(function (target) -- is minsizerel mode now? xmake f -m minsizerel if is_mode("minsizerel") then @@ -128,7 +128,7 @@ rule("mode.minsizerel") -- define rule: profile mode rule("mode.profile") - after_load(function (target) + on_config(function (target) -- is profile mode now? xmake f -m profile if is_mode("profile") then @@ -159,7 +159,7 @@ rule("mode.profile") -- define rule: coverage mode rule("mode.coverage") - after_load(function (target) + on_config(function (target) -- is coverage mode now? xmake f -m coverage if is_mode("coverage") then @@ -183,7 +183,7 @@ rule("mode.coverage") -- define rule: asan mode rule("mode.asan") - after_load(function (target) + on_config(function (target) -- is asan mode now? xmake f -m asan if is_mode("asan") then @@ -212,7 +212,7 @@ rule("mode.asan") -- define rule: tsan mode rule("mode.tsan") - after_load(function (target) + on_config(function (target) -- is tsan mode now? xmake f -m tsan if is_mode("tsan") then @@ -241,7 +241,7 @@ rule("mode.tsan") -- define rule: msan mode rule("mode.msan") - after_load(function (target) + on_config(function (target) -- is msan mode now? xmake f -m msan if is_mode("msan") then @@ -270,7 +270,7 @@ rule("mode.msan") -- define rule: lsan mode rule("mode.lsan") - after_load(function (target) + on_config(function (target) -- is lsan mode now? xmake f -m lsan if is_mode("lsan") then @@ -299,7 +299,7 @@ rule("mode.lsan") -- define rule: ubsan mode rule("mode.ubsan") - after_load(function (target) + on_config(function (target) -- is ubsan mode now? xmake f -m ubsan if is_mode("ubsan") then @@ -328,7 +328,7 @@ rule("mode.ubsan") -- define rule: valgrind mode rule("mode.valgrind") - after_load(function (target) + on_config(function (target) -- is valgrind mode now? xmake f -m valgrind if is_mode("valgrind") then @@ -351,7 +351,7 @@ rule("mode.valgrind") -- define rule: check mode (deprecated) rule("mode.check") - after_load(function (target) + on_config(function (target) -- is check mode now? xmake f -m check if is_mode("check") then diff --git a/xmake/rules/qt/env/xmake.lua b/xmake/rules/qt/env/xmake.lua index 38fd503fc..4cc39794c 100644 --- a/xmake/rules/qt/env/xmake.lua +++ b/xmake/rules/qt/env/xmake.lua @@ -18,11 +18,8 @@ -- @file xmake.lua -- --- define rule: environment rule("qt.env") - - -- before load - before_load(function (target) + on_load(function (target) -- imports import("detect.sdks.find_qt") @@ -33,11 +30,11 @@ rule("qt.env") qt = assert(find_qt(nil, {verbose = true}), "Qt SDK not found!") target:data_set("qt", qt) end - if is_plat("windows") or (is_plat("mingw") and is_host("windows")) then + if target:is_plat("windows") or (target:is_plat("mingw") and is_host("windows")) then target:add("runenvs", "PATH", qt.bindir) target:set("runenv", "QML2_IMPORT_PATH", qt.qmldir) target:set("runenv", "QML_IMPORT_TRACE", "1") - elseif is_plat("msys", "cygwin") then + elseif target:is_plat("msys", "cygwin") then raise("please run `xmake f -p mingw --mingw=/mingw64` to support Qt/Mingw64 on Msys!") end end) diff --git a/xmake/rules/qt/moc/xmake.lua b/xmake/rules/qt/moc/xmake.lua index 2ad3d969c..46ff73dfa 100644 --- a/xmake/rules/qt/moc/xmake.lua +++ b/xmake/rules/qt/moc/xmake.lua @@ -18,16 +18,9 @@ -- @file xmake.lua -- --- define rule: moc rule("qt.moc") - - -- add rule: qt environment add_deps("qt.env") - - -- set extensions set_extensions(".h", ".hpp") - - -- before build file (we need compile it first if exists Q_PRIVATE_SLOT) before_buildcmd_file(function (target, batchcmds, sourcefile, opt) -- imports diff --git a/xmake/rules/qt/qrc/xmake.lua b/xmake/rules/qt/qrc/xmake.lua index fa5d85743..2529ef118 100644 --- a/xmake/rules/qt/qrc/xmake.lua +++ b/xmake/rules/qt/qrc/xmake.lua @@ -18,17 +18,10 @@ -- @file xmake.lua -- --- define rule: *.qrc rule("qt.qrc") - - -- add rule: qt environment add_deps("qt.env") - - -- set extensions set_extensions(".qrc") - - -- before load - before_load(function (target) + on_load(function (target) -- get rcc local rcc = path.join(target:data("qt").bindir, is_host("windows") and "rcc.exe" or "rcc") @@ -38,7 +31,6 @@ rule("qt.qrc") target:data_set("qt.rcc", rcc) end) - -- on build file on_buildcmd_file(function (target, batchcmds, sourcefile_qrc, opt) -- get rcc diff --git a/xmake/rules/qt/ui/xmake.lua b/xmake/rules/qt/ui/xmake.lua index d6811092c..b1ce103e5 100644 --- a/xmake/rules/qt/ui/xmake.lua +++ b/xmake/rules/qt/ui/xmake.lua @@ -18,17 +18,10 @@ -- @file xmake.lua -- --- define rule: *.ui rule("qt.ui") - - -- add rule: qt environment add_deps("qt.env") - - -- set extensions set_extensions(".ui") - - -- before load - before_load(function (target) + on_load(function (target) -- get uic local uic = path.join(target:data("qt").bindir, is_host("windows") and "uic.exe" or "uic") @@ -49,7 +42,6 @@ rule("qt.ui") target:data_set("qt.uic", uic) end) - -- before build file before_buildcmd_file(function (target, batchcmds, sourcefile_ui, opt) local uic = target:data("qt.uic") local headerfile_dir = path.join(target:autogendir(), "rules", "qt", "ui") diff --git a/xmake/rules/qt/xmake.lua b/xmake/rules/qt/xmake.lua index fd5b5a41e..ed4deedb7 100644 --- a/xmake/rules/qt/xmake.lua +++ b/xmake/rules/qt/xmake.lua @@ -41,11 +41,11 @@ rule("qt.static") add_deps("qt.qrc", "qt.ui", "qt.moc") -- we must set kind before target.on_load(), may we will use target in on_load() - before_load(function (target) + on_load(function (target) target:set("kind", "static") end) - after_load(function (target) + on_config(function (target) import("load")(target, {frameworks = {"QtCore"}}) end) @@ -54,11 +54,11 @@ rule("qt.shared") add_deps("qt.qrc", "qt.ui", "qt.moc") -- we must set kind before target.on_load(), may we will use target in on_load() - before_load(function (target) + on_load(function (target) target:set("kind", "shared") end) - after_load(function (target) + on_config(function (target) import("load")(target, {frameworks = {"QtCore"}}) end) @@ -67,11 +67,11 @@ rule("qt.console") add_deps("qt.qrc", "qt.ui", "qt.moc") -- we must set kind before target.on_load(), may we will use target in on_load() - before_load(function (target) + on_load(function (target) target:set("kind", "binary") end) - after_load(function (target) + on_config(function (target) import("load")(target, {frameworks = {"QtCore"}}) end) @@ -82,11 +82,11 @@ rule("qt.widgetapp") add_deps("qt.ui", "qt.moc", "qt._wasm_app", "qt.qrc") -- we must set kind before target.on_load(), may we will use target in on_load() - before_load(function (target) - target:set("kind", is_plat("android") and "shared" or "binary") + on_load(function (target) + target:set("kind", target:is_plat("android") and "shared" or "binary") end) - after_load(function (target) + on_config(function (target) import("load")(target, {gui = true, frameworks = {"QtGui", "QtWidgets", "QtCore"}}) end) @@ -103,11 +103,11 @@ rule("qt.widgetapp_static") add_deps("qt.ui", "qt.moc", "qt._wasm_app", "qt.qrc") -- we must set kind before target.on_load(), may we will use target in on_load() - before_load(function (target) - target:set("kind", is_plat("android") and "shared" or "binary") + on_load(function (target) + target:set("kind", target:is_plat("android") and "shared" or "binary") end) - after_load(function (target) + on_config(function (target) -- get qt sdk version local qt = target:data("qt") @@ -153,11 +153,11 @@ rule("qt.quickapp") add_deps("qt.qrc", "qt.moc", "qt._wasm_app") -- we must set kind before target.on_load(), may we will use target in on_load() - before_load(function (target) - target:set("kind", is_plat("android") and "shared" or "binary") + on_load(function (target) + target:set("kind", target:is_plat("android") and "shared" or "binary") end) - after_load(function (target) + on_config(function (target) import("load")(target, {gui = true, frameworks = {"QtGui", "QtQuick", "QtQml", "QtCore", "QtNetwork"}}) end) @@ -174,11 +174,11 @@ rule("qt.quickapp_static") add_deps("qt.qrc", "qt.moc", "qt._wasm_app") -- we must set kind before target.on_load(), may we will use target in on_load() - before_load(function (target) - target:set("kind", is_plat("android") and "shared" or "binary") + on_load(function (target) + target:set("kind", target:is_plat("android") and "shared" or "binary") end) - after_load(function (target) + on_config(function (target) -- get qt sdk version local qt = target:data("qt") diff --git a/xmake/rules/utils/compiler_runtime/xmake.lua b/xmake/rules/utils/compiler_runtime/xmake.lua index a00ef170e..f8e3d39d0 100644 --- a/xmake/rules/utils/compiler_runtime/xmake.lua +++ b/xmake/rules/utils/compiler_runtime/xmake.lua @@ -20,7 +20,7 @@ -- define rule: utils.compiler.runtime rule("utils.compiler.runtime") - after_load(function (target) + on_config(function (target) -- set vs runtime local vs_runtime = get_config("vs_runtime") diff --git a/xmake/rules/utils/inherit_links/xmake.lua b/xmake/rules/utils/inherit_links/xmake.lua index 1ba06ea3c..a6b13a9df 100644 --- a/xmake/rules/utils/inherit_links/xmake.lua +++ b/xmake/rules/utils/inherit_links/xmake.lua @@ -20,5 +20,5 @@ -- define rule: utils.inherit.links rule("utils.inherit.links") - after_load("inherit_links") + on_config("inherit_links") |
