From afa800dfaf01d44eb0d8657a4cdd0fa92ec8dafe Mon Sep 17 00:00:00 2001 From: Liu Date: Sun, 31 May 2026 13:32:02 +0800 Subject: [PATCH] build(xmake): fix package name, target naming and example install - Remove per-lib set_project() calls that overrode the global lcui project name; xmake show now correctly reports the project as lcui. - Move per-lib set_version() into the corresponding target() block so each sub-library keeps an independent version usable for standalone packaging. - Add set_default(false) and set_group(examples) to all pandagl examples so they are no longer picked up by xmake package. - Rename targets to use dashes for consistency: pandagl_cairo_example -> pandagl-cairo-example preview_block_layout -> preview-block-layout preview_flex_layout -> preview-flex-layout preview_scrollbar -> preview-scrollbar preview_widget_opacity -> preview-widget-opacity - Bump yutil submodule to drop its set_project() call as well. --- lib/css/xmake.lua | 4 +- lib/i18n/xmake.lua | 3 +- lib/pandagl/examples/cairo/xmake.lua | 75 +------------------ lib/pandagl/examples/char-render/xmake.lua | 1 + .../examples/fill-rect-with-rgba/xmake.lua | 1 + lib/pandagl/examples/fill-rect/xmake.lua | 1 + .../examples/image-scaling-bench/xmake.lua | 1 + .../examples/mix-rect-with-opacity/xmake.lua | 1 + .../examples/paint-background/xmake.lua | 1 + lib/pandagl/examples/paint-border/xmake.lua | 1 + .../examples/paint-boxshadow/xmake.lua | 1 + .../examples/pixel-manipulation/xmake.lua | 1 + lib/pandagl/examples/string-render/xmake.lua | 1 + lib/pandagl/xmake.lua | 3 +- lib/router/xmake.lua | 4 +- lib/thread/xmake.lua | 3 +- lib/ui-cursor/xmake.lua | 4 +- lib/ui-router/xmake.lua | 4 +- lib/ui-server/xmake.lua | 3 +- lib/ui-xml/xmake.lua | 3 +- lib/ui/xmake.lua | 4 +- lib/yutil | 2 +- tests/previews/xmake.lua | 2 +- 23 files changed, 25 insertions(+), 99 deletions(-) diff --git a/lib/css/xmake.lua b/lib/css/xmake.lua index 0aacb35e..23f75abc 100644 --- a/lib/css/xmake.lua +++ b/lib/css/xmake.lua @@ -1,7 +1,5 @@ -set_project("libcss") -set_version("0.1.0-a") - target("libcss") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/**.c") set_configdir("include/css") diff --git a/lib/i18n/xmake.lua b/lib/i18n/xmake.lua index 8724e262..a4cc43a2 100644 --- a/lib/i18n/xmake.lua +++ b/lib/i18n/xmake.lua @@ -1,8 +1,7 @@ -set_project("i18n") -set_version("0.1.0-a") add_requires("libyaml", { optional = true }) target("libi18n") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/*.c") add_deps("yutil") diff --git a/lib/pandagl/examples/cairo/xmake.lua b/lib/pandagl/examples/cairo/xmake.lua index ab47f051..91e46100 100644 --- a/lib/pandagl/examples/cairo/xmake.lua +++ b/lib/pandagl/examples/cairo/xmake.lua @@ -1,78 +1,9 @@ -add_rules("mode.debug", "mode.release") add_requires("cairo") -target("pandagl_cairo_example") +target("pandagl-cairo-example") + set_default(false) set_kind("binary") + set_group("examples") add_files("src/*.c") add_packages("cairo") add_deps("pandagl", "yutil") - --- --- If you want to known more usage about xmake, please see https://xmake.io --- --- ## FAQ --- --- You can enter the project directory firstly before building project. --- --- $ cd projectdir --- --- 1. How to build project? --- --- $ xmake --- --- 2. How to configure project? --- --- $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release] --- --- 3. Where is the build output directory? --- --- The default output directory is `./build` and you can configure the output directory. --- --- $ xmake f -o outputdir --- $ xmake --- --- 4. How to run and debug target after building project? --- --- $ xmake run [targetname] --- $ xmake run -d [targetname] --- --- 5. How to install target to the system directory or other output directory? --- --- $ xmake install --- $ xmake install -o installdir --- --- 6. Add some frequently-used compilation flags in xmake.lua --- --- @code --- -- add debug and release modes --- add_rules("mode.debug", "mode.release") --- --- -- add macro defination --- add_defines("NDEBUG", "_GNU_SOURCE=1") --- --- -- set warning all as error --- set_warnings("all", "error") --- --- -- set language: c99, c++11 --- set_languages("c99", "c++11") --- --- -- set optimization: none, faster, fastest, smallest --- set_optimize("fastest") --- --- -- add include search directories --- add_includedirs("/usr/include", "/usr/local/include") --- --- -- add link libraries and search directories --- add_links("tbox") --- add_linkdirs("/usr/local/lib", "/usr/lib") --- --- -- add system link libraries --- add_syslinks("z", "pthread") --- --- -- add compilation and link flags --- add_cxflags("-stdnolib", "-fno-strict-aliasing") --- add_ldflags("-L/usr/local/lib", "-lpthread", {force = true}) --- --- @endcode --- - diff --git a/lib/pandagl/examples/char-render/xmake.lua b/lib/pandagl/examples/char-render/xmake.lua index 15cb4c29..65bef22d 100644 --- a/lib/pandagl/examples/char-render/xmake.lua +++ b/lib/pandagl/examples/char-render/xmake.lua @@ -1,6 +1,7 @@ target("char-render") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/examples/fill-rect-with-rgba/xmake.lua b/lib/pandagl/examples/fill-rect-with-rgba/xmake.lua index d5e4a699..17fac919 100644 --- a/lib/pandagl/examples/fill-rect-with-rgba/xmake.lua +++ b/lib/pandagl/examples/fill-rect-with-rgba/xmake.lua @@ -1,6 +1,7 @@ target("fill-rect-with-rgba") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/examples/fill-rect/xmake.lua b/lib/pandagl/examples/fill-rect/xmake.lua index e6a5ee56..777ec91c 100644 --- a/lib/pandagl/examples/fill-rect/xmake.lua +++ b/lib/pandagl/examples/fill-rect/xmake.lua @@ -1,6 +1,7 @@ target("fill-rect") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/examples/image-scaling-bench/xmake.lua b/lib/pandagl/examples/image-scaling-bench/xmake.lua index 167da6d9..cff56e9e 100644 --- a/lib/pandagl/examples/image-scaling-bench/xmake.lua +++ b/lib/pandagl/examples/image-scaling-bench/xmake.lua @@ -1,6 +1,7 @@ target("image-scaling-bench") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl", "yutil") add_files("src/*.c") diff --git a/lib/pandagl/examples/mix-rect-with-opacity/xmake.lua b/lib/pandagl/examples/mix-rect-with-opacity/xmake.lua index 5caea4a8..bd7e8e21 100644 --- a/lib/pandagl/examples/mix-rect-with-opacity/xmake.lua +++ b/lib/pandagl/examples/mix-rect-with-opacity/xmake.lua @@ -1,6 +1,7 @@ target("mix-rect-with-opacity") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/examples/paint-background/xmake.lua b/lib/pandagl/examples/paint-background/xmake.lua index c5619837..1faa3404 100644 --- a/lib/pandagl/examples/paint-background/xmake.lua +++ b/lib/pandagl/examples/paint-background/xmake.lua @@ -1,6 +1,7 @@ target("paint-background") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/examples/paint-border/xmake.lua b/lib/pandagl/examples/paint-border/xmake.lua index 919f6003..59b1798f 100644 --- a/lib/pandagl/examples/paint-border/xmake.lua +++ b/lib/pandagl/examples/paint-border/xmake.lua @@ -1,6 +1,7 @@ target("paint-border") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/examples/paint-boxshadow/xmake.lua b/lib/pandagl/examples/paint-boxshadow/xmake.lua index 934c6300..2465480a 100644 --- a/lib/pandagl/examples/paint-boxshadow/xmake.lua +++ b/lib/pandagl/examples/paint-boxshadow/xmake.lua @@ -1,6 +1,7 @@ target("paint-boxshadow") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/examples/pixel-manipulation/xmake.lua b/lib/pandagl/examples/pixel-manipulation/xmake.lua index 34c0ef93..bcbcc9f5 100644 --- a/lib/pandagl/examples/pixel-manipulation/xmake.lua +++ b/lib/pandagl/examples/pixel-manipulation/xmake.lua @@ -1,6 +1,7 @@ target("pixel-manipulation") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl", "yutil") add_files("src/*.c") diff --git a/lib/pandagl/examples/string-render/xmake.lua b/lib/pandagl/examples/string-render/xmake.lua index 2ad5cf7f..4b8ac98d 100644 --- a/lib/pandagl/examples/string-render/xmake.lua +++ b/lib/pandagl/examples/string-render/xmake.lua @@ -1,6 +1,7 @@ target("string-render") set_default(false) set_kind("binary") + set_group("examples") set_rundir("app") add_deps("pandagl") add_files("src/*.c") diff --git a/lib/pandagl/xmake.lua b/lib/pandagl/xmake.lua index 95150ffc..eb4519ab 100644 --- a/lib/pandagl/xmake.lua +++ b/lib/pandagl/xmake.lua @@ -1,5 +1,3 @@ -set_project("pandagl") -set_version("0.1.0-a") add_requires("libpng", "libjpeg", {optional = true}) add_requires("freetype", {optional = true, configs = {shared = false}}) @@ -23,6 +21,7 @@ option("with-pandagl-text") set_configvar("PANDAGL_HAS_TEXT", 1) target("pandagl") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/*.c") add_deps("yutil") diff --git a/lib/router/xmake.lua b/lib/router/xmake.lua index bd9cd1ad..f548830b 100644 --- a/lib/router/xmake.lua +++ b/lib/router/xmake.lua @@ -1,7 +1,5 @@ -set_project("librouter") -set_version("0.1.0-a") - target("librouter") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/*.c") add_deps("yutil", "libui") diff --git a/lib/thread/xmake.lua b/lib/thread/xmake.lua index 5a9e3e52..53d0d2b0 100644 --- a/lib/thread/xmake.lua +++ b/lib/thread/xmake.lua @@ -1,6 +1,5 @@ -set_version("0.1.0-a") - target("libthread") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/*.c") set_configdir("include") diff --git a/lib/ui-cursor/xmake.lua b/lib/ui-cursor/xmake.lua index 3b99d0c7..0766a52a 100644 --- a/lib/ui-cursor/xmake.lua +++ b/lib/ui-cursor/xmake.lua @@ -1,7 +1,5 @@ -set_project("libui-cursor") -set_version("0.1.0-a") - target("libui-cursor") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/**.c") add_deps("yutil", "pandagl", "libptk") diff --git a/lib/ui-router/xmake.lua b/lib/ui-router/xmake.lua index b244a5c0..ce143c73 100644 --- a/lib/ui-router/xmake.lua +++ b/lib/ui-router/xmake.lua @@ -1,7 +1,5 @@ -set_project("libui-router") -set_version("0.1.0-a") - target("libui-router") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/**.c") add_deps("yutil", "libui", "librouter") diff --git a/lib/ui-server/xmake.lua b/lib/ui-server/xmake.lua index 50b4ac5b..b256eaac 100644 --- a/lib/ui-server/xmake.lua +++ b/lib/ui-server/xmake.lua @@ -1,10 +1,9 @@ -set_project("libui-server") -set_version("0.1.0-a") add_requires("libomp", {optional = true}) option("with-openmp", {showmenu = true, default = true}) target("libui-server") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/**.c") add_packages("libomp") diff --git a/lib/ui-xml/xmake.lua b/lib/ui-xml/xmake.lua index c4caf087..166d066e 100644 --- a/lib/ui-xml/xmake.lua +++ b/lib/ui-xml/xmake.lua @@ -1,8 +1,7 @@ -set_project("libui-xml") -set_version("0.1.0-a") add_requires("libxml2", {optional = true}) target("libui-xml") + set_version("0.1.0-a") add_packages("libxml2") if has_package("libxml2") then set_configvar("LIBUI_XML_HAS_LIBXML2", 1) diff --git a/lib/ui/xmake.lua b/lib/ui/xmake.lua index e5b4d62b..01b547fd 100644 --- a/lib/ui/xmake.lua +++ b/lib/ui/xmake.lua @@ -1,7 +1,5 @@ -set_project("libui") -set_version("0.1.0-a") - target("libui") + set_version("0.1.0-a") set_kind("$(kind)") add_files("src/**.c") add_deps("yutil", "pandagl", "libcss") diff --git a/lib/yutil b/lib/yutil index c91be801..0f6feace 160000 --- a/lib/yutil +++ b/lib/yutil @@ -1 +1 @@ -Subproject commit c91be8015d01b0785794ec83bfa44079952f8aae +Subproject commit 0f6feace9b3c4dde71f0cab2a8a733096cbf47bb diff --git a/tests/previews/xmake.lua b/tests/previews/xmake.lua index 17738d01..0af026ad 100644 --- a/tests/previews/xmake.lua +++ b/tests/previews/xmake.lua @@ -6,7 +6,7 @@ local previews = { } for _, topic in ipairs(previews) do - target("preview_" .. topic) + target("preview-" .. topic:gsub("_", "-")) set_default(false) set_kind("binary") set_group("previews")