From cab174afcbf6bfbb1f4cfd446406e95d4e3b00fa Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 13 Oct 2023 22:35:47 +0800 Subject: improve includes --- tests/apis/check_xxx/xmake.lua | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/apis/check_xxx/xmake.lua b/tests/apis/check_xxx/xmake.lua index a5c748414..c68f71b48 100644 --- a/tests/apis/check_xxx/xmake.lua +++ b/tests/apis/check_xxx/xmake.lua @@ -1,11 +1,4 @@ -includes("check_links.lua") -includes("check_ctypes.lua") -includes("check_cflags.lua") -includes("check_cfuncs.lua") -includes("check_macros.lua") -includes("check_features.lua") -includes("check_csnippets.lua") -includes("check_cincludes.lua") +includes("@builtin/check") target("foo") set_kind("static") -- cgit v1.3.1 From 736522b097bc41506b6b3694c0f1ff095362bfea Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 13 Oct 2023 22:38:13 +0800 Subject: add builtin/qt includes --- tests/projects/qt/quickapp_static/xmake.lua | 2 +- tests/projects/qt/widgetapp_static/xmake.lua | 2 +- xmake/core/base/interpreter.lua | 7 ++++ xmake/includes/qt/qt_add_static_plugins.lua | 43 ++++++++++++++++++++++ xmake/includes/qt/xmake.lua | 21 +++++++++++ xmake/includes/qt_add_static_plugins.lua | 43 ---------------------- .../c++/qt.quickapp_static/project/xmake.lua | 2 +- .../c++/qt.widgetapp_static/project/xmake.lua | 2 +- 8 files changed, 75 insertions(+), 47 deletions(-) create mode 100644 xmake/includes/qt/qt_add_static_plugins.lua create mode 100644 xmake/includes/qt/xmake.lua delete mode 100644 xmake/includes/qt_add_static_plugins.lua (limited to 'tests') diff --git a/tests/projects/qt/quickapp_static/xmake.lua b/tests/projects/qt/quickapp_static/xmake.lua index 196749658..b6bc9a8cb 100644 --- a/tests/projects/qt/quickapp_static/xmake.lua +++ b/tests/projects/qt/quickapp_static/xmake.lua @@ -1,6 +1,6 @@ add_rules("mode.debug", "mode.release") -includes("qt_add_static_plugins.lua") +includes("@builtin/qt") target("demo") add_rules("qt.quickapp_static") diff --git a/tests/projects/qt/widgetapp_static/xmake.lua b/tests/projects/qt/widgetapp_static/xmake.lua index 8ae0094bf..5ca10c888 100644 --- a/tests/projects/qt/widgetapp_static/xmake.lua +++ b/tests/projects/qt/widgetapp_static/xmake.lua @@ -1,6 +1,6 @@ add_rules("mode.debug", "mode.release") -includes("qt_add_static_plugins.lua") +includes("@builtin/qt") target("demo") add_rules("qt.widgetapp_static") diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua index 8be5a8e4f..7ba677a8f 100644 --- a/xmake/core/base/interpreter.lua +++ b/xmake/core/base/interpreter.lua @@ -1720,6 +1720,13 @@ function interpreter:api_builtin_includes(...) found = true utils.warning("deprecated: please use includes(\"@builtin/check\") instead of includes(\"%s\")", subpath) end + elseif subpath:startswith("qt_") then + local files = os.files(path.join(os.programdir(), "includes", "qt", subpath)) + if files and #files > 0 then + table.join2(subpaths_matched, files) + found = true + utils.warning("deprecated: please use includes(\"@builtin/qt\") instead of includes(\"%s\")", subpath) + end end end if not found then diff --git a/xmake/includes/qt/qt_add_static_plugins.lua b/xmake/includes/qt/qt_add_static_plugins.lua new file mode 100644 index 000000000..e65965972 --- /dev/null +++ b/xmake/includes/qt/qt_add_static_plugins.lua @@ -0,0 +1,43 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed 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-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file qt_add_static_plugins.lua +-- + +-- add static plugins for qt rules +-- +-- e.g. +-- +-- @code +-- includes("qt_add_static_plugins.lua") +-- target("test") +-- add_rules("qt.quickapp") +-- add_files("src/*.c") +-- qt_add_static_plugins("QSvgPlugin", {linkdirs = "plugins/imageformats", links = {"qsvg"}}) +-- @endcode +-- +function qt_add_static_plugins(plugin, opt) + opt = opt or {} + add_values("qt.plugins", plugin) + if opt.links then + add_values("qt.links", table.unpack(table.wrap(opt.links))) + end + if opt.linkdirs then + add_values("qt.linkdirs", table.unpack(table.wrap(opt.linkdirs))) + end +end + diff --git a/xmake/includes/qt/xmake.lua b/xmake/includes/qt/xmake.lua new file mode 100644 index 000000000..c08485bf6 --- /dev/null +++ b/xmake/includes/qt/xmake.lua @@ -0,0 +1,21 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed 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-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file xmake.lua +-- + +includes("@builtin/qt/qt_add_static_plugins.lua") diff --git a/xmake/includes/qt_add_static_plugins.lua b/xmake/includes/qt_add_static_plugins.lua deleted file mode 100644 index e65965972..000000000 --- a/xmake/includes/qt_add_static_plugins.lua +++ /dev/null @@ -1,43 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed 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-present, TBOOX Open Source Group. --- --- @author ruki --- @file qt_add_static_plugins.lua --- - --- add static plugins for qt rules --- --- e.g. --- --- @code --- includes("qt_add_static_plugins.lua") --- target("test") --- add_rules("qt.quickapp") --- add_files("src/*.c") --- qt_add_static_plugins("QSvgPlugin", {linkdirs = "plugins/imageformats", links = {"qsvg"}}) --- @endcode --- -function qt_add_static_plugins(plugin, opt) - opt = opt or {} - add_values("qt.plugins", plugin) - if opt.links then - add_values("qt.links", table.unpack(table.wrap(opt.links))) - end - if opt.linkdirs then - add_values("qt.linkdirs", table.unpack(table.wrap(opt.linkdirs))) - end -end - diff --git a/xmake/templates/c++/qt.quickapp_static/project/xmake.lua b/xmake/templates/c++/qt.quickapp_static/project/xmake.lua index 860dc513c..0d752b270 100644 --- a/xmake/templates/c++/qt.quickapp_static/project/xmake.lua +++ b/xmake/templates/c++/qt.quickapp_static/project/xmake.lua @@ -1,6 +1,6 @@ add_rules("mode.debug", "mode.release") -includes("qt_add_static_plugins.lua") +includes("@builtin/qt") target("${TARGETNAME}") add_rules("qt.quickapp_static") diff --git a/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua b/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua index ac08f5c2e..b2cc1ac86 100644 --- a/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua +++ b/xmake/templates/c++/qt.widgetapp_static/project/xmake.lua @@ -1,6 +1,6 @@ add_rules("mode.debug", "mode.release") -includes("qt_add_static_plugins.lua") +includes("@builtin/qt") target("${TARGETNAME}") add_rules("qt.widgetapp_static") -- cgit v1.3.1